From 571f2315fb2be7e6d8de1153c41b3644d6f001f2 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Tue, 19 Mar 2024 03:10:07 -0400 Subject: [PATCH] [AutoRelease] t2-apimanagement-2024-03-19-08399(can only be merged by SDK owner) (#34827) * code and test * Update CHANGELOG.md * Update CHANGELOG.md * Update _version.py --------- Co-authored-by: azure-sdk Co-authored-by: ChenxiJiang333 <119990644+ChenxiJiang333@users.noreply.github.com> --- .../azure-mgmt-apimanagement/CHANGELOG.md | 5 + .../azure-mgmt-apimanagement/README.md | 7 +- .../azure-mgmt-apimanagement/_meta.json | 10 +- .../apimanagement/_api_management_client.py | 26 +- .../mgmt/apimanagement/_configuration.py | 7 +- .../mgmt/apimanagement/_serialization.py | 114 ++-- .../azure/mgmt/apimanagement/_vendor.py | 14 +- .../azure/mgmt/apimanagement/_version.py | 2 +- .../aio/_api_management_client.py | 28 +- .../mgmt/apimanagement/aio/_configuration.py | 7 +- .../operations/_api_diagnostic_operations.py | 147 ++--- .../aio/operations/_api_export_operations.py | 20 +- .../_api_issue_attachment_operations.py | 112 ++-- .../_api_issue_comment_operations.py | 112 ++-- .../aio/operations/_api_issue_operations.py | 146 ++--- .../_api_management_client_operations.py | 73 +-- .../_api_management_operations_operations.py | 26 +- .../_api_management_service_operations.py | 568 +++++------------ ..._api_management_service_skus_operations.py | 28 +- .../_api_management_skus_operations.py | 26 +- .../operations/_api_operation_operations.py | 145 ++--- .../_api_operation_policy_operations.py | 104 +-- .../aio/operations/_api_operations.py | 212 ++----- .../aio/operations/_api_policy_operations.py | 100 +-- .../aio/operations/_api_product_operations.py | 28 +- .../aio/operations/_api_release_operations.py | 147 ++--- .../operations/_api_revision_operations.py | 28 +- .../aio/operations/_api_schema_operations.py | 151 ++--- .../_api_tag_description_operations.py | 112 ++-- .../operations/_api_version_set_operations.py | 149 ++--- .../aio/operations/_api_wiki_operations.py | 122 ++-- .../aio/operations/_api_wikis_operations.py | 28 +- ..._authorization_access_policy_operations.py | 95 +-- .../_authorization_login_links_operations.py | 39 +- .../operations/_authorization_operations.py | 129 ++-- .../_authorization_provider_operations.py | 96 +-- .../_authorization_server_operations.py | 164 ++--- .../aio/operations/_backend_operations.py | 181 ++---- .../aio/operations/_cache_operations.py | 149 ++--- .../aio/operations/_certificate_operations.py | 129 ++-- .../operations/_content_item_operations.py | 112 ++-- .../operations/_content_type_operations.py | 96 +-- .../_delegation_settings_operations.py | 123 ++-- .../_deleted_services_operations.py | 83 +-- .../aio/operations/_diagnostic_operations.py | 147 ++--- .../operations/_documentation_operations.py | 147 ++--- .../operations/_email_template_operations.py | 147 ++--- .../aio/operations/_gateway_api_operations.py | 93 +-- ...ateway_certificate_authority_operations.py | 112 ++-- ...teway_hostname_configuration_operations.py | 111 ++-- .../aio/operations/_gateway_operations.py | 232 +++---- .../operations/_global_schema_operations.py | 151 ++--- .../_graph_ql_api_resolver_operations.py | 146 ++--- ...graph_ql_api_resolver_policy_operations.py | 112 ++-- .../aio/operations/_group_operations.py | 149 ++--- .../aio/operations/_group_user_operations.py | 74 +-- .../_identity_provider_operations.py | 168 ++--- .../aio/operations/_issue_operations.py | 46 +- .../aio/operations/_logger_operations.py | 148 ++--- .../aio/operations/_named_value_operations.py | 278 +++----- .../operations/_network_status_operations.py | 38 +- .../operations/_notification_operations.py | 64 +- ...notification_recipient_email_operations.py | 66 +- ..._notification_recipient_user_operations.py | 66 +- .../_open_id_connect_provider_operations.py | 166 ++--- .../aio/operations/_operation_operations.py | 28 +- ...twork_dependencies_endpoints_operations.py | 22 +- .../_policy_description_operations.py | 20 +- .../operations/_policy_fragment_operations.py | 159 ++--- .../aio/operations/_policy_operations.py | 104 +-- .../operations/_portal_config_operations.py | 125 ++-- .../operations/_portal_revision_operations.py | 203 ++---- .../operations/_portal_settings_operations.py | 20 +- ..._private_endpoint_connection_operations.py | 186 ++---- .../aio/operations/_product_api_operations.py | 74 +-- .../operations/_product_group_operations.py | 74 +-- .../aio/operations/_product_operations.py | 175 ++--- .../operations/_product_policy_operations.py | 104 +-- .../_product_subscriptions_operations.py | 28 +- .../operations/_product_wiki_operations.py | 122 ++-- .../operations/_product_wikis_operations.py | 28 +- .../_quota_by_counter_keys_operations.py | 56 +- .../_quota_by_period_keys_operations.py | 56 +- .../aio/operations/_region_operations.py | 28 +- .../aio/operations/_reports_operations.py | 210 +++--- .../_sign_in_settings_operations.py | 109 ++-- .../_sign_up_settings_operations.py | 109 ++-- .../operations/_subscription_operations.py | 199 ++---- .../aio/operations/_tag_operations.py | 419 +++++------- .../operations/_tag_resource_operations.py | 28 +- .../_tenant_access_git_operations.py | 34 +- .../operations/_tenant_access_operations.py | 185 ++---- .../_tenant_configuration_operations.py | 231 ++----- .../operations/_tenant_settings_operations.py | 46 +- .../_user_confirmation_password_operations.py | 18 +- .../aio/operations/_user_group_operations.py | 28 +- .../operations/_user_identities_operations.py | 28 +- .../aio/operations/_user_operations.py | 202 ++---- .../_user_subscription_operations.py | 46 +- .../models/_api_management_client_enums.py | 32 +- .../mgmt/apimanagement/models/_models_py3.py | 310 ++++----- .../operations/_api_diagnostic_operations.py | 161 ++--- .../operations/_api_export_operations.py | 24 +- .../_api_issue_attachment_operations.py | 124 ++-- .../_api_issue_comment_operations.py | 124 ++-- .../operations/_api_issue_operations.py | 160 ++--- .../_api_management_client_operations.py | 77 +-- .../_api_management_operations_operations.py | 26 +- .../_api_management_service_operations.py | 596 ++++++------------ ..._api_management_service_skus_operations.py | 32 +- .../_api_management_skus_operations.py | 30 +- .../operations/_api_operation_operations.py | 159 ++--- .../_api_operation_policy_operations.py | 116 ++-- .../operations/_api_operations.py | 228 +++---- .../operations/_api_policy_operations.py | 112 ++-- .../operations/_api_product_operations.py | 32 +- .../operations/_api_release_operations.py | 161 ++--- .../operations/_api_revision_operations.py | 32 +- .../operations/_api_schema_operations.py | 163 ++--- .../_api_tag_description_operations.py | 124 ++-- .../operations/_api_version_set_operations.py | 163 ++--- .../operations/_api_wiki_operations.py | 134 ++-- .../operations/_api_wikis_operations.py | 32 +- ..._authorization_access_policy_operations.py | 105 ++- .../_authorization_login_links_operations.py | 43 +- .../operations/_authorization_operations.py | 141 ++--- .../_authorization_provider_operations.py | 106 ++-- .../_authorization_server_operations.py | 180 ++---- .../operations/_backend_operations.py | 197 +++--- .../operations/_cache_operations.py | 163 ++--- .../operations/_certificate_operations.py | 143 ++--- .../operations/_content_item_operations.py | 124 ++-- .../operations/_content_type_operations.py | 106 ++-- .../_delegation_settings_operations.py | 135 ++-- .../_deleted_services_operations.py | 91 +-- .../operations/_diagnostic_operations.py | 161 ++--- .../operations/_documentation_operations.py | 161 ++--- .../operations/_email_template_operations.py | 161 ++--- .../operations/_gateway_api_operations.py | 103 ++- ...ateway_certificate_authority_operations.py | 124 ++-- ...teway_hostname_configuration_operations.py | 123 ++-- .../operations/_gateway_operations.py | 252 +++----- .../operations/_global_schema_operations.py | 163 ++--- .../_graph_ql_api_resolver_operations.py | 160 ++--- ...graph_ql_api_resolver_policy_operations.py | 124 ++-- .../operations/_group_operations.py | 163 ++--- .../operations/_group_user_operations.py | 84 +-- .../_identity_provider_operations.py | 184 ++---- .../operations/_issue_operations.py | 52 +- .../operations/_logger_operations.py | 162 ++--- .../operations/_named_value_operations.py | 296 +++------ .../operations/_network_status_operations.py | 44 +- .../operations/_notification_operations.py | 72 +-- ...notification_recipient_email_operations.py | 76 +-- ..._notification_recipient_user_operations.py | 76 +-- .../_open_id_connect_provider_operations.py | 182 ++---- .../operations/_operation_operations.py | 32 +- ...twork_dependencies_endpoints_operations.py | 26 +- .../_policy_description_operations.py | 24 +- .../operations/_policy_fragment_operations.py | 173 ++--- .../operations/_policy_operations.py | 116 ++-- .../operations/_portal_config_operations.py | 137 ++-- .../operations/_portal_revision_operations.py | 215 ++----- .../operations/_portal_settings_operations.py | 24 +- ..._private_endpoint_connection_operations.py | 200 ++---- .../operations/_product_api_operations.py | 84 +-- .../operations/_product_group_operations.py | 84 +-- .../operations/_product_operations.py | 191 ++---- .../operations/_product_policy_operations.py | 116 ++-- .../_product_subscriptions_operations.py | 32 +- .../operations/_product_wiki_operations.py | 134 ++-- .../operations/_product_wikis_operations.py | 32 +- .../_quota_by_counter_keys_operations.py | 62 +- .../_quota_by_period_keys_operations.py | 62 +- .../operations/_region_operations.py | 32 +- .../operations/_reports_operations.py | 228 +++---- .../_sign_in_settings_operations.py | 119 ++-- .../_sign_up_settings_operations.py | 119 ++-- .../operations/_subscription_operations.py | 219 +++---- .../operations/_tag_operations.py | 463 +++++--------- .../operations/_tag_resource_operations.py | 32 +- .../_tenant_access_git_operations.py | 40 +- .../operations/_tenant_access_operations.py | 203 +++--- .../_tenant_configuration_operations.py | 241 ++----- .../operations/_tenant_settings_operations.py | 52 +- .../_user_confirmation_password_operations.py | 22 +- .../operations/_user_group_operations.py | 32 +- .../operations/_user_identities_operations.py | 32 +- .../operations/_user_operations.py | 220 +++---- .../_user_subscription_operations.py | 52 +- ...ent_apply_network_configuration_updates.py | 1 + ...e_or_reject_private_endpoint_connection.py | 3 + ...ement_authorization_server_list_secrets.py | 1 + .../api_management_backend_reconnect.py | 4 +- .../api_management_backup_with_access_key.py | 3 + ...ent_backup_with_system_managed_identity.py | 3 + ...kup_with_user_assigned_managed_identity.py | 3 + .../api_management_create_ai_logger.py | 3 + .../api_management_create_api.py | 3 + .../api_management_create_api_clone.py | 3 + .../api_management_create_api_diagnostic.py | 3 + .../api_management_create_api_issue.py | 3 + ..._management_create_api_issue_attachment.py | 3 + ...api_management_create_api_issue_comment.py | 3 + ...eate_api_new_version_using_existing_api.py | 3 + .../api_management_create_api_operation.py | 3 + ..._management_create_api_operation_policy.py | 6 + ...api_management_create_api_operation_tag.py | 1 + .../api_management_create_api_policy.py | 6 + ...ement_create_api_policy_non_xml_encoded.py | 6 + .../api_management_create_api_release.py | 3 + ...t_create_api_revision_from_existing_api.py | 3 + .../api_management_create_api_schema.py | 3 + .../api_management_create_api_tag.py | 1 + ...i_management_create_api_tag_description.py | 3 + ...e_api_using_import_override_service_url.py | 3 + ...management_create_api_using_oai3_import.py | 3 + ...slate_required_query_parameters_conduct.py | 3 + ...agement_create_api_using_swagger_import.py | 3 + ...management_create_api_using_wadl_import.py | 3 + .../api_management_create_api_version_set.py | 3 + .../api_management_create_api_wiki.py | 3 + ...t_create_api_with_multiple_auth_servers.py | 3 + ...with_multiple_open_id_connect_providers.py | 3 + ...agement_create_api_with_open_id_connect.py | 3 + ...ment_create_authorization_aad_auth_code.py | 3 + ...nt_create_authorization_aad_client_cred.py | 5 +- ...ment_create_authorization_access_policy.py | 3 + ...te_authorization_provider_aad_auth_code.py | 5 +- ..._authorization_provider_aad_client_cred.py | 3 + ...e_authorization_provider_generic_oauth2.py | 9 +- ...reate_authorization_provider_oob_google.py | 7 +- ..._management_create_authorization_server.py | 3 + ...management_create_backend_proxy_backend.py | 3 + ...anagement_create_backend_service_fabric.py | 3 + .../api_management_create_cache.py | 3 + .../api_management_create_certificate.py | 3 + ...ement_create_certificate_with_key_vault.py | 3 + .../api_management_create_content_type.py | 3 + ...gement_create_content_type_content_item.py | 3 + .../api_management_create_diagnostic.py | 3 + .../api_management_create_documentation.py | 3 + .../api_management_create_eh_logger.py | 3 + .../api_management_create_gateway.py | 3 + .../api_management_create_gateway_api.py | 1 + ...nt_create_gateway_certificate_authority.py | 3 + ...t_create_gateway_hostname_configuration.py | 3 + .../api_management_create_global_schema1.py | 3 + .../api_management_create_global_schema2.py | 3 + .../api_management_create_graph_ql_api.py | 3 + ...management_create_graph_ql_api_resolver.py | 3 + ...ent_create_graph_ql_api_resolver_policy.py | 6 + .../api_management_create_group.py | 3 + .../api_management_create_group_external.py | 3 + .../api_management_create_group_user.py | 1 + ...api_management_create_identity_provider.py | 6 + ...lti_region_service_with_custom_hostname.py | 3 + .../api_management_create_named_value.py | 3 + ...ement_create_named_value_with_key_vault.py | 3 + .../api_management_create_notification.py | 6 + ...ent_create_notification_recipient_email.py | 6 + ...ment_create_notification_recipient_user.py | 6 + ...agement_create_open_id_connect_provider.py | 3 + .../api_management_create_policy.py | 6 + .../api_management_create_policy_fragment.py | 3 + .../api_management_create_portal_config.py | 3 + .../api_management_create_portal_revision.py | 3 + .../api_management_create_product.py | 3 + .../api_management_create_product_api.py | 1 + .../api_management_create_product_group.py | 1 + .../api_management_create_product_policy.py | 6 + .../api_management_create_product_tag.py | 1 + .../api_management_create_product_wiki.py | 3 + .../api_management_create_service.py | 3 + ...pi_management_create_service_having_msi.py | 3 + ...t_create_service_in_vnet_with_public_ip.py | 3 + .../api_management_create_service_in_zones.py | 3 + ..._service_with_custom_hostname_key_vault.py | 3 + ...create_service_with_nat_gateway_enabled.py | 3 + ...create_service_with_system_certificates.py | 3 + ...ate_service_with_user_assigned_identity.py | 3 + ...soap_pass_through_api_using_wsdl_import.py | 3 + ...eate_soap_to_rest_api_using_wsdl_import.py | 3 + .../api_management_create_subscription.py | 3 + .../api_management_create_tag.py | 3 + .../api_management_create_template.py | 6 + .../api_management_create_tenant_access.py | 6 + .../api_management_create_user.py | 3 + .../api_management_create_websocket_api.py | 3 + .../api_management_delete_api.py | 4 +- .../api_management_delete_api_diagnostic.py | 4 +- .../api_management_delete_api_issue.py | 4 +- ..._management_delete_api_issue_attachment.py | 4 +- ...api_management_delete_api_issue_comment.py | 4 +- .../api_management_delete_api_operation.py | 4 +- ..._management_delete_api_operation_policy.py | 9 +- ...api_management_delete_api_operation_tag.py | 4 +- .../api_management_delete_api_policy.py | 9 +- .../api_management_delete_api_release.py | 4 +- .../api_management_delete_api_schema.py | 4 +- .../api_management_delete_api_tag.py | 4 +- ...i_management_delete_api_tag_description.py | 4 +- .../api_management_delete_api_version_set.py | 4 +- .../api_management_delete_api_wiki.py | 4 +- .../api_management_delete_authorization.py | 4 +- ...ment_delete_authorization_access_policy.py | 4 +- ...anagement_delete_authorization_provider.py | 4 +- ..._management_delete_authorization_server.py | 4 +- .../api_management_delete_backend.py | 4 +- .../api_management_delete_cache.py | 4 +- .../api_management_delete_certificate.py | 4 +- .../api_management_delete_content_type.py | 4 +- ...gement_delete_content_type_content_item.py | 4 +- .../api_management_delete_diagnostic.py | 4 +- ...=> api_management_delete_documentation.py} | 12 +- .../api_management_delete_gateway.py | 4 +- .../api_management_delete_gateway_api.py | 4 +- ...nt_delete_gateway_certificate_authority.py | 4 +- ...t_delete_gateway_hostname_configuration.py | 4 +- .../api_management_delete_global_schema.py | 4 +- ...management_delete_graph_ql_api_resolver.py | 4 +- ...ent_delete_graph_ql_api_resolver_policy.py | 9 +- .../api_management_delete_group.py | 4 +- .../api_management_delete_group_user.py | 4 +- ...api_management_delete_identity_provider.py | 9 +- .../api_management_delete_logger.py | 4 +- .../api_management_delete_named_value.py | 4 +- ...ent_delete_notification_recipient_email.py | 9 +- ...ment_delete_notification_recipient_user.py | 9 +- ...agement_delete_open_id_connect_provider.py | 4 +- .../api_management_delete_policy.py | 9 +- .../api_management_delete_policy_fragment.py | 4 +- ...ment_delete_private_endpoint_connection.py | 4 +- .../api_management_delete_product.py | 4 +- .../api_management_delete_product_api.py | 4 +- .../api_management_delete_product_group.py | 4 +- .../api_management_delete_product_policy.py | 9 +- .../api_management_delete_product_tag.py | 4 +- .../api_management_delete_product_wiki.py | 4 +- .../api_management_delete_subscription.py | 4 +- .../api_management_delete_tag.py | 4 +- .../api_management_delete_template.py | 9 +- .../api_management_delete_user.py | 4 +- ...t_deleted_services_list_by_subscription.py | 1 + .../api_management_deleted_services_purge.py | 1 + .../api_management_gateway_generate_token.py | 3 + .../api_management_gateway_list_keys.py | 1 + .../api_management_gateway_regenerate_key.py | 6 +- .../api_management_get_api_contract.py | 1 + .../api_management_get_api_diagnostic.py | 1 + ...agement_get_api_export_in_open_api2dot0.py | 6 + ...agement_get_api_export_in_open_api3dot0.py | 6 + .../api_management_get_api_issue.py | 1 + ...api_management_get_api_issue_attachment.py | 1 + .../api_management_get_api_issue_comment.py | 1 + .../api_management_get_api_operation.py | 1 + ..._management_get_api_operation_pet_store.py | 1 + ...api_management_get_api_operation_policy.py | 6 + .../api_management_get_api_operation_tag.py | 1 + .../api_management_get_api_policy.py | 6 + .../api_management_get_api_release.py | 1 + .../api_management_get_api_revision.py | 1 + .../api_management_get_api_schema.py | 1 + .../api_management_get_api_tag.py | 1 + .../api_management_get_api_tag_description.py | 1 + .../api_management_get_api_version_set.py | 1 + .../api_management_get_api_wiki.py | 1 + .../api_management_get_authorization.py | 1 + ...agement_get_authorization_access_policy.py | 1 + ...agement_get_authorization_login_request.py | 3 + ...i_management_get_authorization_provider.py | 1 + ...api_management_get_authorization_server.py | 1 + .../api_management_get_backend.py | 1 + .../api_management_get_cache.py | 1 + .../api_management_get_certificate.py | 1 + ...nagement_get_certificate_with_key_vault.py | 1 + .../api_management_get_content_type.py | 1 + ...anagement_get_content_type_content_item.py | 1 + ..._management_get_deleted_service_by_name.py | 1 + .../api_management_get_diagnostic.py | 1 + .../api_management_get_documentation.py | 1 + .../api_management_get_gateway.py | 1 + ...ement_get_gateway_certificate_authority.py | 1 + ...ment_get_gateway_hostname_configuration.py | 1 + .../api_management_get_global_schema1.py | 1 + .../api_management_get_global_schema2.py | 1 + ...pi_management_get_graph_ql_api_resolver.py | 1 + ...gement_get_graph_ql_api_resolver_policy.py | 6 + .../api_management_get_group.py | 1 + .../api_management_get_identity_provider.py | 6 + .../api_management_get_issue.py | 1 + .../api_management_get_logger.py | 1 + .../api_management_get_named_value.py | 1 + ...nagement_get_named_value_with_key_vault.py | 1 + .../api_management_get_notification.py | 6 + ...management_get_open_id_connect_provider.py | 1 + .../api_management_get_policy.py | 6 + .../api_management_get_policy_format.py | 6 + .../api_management_get_policy_fragment.py | 1 + ...i_management_get_policy_fragment_format.py | 1 + .../api_management_get_portal_revision.py | 1 + ...agement_get_private_endpoint_connection.py | 1 + ...agement_get_private_link_group_resource.py | 1 + .../api_management_get_product.py | 1 + .../api_management_get_product_policy.py | 6 + .../api_management_get_product_tag.py | 1 + .../api_management_get_product_wiki.py | 1 + .../api_management_get_quota_counter_keys.py | 1 + ..._get_quota_counter_keys_by_quota_period.py | 1 + .../api_management_get_reports_by_geo.py | 43 -- ...api_management_get_reports_by_operation.py | 43 -- .../api_management_get_reports_by_product.py | 43 -- .../api_management_get_reports_by_request.py | 43 -- ..._management_get_reports_by_subscription.py | 43 -- .../api_management_get_reports_by_user.py | 43 -- .../api_management_get_subscription.py | 1 + .../api_management_get_tag.py | 1 + .../api_management_get_template.py | 6 + .../api_management_get_tenant_access.py | 6 + .../api_management_get_tenant_git_access.py | 6 + .../api_management_get_tenant_settings.py | 6 + .../api_management_get_user.py | 1 + .../api_management_get_user_subscription.py | 1 + .../api_management_head_api.py | 1 + .../api_management_head_api_diagnostic.py | 1 + .../api_management_head_api_issue.py | 1 + ...pi_management_head_api_issue_attachment.py | 1 + .../api_management_head_api_issue_comment.py | 1 + .../api_management_head_api_operation.py | 1 + ...pi_management_head_api_operation_policy.py | 6 + .../api_management_head_api_operation_tag.py | 1 + .../api_management_head_api_policy.py | 6 + .../api_management_head_api_release.py | 1 + .../api_management_head_api_schema.py | 1 + .../api_management_head_api_tag.py | 1 + ...api_management_head_api_tag_description.py | 1 + .../api_management_head_api_version_set.py | 1 + .../api_management_head_api_wiki.py | 1 + ...pi_management_head_authorization_server.py | 1 + .../api_management_head_backend.py | 1 + .../api_management_head_cache.py | 1 + .../api_management_head_certificate.py | 1 + ...nagement_head_content_type_content_item.py | 1 + ...api_management_head_delegation_settings.py | 1 + .../api_management_head_diagnostic.py | 1 + .../api_management_head_documentation.py | 1 + .../api_management_head_email_template.py | 6 + .../api_management_head_gateway.py | 1 + .../api_management_head_gateway_api.py | 1 + ...ment_head_gateway_certificate_authority.py | 1 + ...ent_head_gateway_hostname_configuration.py | 1 + .../api_management_head_global_schema.py | 1 + ...i_management_head_graph_ql_api_resolver.py | 1 + ...ement_head_graph_ql_api_resolver_policy.py | 6 + .../api_management_head_group.py | 1 + .../api_management_head_group_user.py | 1 + .../api_management_head_identity_provider.py | 6 + .../api_management_head_logger.py | 1 + .../api_management_head_named_value.py | 1 + ...ement_head_notification_recipient_email.py | 6 + ...gement_head_notification_recipient_user.py | 6 + ...anagement_head_open_id_connect_provider.py | 1 + .../api_management_head_policy.py | 6 + .../api_management_head_policy_fragment.py | 1 + .../api_management_head_portal_config.py | 1 + .../api_management_head_portal_revision.py | 1 + .../api_management_head_product.py | 1 + .../api_management_head_product_api.py | 1 + .../api_management_head_product_group.py | 1 + .../api_management_head_product_policy.py | 6 + .../api_management_head_product_tag.py | 1 + .../api_management_head_product_wiki.py | 1 + .../api_management_head_sign_in_settings.py | 1 + .../api_management_head_sign_up_settings.py | 1 + .../api_management_head_subscription.py | 1 + .../api_management_head_tag.py | 1 + .../api_management_head_tenant_access.py | 6 + .../api_management_head_user.py | 1 + ...nagement_identity_provider_list_secrets.py | 6 + .../api_management_list_api_diagnostics.py | 1 + ...i_management_list_api_issue_attachments.py | 1 + .../api_management_list_api_issue_comments.py | 1 + .../api_management_list_api_issues.py | 1 + ..._management_list_api_operation_policies.py | 1 + .../api_management_list_api_operation_tags.py | 1 + .../api_management_list_api_operations.py | 1 + ..._management_list_api_operations_by_tags.py | 1 + .../api_management_list_api_policies.py | 1 + .../api_management_list_api_products.py | 1 + .../api_management_list_api_releases.py | 1 + .../api_management_list_api_revisions.py | 1 + .../api_management_list_api_schemas.py | 1 + ...pi_management_list_api_tag_descriptions.py | 1 + .../api_management_list_api_tags.py | 1 + .../api_management_list_api_version_sets.py | 1 + .../api_management_list_api_wikis.py | 1 + .../api_management_list_apis.py | 1 + .../api_management_list_apis_by_tags.py | 1 + ...ment_list_authorization_access_policies.py | 1 + ...management_list_authorization_providers.py | 1 + ...i_management_list_authorization_servers.py | 1 + ...anagement_list_authorizations_auth_code.py | 1 + ...agement_list_authorizations_client_cred.py | 1 + .../api_management_list_backends.py | 1 + .../api_management_list_caches.py | 1 + .../api_management_list_certificates.py | 1 + ...agement_list_content_type_content_items.py | 1 + .../api_management_list_content_types.py | 1 + .../api_management_list_diagnostics.py | 1 + .../api_management_list_documentations.py | 1 + .../api_management_list_gateway_apis.py | 1 + ...nt_list_gateway_certificate_authorities.py | 1 + ...nt_list_gateway_hostname_configurations.py | 1 + .../api_management_list_gateways.py | 1 + .../api_management_list_global_schemas.py | 1 + ...ent_list_graph_ql_api_resolver_policies.py | 1 + ..._management_list_graph_ql_api_resolvers.py | 1 + .../api_management_list_group_users.py | 1 + .../api_management_list_groups.py | 1 + .../api_management_list_identity_providers.py | 1 + .../api_management_list_issues.py | 1 + .../api_management_list_loggers.py | 1 + .../api_management_list_named_values.py | 1 + ...ment_list_notification_recipient_emails.py | 6 + ...ement_list_notification_recipient_users.py | 6 + .../api_management_list_notifications.py | 1 + ...nagement_list_open_id_connect_providers.py | 1 + .../api_management_list_operations.py | 1 + .../api_management_list_policies.py | 1 + ...api_management_list_policy_descriptions.py | 1 + ...agement_list_policy_fragment_references.py | 1 + .../api_management_list_policy_fragments.py | 1 + .../api_management_list_portal_config.py | 1 + .../api_management_list_portal_revisions.py | 1 + .../api_management_list_portal_settings.py | 1 + ...ement_list_private_endpoint_connections.py | 1 + ...ement_list_private_link_group_resources.py | 1 + .../api_management_list_product_apis.py | 1 + .../api_management_list_product_groups.py | 1 + .../api_management_list_product_policies.py | 1 + ...i_management_list_product_subscriptions.py | 1 + .../api_management_list_product_tags.py | 1 + .../api_management_list_product_wikis.py | 1 + .../api_management_list_products.py | 1 + .../api_management_list_products_by_tags.py | 1 + .../api_management_list_regions.py | 1 + ..._secrets_portal_settings_validation_key.py | 1 + ...i_management_list_secrets_tenant_access.py | 6 + ...management_list_service_by_subscription.py | 1 + ...vice_by_subscription_and_resource_group.py | 1 + .../api_management_list_sk_us_consumption.py | 1 + .../api_management_list_sk_us_dedicated.py | 1 + .../api_management_list_sku.py | 1 + .../api_management_list_subscriptions.py | 1 + .../api_management_list_tag_resources.py | 1 + .../api_management_list_tags.py | 1 + .../api_management_list_templates.py | 1 + .../api_management_list_tenant_access.py | 1 + .../api_management_list_tenant_settings.py | 1 + .../api_management_list_user_groups.py | 1 + .../api_management_list_user_identities.py | 1 + .../api_management_list_user_subscriptions.py | 1 + .../api_management_list_users.py | 1 + .../api_management_named_value_list_value.py | 1 + ...nt_openid_connect_provider_list_secrets.py | 1 + ...i_management_perform_connectivity_check.py | 3 + ...perform_connectivity_check_http_connect.py | 3 + .../api_management_portal_config.py | 1 + ...nagement_portal_settings_get_delegation.py | 1 + ..._management_portal_settings_get_sign_in.py | 1 + ..._management_portal_settings_get_sign_up.py | 1 + ...nagement_portal_settings_put_delegation.py | 3 + ..._management_portal_settings_put_sign_in.py | 3 + ..._management_portal_settings_put_sign_up.py | 3 + ...ement_portal_settings_update_delegation.py | 6 +- ...nagement_portal_settings_update_sign_in.py | 6 +- ...nagement_portal_settings_update_sign_up.py | 6 +- ...horization_confirm_consent_code_request.py | 6 +- .../api_management_refresh_certificate.py | 1 + .../api_management_refresh_named_value.py | 1 + .../api_management_restore_with_access_key.py | 3 + ...agement_service_check_name_availability.py | 3 + .../api_management_service_delete_service.py | 1 + ...service_get_domain_ownership_identifier.py | 1 + ..._service_get_multi_region_internal_vnet.py | 1 + ...i_management_service_get_network_status.py | 1 + ..._service_get_network_status_by_location.py | 1 + ...outbound_network_dependencies_endpoints.py | 1 + .../api_management_service_get_service.py | 1 + ...nagement_service_get_service_having_msi.py | 1 + .../api_management_service_get_sso_token.py | 1 + .../api_management_service_migrate_to_stv2.py | 1 + ...pi_management_subscription_list_secrets.py | 1 + ...ent_subscription_regenerate_primary_key.py | 4 +- ...t_subscription_regenerate_secondary_key.py | 4 +- ...management_tenant_access_regenerate_key.py | 9 +- ...api_management_tenant_access_sync_state.py | 6 + ..._management_tenant_configuration_deploy.py | 6 + ...pi_management_tenant_configuration_save.py | 6 + ...anagement_tenant_configuration_validate.py | 6 + .../api_management_undelete.py | 3 + .../api_management_update_api.py | 3 + .../api_management_update_api_diagnostic.py | 3 + .../api_management_update_api_issue.py | 3 + .../api_management_update_api_operation.py | 3 + .../api_management_update_api_release.py | 3 + .../api_management_update_api_version_set.py | 3 + .../api_management_update_api_wiki.py | 3 + ..._management_update_authorization_server.py | 3 + .../api_management_update_backend.py | 3 + .../api_management_update_cache.py | 3 + .../api_management_update_diagnostic.py | 3 + ...=> api_management_update_documentation.py} | 17 +- .../api_management_update_gateway.py | 3 + ...management_update_graph_ql_api_resolver.py | 3 + .../api_management_update_group.py | 3 + ...api_management_update_identity_provider.py | 6 + .../api_management_update_logger.py | 3 + .../api_management_update_named_value.py | 3 + ...agement_update_open_id_connect_provider.py | 3 + .../api_management_update_portal_config.py | 3 + .../api_management_update_portal_revision.py | 3 + .../api_management_update_product.py | 3 + .../api_management_update_product_wiki.py | 3 + ...api_management_update_quota_counter_key.py | 3 + ...pdate_quota_counter_key_by_quota_period.py | 3 + ...management_update_service_disable_tls10.py | 3 + ...gement_update_service_publisher_details.py | 3 + ...ment_update_service_to_new_vnet_and_azs.py | 3 + .../api_management_update_subscription.py | 3 + .../api_management_update_tag.py | 3 + .../api_management_update_template.py | 6 + .../api_management_update_tenant_access.py | 6 + .../api_management_update_user.py | 3 + ...agement_user_confirmation_password_send.py | 4 +- .../api_management_user_generate_sso_url.py | 1 + .../api_management_user_token.py | 3 + .../sdk_packaging.toml | 2 +- .../azure-mgmt-apimanagement/setup.py | 85 +-- 639 files changed, 8736 insertions(+), 14633 deletions(-) rename sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/{api_management_get_reports_by_api.py => api_management_delete_documentation.py} (84%) delete mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_geo.py delete mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_operation.py delete mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_product.py delete mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_request.py delete mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_subscription.py delete mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_user.py rename sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/{api_management_get_reports_by_time.py => api_management_update_documentation.py} (80%) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/CHANGELOG.md b/sdk/apimanagement/azure-mgmt-apimanagement/CHANGELOG.md index a63104ca2c36..cafa3fb9537e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/CHANGELOG.md +++ b/sdk/apimanagement/azure-mgmt-apimanagement/CHANGELOG.md @@ -1,5 +1,10 @@ # Release History +## 4.0.1 (2024-03-19) + +### Other Changes + - Regenerate samples + ## 4.0.0 (2023-04-20) ### Features Added diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/README.md b/sdk/apimanagement/azure-mgmt-apimanagement/README.md index 0629c942a9f4..664dece54b6c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/README.md +++ b/sdk/apimanagement/azure-mgmt-apimanagement/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure API Management Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.8+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.8+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -59,6 +59,3 @@ Code samples for this package can be found at: If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. - - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-apimanagement%2FREADME.png) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json b/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json index e9a1ab81399b..e4d9ef0f2597 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json +++ b/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json @@ -1,11 +1,11 @@ { - "commit": "1198b4b73bed8c941a51acb037f1531166aa6728", + "commit": "44d7a32482656b3a79a2fa11ac27c981f8e0e3cd", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.4.8", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.13.7", + "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/apimanagement/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.4.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/apimanagement/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 --tag=package-2022-08 --use=@autorest/python@6.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False", "readme": "specification/apimanagement/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_api_management_client.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_api_management_client.py index 1c6cf3dbbf86..b27dedf560d2 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_api_management_client.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_api_management_client.py @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import ApiManagementClientConfiguration @@ -337,7 +339,25 @@ def __init__( self._config = ApiManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -496,7 +516,7 @@ def __init__( ) self.documentation = DocumentationOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -516,7 +536,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_configuration.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_configuration.py index 482c605f60f0..751176a90d42 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_configuration.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -19,7 +18,7 @@ from azure.core.credentials import TokenCredential -class ApiManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class ApiManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for ApiManagementClient. Note that all parameters used to create this instance are saved as instance @@ -35,7 +34,6 @@ class ApiManagementClientConfiguration(Configuration): # pylint: disable=too-ma """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(ApiManagementClientConfiguration, self).__init__(**kwargs) api_version: str = kwargs.pop("api_version", "2022-08-01") if credential is None: @@ -48,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-apimanagement/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_serialization.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_serialization.py index 842ae727fbbc..2f781d740827 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_serialization.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_serialization.py @@ -63,8 +63,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +143,7 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -295,7 +288,7 @@ class Model(object): _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + self.additional_properties: Optional[Dict[str, Any]] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -340,7 +333,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +344,7 @@ 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) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore def as_dict( self, @@ -390,7 +383,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -415,7 +408,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -445,7 +438,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -545,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -662,12 +655,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -709,7 +703,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -729,6 +723,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -741,7 +736,9 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. - :rtype: str + :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 """ @@ -749,10 +746,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -803,7 +798,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -823,7 +818,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -891,6 +886,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -903,9 +900,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -950,7 +952,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -983,7 +987,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1160,10 +1164,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1199,7 +1203,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1220,7 +1223,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1361,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1381,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1434,7 +1436,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1471,7 +1473,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1505,14 +1507,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1568,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1642,7 +1644,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1690,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1747,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1798,7 +1800,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1852,10 +1853,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1883,7 +1884,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1900,7 +1901,7 @@ def deserialize_date(attr): if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1935,7 +1936,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1972,7 +1973,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1988,9 +1989,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_vendor.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_vendor.py index c4b00a9e8112..ffe974b35563 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_vendor.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import List, TYPE_CHECKING, cast +from typing import TYPE_CHECKING from azure.core.pipeline.transport import HttpRequest @@ -27,18 +27,6 @@ def _convert_request(request, files=None): return request -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) - - class ApiManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_version.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_version.py index 77f53a3589c6..f4674910a502 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_version.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "4.0.1" diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_api_management_client.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_api_management_client.py index 8e1734ebd7c6..8c472f3c2199 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_api_management_client.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_api_management_client.py @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer @@ -344,7 +346,25 @@ def __init__( self._config = ApiManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -503,7 +523,9 @@ def __init__( ) self.documentation = DocumentationOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -523,7 +545,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_configuration.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_configuration.py index b5324d50cf8e..6649dde49846 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_configuration.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -19,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class ApiManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class ApiManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for ApiManagementClient. Note that all parameters used to create this instance are saved as instance @@ -35,7 +34,6 @@ class ApiManagementClientConfiguration(Configuration): # pylint: disable=too-ma """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(ApiManagementClientConfiguration, self).__init__(**kwargs) api_version: str = kwargs.pop("api_version", "2022-08-01") if credential is None: @@ -48,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-apimanagement/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_diagnostic_operations.py index 1a4fba479507..a7ef0d45eb39 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_diagnostic_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_diagnostic_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -91,7 +92,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiagnosticContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.DiagnosticContract] @@ -114,7 +114,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -123,12 +123,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -140,13 +139,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("DiagnosticCollection", pipeline_response) @@ -156,11 +155,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -173,10 +172,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, api_id: str, diagnostic_id: str, **kwargs: Any @@ -194,7 +189,6 @@ async def get_entity_tag( :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management service instance. Required. :type diagnostic_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -213,23 +207,22 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, diagnostic_id=diagnostic_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -243,13 +236,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, api_id: str, diagnostic_id: str, **kwargs: Any @@ -267,7 +256,6 @@ async def get( :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management service instance. Required. :type diagnostic_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -286,23 +274,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, diagnostic_id=diagnostic_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -318,13 +305,9 @@ async def get( deserialized = self._deserialize("DiagnosticContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -360,7 +343,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -373,7 +355,7 @@ async def create_or_update( service_name: str, api_id: str, diagnostic_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -393,14 +375,13 @@ async def create_or_update( service instance. Required. :type diagnostic_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -413,7 +394,7 @@ async def create_or_update( service_name: str, api_id: str, diagnostic_id: str, - parameters: Union[_models.DiagnosticContract, IO], + parameters: Union[_models.DiagnosticContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.DiagnosticContract: @@ -430,16 +411,12 @@ async def create_or_update( :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management service instance. Required. :type diagnostic_id: str - :param parameters: Create parameters. Is either a DiagnosticContract type or a IO type. + :param parameters: Create parameters. Is either a DiagnosticContract type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO + :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -462,12 +439,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DiagnosticContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -478,16 +455,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -513,10 +489,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" - } - @overload async def update( self, @@ -551,7 +523,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -565,7 +536,7 @@ async def update( api_id: str, diagnostic_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -587,11 +558,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Diagnostic Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -605,7 +575,7 @@ async def update( api_id: str, diagnostic_id: str, if_match: str, - parameters: Union[_models.DiagnosticContract, IO], + parameters: Union[_models.DiagnosticContract, IO[bytes]], **kwargs: Any ) -> _models.DiagnosticContract: """Updates the details of the Diagnostic for an API specified by its identifier. @@ -624,13 +594,9 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Diagnostic Update parameters. Is either a DiagnosticContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Diagnostic Update parameters. Is either a DiagnosticContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO[bytes] :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -653,12 +619,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DiagnosticContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -669,16 +635,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -694,13 +659,9 @@ async def update( deserialized = self._deserialize("DiagnosticContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -722,7 +683,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -741,7 +701,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -749,16 +709,15 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -769,8 +728,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_export_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_export_operations.py index f9e4df4f7cc2..deca47cc566c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_export_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_export_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -78,7 +78,6 @@ async def get( :type format: str or ~azure.mgmt.apimanagement.models.ExportFormat :param export: Query parameter required to export the API details. "true" Required. :type export: str or ~azure.mgmt.apimanagement.models.ExportApi - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiExportResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiExportResult :raises ~azure.core.exceptions.HttpResponseError: @@ -97,7 +96,7 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApiExportResult] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -105,16 +104,15 @@ async def get( format=format, export=export, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -127,10 +125,6 @@ async def get( deserialized = self._deserialize("ApiExportResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_attachment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_attachment_operations.py index 60fd8d6bdac2..3e24b20f9db4 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_attachment_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_attachment_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -95,7 +96,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IssueAttachmentContract or the result of cls(response) :rtype: @@ -119,7 +119,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -129,12 +129,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -146,13 +145,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("IssueAttachmentCollection", pipeline_response) @@ -162,11 +161,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -179,10 +178,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, api_id: str, issue_id: str, attachment_id: str, **kwargs: Any @@ -204,7 +199,6 @@ async def get_entity_tag( :param attachment_id: Attachment identifier within an Issue. Must be unique in the current Issue. Required. :type attachment_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -223,7 +217,7 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -231,16 +225,15 @@ async def get_entity_tag( attachment_id=attachment_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -254,13 +247,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, api_id: str, issue_id: str, attachment_id: str, **kwargs: Any @@ -281,7 +270,6 @@ async def get( :param attachment_id: Attachment identifier within an Issue. Must be unique in the current Issue. Required. :type attachment_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueAttachmentContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueAttachmentContract :raises ~azure.core.exceptions.HttpResponseError: @@ -300,7 +288,7 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IssueAttachmentContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -308,16 +296,15 @@ async def get( attachment_id=attachment_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -333,13 +320,9 @@ async def get( deserialized = self._deserialize("IssueAttachmentContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -379,7 +362,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueAttachmentContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueAttachmentContract :raises ~azure.core.exceptions.HttpResponseError: @@ -393,7 +375,7 @@ async def create_or_update( api_id: str, issue_id: str, attachment_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -416,14 +398,13 @@ async def create_or_update( Issue. Required. :type attachment_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueAttachmentContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueAttachmentContract :raises ~azure.core.exceptions.HttpResponseError: @@ -437,7 +418,7 @@ async def create_or_update( api_id: str, issue_id: str, attachment_id: str, - parameters: Union[_models.IssueAttachmentContract, IO], + parameters: Union[_models.IssueAttachmentContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.IssueAttachmentContract: @@ -457,16 +438,12 @@ async def create_or_update( :param attachment_id: Attachment identifier within an Issue. Must be unique in the current Issue. Required. :type attachment_id: str - :param parameters: Create parameters. Is either a IssueAttachmentContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.IssueAttachmentContract or IO + :param parameters: Create parameters. Is either a IssueAttachmentContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.IssueAttachmentContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueAttachmentContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueAttachmentContract :raises ~azure.core.exceptions.HttpResponseError: @@ -489,12 +466,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "IssueAttachmentContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -506,16 +483,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -541,10 +517,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, @@ -575,7 +547,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -594,7 +565,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -603,16 +574,15 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -623,8 +593,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_comment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_comment_operations.py index 55a96b197ee6..aeea6c77fcae 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_comment_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_comment_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -95,7 +96,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IssueCommentContract or the result of cls(response) :rtype: @@ -119,7 +119,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -129,12 +129,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -146,13 +145,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("IssueCommentCollection", pipeline_response) @@ -162,11 +161,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -179,10 +178,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, api_id: str, issue_id: str, comment_id: str, **kwargs: Any @@ -204,7 +199,6 @@ async def get_entity_tag( :param comment_id: Comment identifier within an Issue. Must be unique in the current Issue. Required. :type comment_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -223,7 +217,7 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -231,16 +225,15 @@ async def get_entity_tag( comment_id=comment_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -254,13 +247,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, api_id: str, issue_id: str, comment_id: str, **kwargs: Any @@ -281,7 +270,6 @@ async def get( :param comment_id: Comment identifier within an Issue. Must be unique in the current Issue. Required. :type comment_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueCommentContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueCommentContract :raises ~azure.core.exceptions.HttpResponseError: @@ -300,7 +288,7 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IssueCommentContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -308,16 +296,15 @@ async def get( comment_id=comment_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -333,13 +320,9 @@ async def get( deserialized = self._deserialize("IssueCommentContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -379,7 +362,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueCommentContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueCommentContract :raises ~azure.core.exceptions.HttpResponseError: @@ -393,7 +375,7 @@ async def create_or_update( api_id: str, issue_id: str, comment_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -416,14 +398,13 @@ async def create_or_update( Required. :type comment_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueCommentContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueCommentContract :raises ~azure.core.exceptions.HttpResponseError: @@ -437,7 +418,7 @@ async def create_or_update( api_id: str, issue_id: str, comment_id: str, - parameters: Union[_models.IssueCommentContract, IO], + parameters: Union[_models.IssueCommentContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.IssueCommentContract: @@ -457,16 +438,12 @@ async def create_or_update( :param comment_id: Comment identifier within an Issue. Must be unique in the current Issue. Required. :type comment_id: str - :param parameters: Create parameters. Is either a IssueCommentContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.IssueCommentContract or IO + :param parameters: Create parameters. Is either a IssueCommentContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.IssueCommentContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueCommentContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueCommentContract :raises ~azure.core.exceptions.HttpResponseError: @@ -489,12 +466,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "IssueCommentContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -506,16 +483,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -541,10 +517,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, @@ -575,7 +547,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -594,7 +565,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -603,16 +574,15 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -623,8 +593,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_operations.py index 22208fa291de..f1443090a530 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -95,7 +96,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IssueContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.IssueContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -117,7 +117,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -127,12 +127,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -144,13 +143,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("IssueCollection", pipeline_response) @@ -160,11 +159,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -177,10 +176,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, api_id: str, issue_id: str, **kwargs: Any @@ -198,7 +193,6 @@ async def get_entity_tag( :param issue_id: Issue identifier. Must be unique in the current API Management service instance. Required. :type issue_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -217,23 +211,22 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, issue_id=issue_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -247,13 +240,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" - } - @distributed_trace_async async def get( self, @@ -279,7 +268,6 @@ async def get( :type issue_id: str :param expand_comments_attachments: Expand the comment attachments. Default value is None. :type expand_comments_attachments: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueContract :raises ~azure.core.exceptions.HttpResponseError: @@ -298,7 +286,7 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IssueContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -306,16 +294,15 @@ async def get( subscription_id=self._config.subscription_id, expand_comments_attachments=expand_comments_attachments, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -331,13 +318,9 @@ async def get( deserialized = self._deserialize("IssueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -373,7 +356,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueContract :raises ~azure.core.exceptions.HttpResponseError: @@ -386,7 +368,7 @@ async def create_or_update( service_name: str, api_id: str, issue_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -406,14 +388,13 @@ async def create_or_update( instance. Required. :type issue_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueContract :raises ~azure.core.exceptions.HttpResponseError: @@ -426,7 +407,7 @@ async def create_or_update( service_name: str, api_id: str, issue_id: str, - parameters: Union[_models.IssueContract, IO], + parameters: Union[_models.IssueContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.IssueContract: @@ -443,15 +424,12 @@ async def create_or_update( :param issue_id: Issue identifier. Must be unique in the current API Management service instance. Required. :type issue_id: str - :param parameters: Create parameters. Is either a IssueContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.IssueContract or IO + :param parameters: Create parameters. Is either a IssueContract type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.apimanagement.models.IssueContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueContract :raises ~azure.core.exceptions.HttpResponseError: @@ -474,12 +452,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "IssueContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -490,16 +468,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -525,10 +502,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" - } - @overload async def update( self, @@ -563,7 +536,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueContract :raises ~azure.core.exceptions.HttpResponseError: @@ -577,7 +549,7 @@ async def update( api_id: str, issue_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -599,11 +571,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueContract :raises ~azure.core.exceptions.HttpResponseError: @@ -617,7 +588,7 @@ async def update( api_id: str, issue_id: str, if_match: str, - parameters: Union[_models.IssueUpdateContract, IO], + parameters: Union[_models.IssueUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.IssueContract: """Updates an existing issue for an API. @@ -636,13 +607,9 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a IssueUpdateContract type or a IO type. + :param parameters: Update parameters. Is either a IssueUpdateContract type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.IssueUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :type parameters: ~azure.mgmt.apimanagement.models.IssueUpdateContract or IO[bytes] :return: IssueContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueContract :raises ~azure.core.exceptions.HttpResponseError: @@ -665,12 +632,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "IssueUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -681,16 +648,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -706,13 +672,9 @@ async def update( deserialized = self._deserialize("IssueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -734,7 +696,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -753,7 +714,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -761,16 +722,15 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -781,8 +741,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_client_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_client_operations.py index d0f344bf2423..80276e2d9d75 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_client_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_client_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -39,7 +40,7 @@ async def _perform_connectivity_check_async_initial( # pylint: disable=name-too self, resource_group_name: str, service_name: str, - connectivity_check_request_params: Union[_models.ConnectivityCheckRequest, IO], + connectivity_check_request_params: Union[_models.ConnectivityCheckRequest, IO[bytes]], **kwargs: Any ) -> Optional[_models.ConnectivityCheckResponse]: error_map = { @@ -60,12 +61,12 @@ async def _perform_connectivity_check_async_initial( # pylint: disable=name-too content_type = content_type or "application/json" _json = None _content = None - if isinstance(connectivity_check_request_params, (IO, bytes)): + if isinstance(connectivity_check_request_params, (IOBase, bytes)): _content = connectivity_check_request_params else: _json = self._serialize.body(connectivity_check_request_params, "ConnectivityCheckRequest") - request = build_perform_connectivity_check_async_request( + _request = build_perform_connectivity_check_async_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -73,16 +74,15 @@ async def _perform_connectivity_check_async_initial( # pylint: disable=name-too content_type=content_type, json=_json, content=_content, - template_url=self._perform_connectivity_check_async_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -97,13 +97,9 @@ async def _perform_connectivity_check_async_initial( # pylint: disable=name-too deserialized = self._deserialize("ConnectivityCheckResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _perform_connectivity_check_async_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/connectivityCheck" - } + return deserialized # type: ignore @overload async def begin_perform_connectivity_check_async( @@ -129,14 +125,6 @@ async def begin_perform_connectivity_check_async( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ConnectivityCheckResponse or the result of cls(response) :rtype: @@ -149,7 +137,7 @@ async def begin_perform_connectivity_check_async( self, resource_group_name: str, service_name: str, - connectivity_check_request_params: IO, + connectivity_check_request_params: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -163,18 +151,10 @@ async def begin_perform_connectivity_check_async( :param service_name: The name of the API Management service. Required. :type service_name: str :param connectivity_check_request_params: Connectivity Check request parameters. Required. - :type connectivity_check_request_params: IO + :type connectivity_check_request_params: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ConnectivityCheckResponse or the result of cls(response) :rtype: @@ -187,7 +167,7 @@ async def begin_perform_connectivity_check_async( self, resource_group_name: str, service_name: str, - connectivity_check_request_params: Union[_models.ConnectivityCheckRequest, IO], + connectivity_check_request_params: Union[_models.ConnectivityCheckRequest, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ConnectivityCheckResponse]: """Performs a connectivity check between the API Management service and a given destination, and @@ -199,20 +179,9 @@ async def begin_perform_connectivity_check_async( :param service_name: The name of the API Management service. Required. :type service_name: str :param connectivity_check_request_params: Connectivity Check request parameters. Is either a - ConnectivityCheckRequest type or a IO type. Required. + ConnectivityCheckRequest type or a IO[bytes] type. Required. :type connectivity_check_request_params: - ~azure.mgmt.apimanagement.models.ConnectivityCheckRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ~azure.mgmt.apimanagement.models.ConnectivityCheckRequest or IO[bytes] :return: An instance of AsyncLROPoller that returns either ConnectivityCheckResponse or the result of cls(response) :rtype: @@ -245,7 +214,7 @@ async def begin_perform_connectivity_check_async( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ConnectivityCheckResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -257,14 +226,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ConnectivityCheckResponse].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_perform_connectivity_check_async.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/connectivityCheck" - } + return AsyncLROPoller[_models.ConnectivityCheckResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_operations_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_operations_operations.py index 926a6ed0c2b9..ecc6845d5d2f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_operations_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_operations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -57,7 +57,6 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """Lists all of the available REST API operations of the Microsoft.ApiManagement provider. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -79,14 +78,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -98,13 +96,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -114,11 +112,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -130,5 +128,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ApiManagement/operations"} diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_service_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_service_operations.py index b6dbb6c33eb0..eb084d2c6305 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_service_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_service_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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 @@ -74,7 +75,7 @@ async def _restore_initial( self, resource_group_name: str, service_name: str, - parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO], + parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO[bytes]], **kwargs: Any ) -> Optional[_models.ApiManagementServiceResource]: error_map = { @@ -95,12 +96,12 @@ async def _restore_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiManagementServiceBackupRestoreParameters") - request = build_restore_request( + _request = build_restore_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -108,16 +109,15 @@ async def _restore_initial( content_type=content_type, json=_json, content=_content, - template_url=self._restore_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -136,13 +136,9 @@ async def _restore_initial( response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _restore_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore" - } + return deserialized # type: ignore @overload async def begin_restore( @@ -169,14 +165,6 @@ async def begin_restore( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -189,7 +177,7 @@ async def begin_restore( self, resource_group_name: str, service_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -205,18 +193,10 @@ async def begin_restore( :type service_name: str :param parameters: Parameters supplied to the Restore API Management service from backup operation. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -229,7 +209,7 @@ async def begin_restore( self, resource_group_name: str, service_name: str, - parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO], + parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ApiManagementServiceResource]: """Restores a backup of an API Management service created using the ApiManagementService_Backup @@ -242,20 +222,10 @@ async def begin_restore( :param service_name: The name of the API Management service. Required. :type service_name: str :param parameters: Parameters supplied to the Restore API Management service from backup - operation. Is either a ApiManagementServiceBackupRestoreParameters type or a IO type. Required. + operation. Is either a ApiManagementServiceBackupRestoreParameters type or a IO[bytes] type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceBackupRestoreParameters - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or IO[bytes] :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -288,7 +258,7 @@ async def begin_restore( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -300,23 +270,21 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ApiManagementServiceResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_restore.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore" - } + return AsyncLROPoller[_models.ApiManagementServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _backup_initial( self, resource_group_name: str, service_name: str, - parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO], + parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO[bytes]], **kwargs: Any ) -> Optional[_models.ApiManagementServiceResource]: error_map = { @@ -337,12 +305,12 @@ async def _backup_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiManagementServiceBackupRestoreParameters") - request = build_backup_request( + _request = build_backup_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -350,16 +318,15 @@ async def _backup_initial( content_type=content_type, json=_json, content=_content, - template_url=self._backup_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -378,13 +345,9 @@ async def _backup_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _backup_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup" - } + return deserialized # type: ignore @overload async def begin_backup( @@ -409,14 +372,6 @@ async def begin_backup( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -429,7 +384,7 @@ async def begin_backup( self, resource_group_name: str, service_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -443,18 +398,10 @@ async def begin_backup( :param service_name: The name of the API Management service. Required. :type service_name: str :param parameters: Parameters supplied to the ApiManagementService_Backup operation. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -467,7 +414,7 @@ async def begin_backup( self, resource_group_name: str, service_name: str, - parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO], + parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ApiManagementServiceResource]: """Creates a backup of the API Management service to the given Azure Storage Account. This is long @@ -479,20 +426,9 @@ async def begin_backup( :param service_name: The name of the API Management service. Required. :type service_name: str :param parameters: Parameters supplied to the ApiManagementService_Backup operation. Is either - a ApiManagementServiceBackupRestoreParameters type or a IO type. Required. + a ApiManagementServiceBackupRestoreParameters type or a IO[bytes] type. Required. :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceBackupRestoreParameters - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or IO[bytes] :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -525,7 +461,7 @@ async def begin_backup( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -537,23 +473,21 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ApiManagementServiceResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_backup.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup" - } + return AsyncLROPoller[_models.ApiManagementServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _create_or_update_initial( self, resource_group_name: str, service_name: str, - parameters: Union[_models.ApiManagementServiceResource, IO], + parameters: Union[_models.ApiManagementServiceResource, IO[bytes]], **kwargs: Any ) -> _models.ApiManagementServiceResource: error_map = { @@ -574,12 +508,12 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiManagementServiceResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -587,16 +521,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -617,10 +550,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" - } - @overload async def begin_create_or_update( self, @@ -645,14 +574,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -665,7 +586,7 @@ async def begin_create_or_update( self, resource_group_name: str, service_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -680,18 +601,10 @@ async def begin_create_or_update( :type service_name: str :param parameters: Parameters supplied to the CreateOrUpdate API Management service operation. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -704,7 +617,7 @@ async def begin_create_or_update( self, resource_group_name: str, service_name: str, - parameters: Union[_models.ApiManagementServiceResource, IO], + parameters: Union[_models.ApiManagementServiceResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ApiManagementServiceResource]: """Creates or updates an API Management service. This is long running operation and could take @@ -716,19 +629,8 @@ async def begin_create_or_update( :param service_name: The name of the API Management service. Required. :type service_name: str :param parameters: Parameters supplied to the CreateOrUpdate API Management service operation. - Is either a ApiManagementServiceResource type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + Is either a ApiManagementServiceResource type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -761,7 +663,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -771,23 +673,21 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ApiManagementServiceResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" - } + return AsyncLROPoller[_models.ApiManagementServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, resource_group_name: str, service_name: str, - parameters: Union[_models.ApiManagementServiceUpdateParameters, IO], + parameters: Union[_models.ApiManagementServiceUpdateParameters, IO[bytes]], **kwargs: Any ) -> Optional[_models.ApiManagementServiceResource]: error_map = { @@ -808,12 +708,12 @@ async def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiManagementServiceUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -821,16 +721,15 @@ async def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -845,13 +744,9 @@ async def _update_initial( deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -876,14 +771,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -896,7 +783,7 @@ async def begin_update( self, resource_group_name: str, service_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -910,18 +797,10 @@ async def begin_update( :type service_name: str :param parameters: Parameters supplied to the CreateOrUpdate API Management service operation. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -934,7 +813,7 @@ async def begin_update( self, resource_group_name: str, service_name: str, - parameters: Union[_models.ApiManagementServiceUpdateParameters, IO], + parameters: Union[_models.ApiManagementServiceUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ApiManagementServiceResource]: """Updates an existing API Management service. @@ -945,19 +824,9 @@ async def begin_update( :param service_name: The name of the API Management service. Required. :type service_name: str :param parameters: Parameters supplied to the CreateOrUpdate API Management service operation. - Is either a ApiManagementServiceUpdateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + Is either a ApiManagementServiceUpdateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceUpdateParameters or + IO[bytes] :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -990,7 +859,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1000,17 +869,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ApiManagementServiceResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" - } + return AsyncLROPoller[_models.ApiManagementServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def get( @@ -1023,7 +890,6 @@ async def get( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiManagementServiceResource or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceResource :raises ~azure.core.exceptions.HttpResponseError: @@ -1042,21 +908,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1069,13 +934,9 @@ async def get( deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" - } + return deserialized # type: ignore async def _delete_initial( self, resource_group_name: str, service_name: str, **kwargs: Any @@ -1094,21 +955,20 @@ async def _delete_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1123,13 +983,9 @@ async def _delete_initial( deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -1142,14 +998,6 @@ async def begin_delete( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -1179,7 +1027,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1189,17 +1037,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ApiManagementServiceResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" - } + return AsyncLROPoller[_models.ApiManagementServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _migrate_to_stv2_initial( self, resource_group_name: str, service_name: str, **kwargs: Any @@ -1218,21 +1064,20 @@ async def _migrate_to_stv2_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None) - request = build_migrate_to_stv2_request( + _request = build_migrate_to_stv2_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._migrate_to_stv2_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1251,13 +1096,9 @@ async def _migrate_to_stv2_initial( response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _migrate_to_stv2_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/migrateToStv2" - } + return deserialized # type: ignore @distributed_trace_async async def begin_migrate_to_stv2( @@ -1272,14 +1113,6 @@ async def begin_migrate_to_stv2( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -1309,7 +1142,7 @@ async def begin_migrate_to_stv2( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1321,17 +1154,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ApiManagementServiceResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_migrate_to_stv2.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/migrateToStv2" - } + return AsyncLROPoller[_models.ApiManagementServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_by_resource_group( @@ -1342,7 +1173,6 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -1366,16 +1196,15 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1387,13 +1216,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ApiManagementServiceListResult", pipeline_response) @@ -1403,11 +1232,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1420,15 +1249,10 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service" - } - @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.ApiManagementServiceResource"]: """Lists all API Management services within an Azure subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -1452,15 +1276,14 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ApiManagementServiceReso def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1472,13 +1295,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ApiManagementServiceListResult", pipeline_response) @@ -1488,11 +1311,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1505,8 +1328,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service"} - @distributed_trace_async async def get_sso_token( self, resource_group_name: str, service_name: str, **kwargs: Any @@ -1518,7 +1339,6 @@ async def get_sso_token( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiManagementServiceGetSsoTokenResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceGetSsoTokenResult :raises ~azure.core.exceptions.HttpResponseError: @@ -1537,21 +1357,20 @@ async def get_sso_token( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApiManagementServiceGetSsoTokenResult] = kwargs.pop("cls", None) - request = build_get_sso_token_request( + _request = build_get_sso_token_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_sso_token.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1564,13 +1383,9 @@ async def get_sso_token( deserialized = self._deserialize("ApiManagementServiceGetSsoTokenResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_sso_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/getssotoken" - } + return deserialized # type: ignore @overload async def check_name_availability( @@ -1588,7 +1403,6 @@ async def check_name_availability( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiManagementServiceNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: @@ -1596,16 +1410,15 @@ async def check_name_availability( @overload async def check_name_availability( - self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.ApiManagementServiceNameAvailabilityResult: """Checks availability and correctness of a name for an API Management service. :param parameters: Parameters supplied to the CheckNameAvailability operation. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiManagementServiceNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: @@ -1613,18 +1426,15 @@ async def check_name_availability( @distributed_trace_async async def check_name_availability( - self, parameters: Union[_models.ApiManagementServiceCheckNameAvailabilityParameters, IO], **kwargs: Any + self, parameters: Union[_models.ApiManagementServiceCheckNameAvailabilityParameters, IO[bytes]], **kwargs: Any ) -> _models.ApiManagementServiceNameAvailabilityResult: """Checks availability and correctness of a name for an API Management service. :param parameters: Parameters supplied to the CheckNameAvailability operation. Is either a - ApiManagementServiceCheckNameAvailabilityParameters type or a IO type. Required. + ApiManagementServiceCheckNameAvailabilityParameters type or a IO[bytes] type. Required. :type parameters: - ~azure.mgmt.apimanagement.models.ApiManagementServiceCheckNameAvailabilityParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.apimanagement.models.ApiManagementServiceCheckNameAvailabilityParameters or + IO[bytes] :return: ApiManagementServiceNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: @@ -1647,27 +1457,26 @@ async def check_name_availability( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiManagementServiceCheckNameAvailabilityParameters") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1680,13 +1489,9 @@ async def check_name_availability( deserialized = self._deserialize("ApiManagementServiceNameAvailabilityResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability" - } + return deserialized # type: ignore @distributed_trace_async async def get_domain_ownership_identifier( @@ -1694,7 +1499,6 @@ async def get_domain_ownership_identifier( ) -> _models.ApiManagementServiceGetDomainOwnershipIdentifierResult: """Get the custom domain ownership identifier for an API Management service. - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiManagementServiceGetDomainOwnershipIdentifierResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceGetDomainOwnershipIdentifierResult :raises ~azure.core.exceptions.HttpResponseError: @@ -1713,19 +1517,18 @@ async def get_domain_ownership_identifier( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApiManagementServiceGetDomainOwnershipIdentifierResult] = kwargs.pop("cls", None) - request = build_get_domain_ownership_identifier_request( + _request = build_get_domain_ownership_identifier_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_domain_ownership_identifier.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1738,19 +1541,15 @@ async def get_domain_ownership_identifier( deserialized = self._deserialize("ApiManagementServiceGetDomainOwnershipIdentifierResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_domain_ownership_identifier.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier" - } + return deserialized # type: ignore async def _apply_network_configuration_updates_initial( # pylint: disable=name-too-long self, resource_group_name: str, service_name: str, - parameters: Optional[Union[_models.ApiManagementServiceApplyNetworkConfigurationParameters, IO]] = None, + parameters: Optional[Union[_models.ApiManagementServiceApplyNetworkConfigurationParameters, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.ApiManagementServiceResource]: error_map = { @@ -1771,7 +1570,7 @@ async def _apply_network_configuration_updates_initial( # pylint: disable=name- content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: if parameters is not None: @@ -1779,7 +1578,7 @@ async def _apply_network_configuration_updates_initial( # pylint: disable=name- else: _json = None - request = build_apply_network_configuration_updates_request( + _request = build_apply_network_configuration_updates_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -1787,16 +1586,15 @@ async def _apply_network_configuration_updates_initial( # pylint: disable=name- content_type=content_type, json=_json, content=_content, - template_url=self._apply_network_configuration_updates_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1815,13 +1613,9 @@ async def _apply_network_configuration_updates_initial( # pylint: disable=name- response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _apply_network_configuration_updates_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates" - } + return deserialized # type: ignore @overload async def begin_apply_network_configuration_updates( # pylint: disable=name-too-long @@ -1849,14 +1643,6 @@ async def begin_apply_network_configuration_updates( # pylint: disable=name-too :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -1869,7 +1655,7 @@ async def begin_apply_network_configuration_updates( # pylint: disable=name-too self, resource_group_name: str, service_name: str, - parameters: Optional[IO] = None, + parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -1885,18 +1671,10 @@ async def begin_apply_network_configuration_updates( # pylint: disable=name-too :param parameters: Parameters supplied to the Apply Network Configuration operation. If the parameters are empty, all the regions in which the Api Management service is deployed will be updated sequentially without incurring downtime in the region. Default value is None. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -1909,7 +1687,7 @@ async def begin_apply_network_configuration_updates( # pylint: disable=name-too self, resource_group_name: str, service_name: str, - parameters: Optional[Union[_models.ApiManagementServiceApplyNetworkConfigurationParameters, IO]] = None, + parameters: Optional[Union[_models.ApiManagementServiceApplyNetworkConfigurationParameters, IO[bytes]]] = None, **kwargs: Any ) -> AsyncLROPoller[_models.ApiManagementServiceResource]: """Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated @@ -1923,21 +1701,11 @@ async def begin_apply_network_configuration_updates( # pylint: disable=name-too :param parameters: Parameters supplied to the Apply Network Configuration operation. If the parameters are empty, all the regions in which the Api Management service is deployed will be updated sequentially without incurring downtime in the region. Is either a - ApiManagementServiceApplyNetworkConfigurationParameters type or a IO type. Default value is - None. + ApiManagementServiceApplyNetworkConfigurationParameters type or a IO[bytes] type. Default value + is None. :type parameters: - ~azure.mgmt.apimanagement.models.ApiManagementServiceApplyNetworkConfigurationParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ~azure.mgmt.apimanagement.models.ApiManagementServiceApplyNetworkConfigurationParameters or + IO[bytes] :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -1970,7 +1738,7 @@ async def begin_apply_network_configuration_updates( # pylint: disable=name-too def get_long_running_output(pipeline_response): deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1982,14 +1750,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ApiManagementServiceResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_apply_network_configuration_updates.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates" - } + return AsyncLROPoller[_models.ApiManagementServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_service_skus_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_service_skus_operations.py index 6929dcdc3ec5..ff56c9c5e1b8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_service_skus_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_service_skus_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -66,7 +66,6 @@ def list_available_service_skus( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceSkuResult or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ResourceSkuResult] @@ -89,17 +88,16 @@ def list_available_service_skus( def prepare_request(next_link=None): if not next_link: - request = build_list_available_service_skus_request( + _request = build_list_available_service_skus_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_available_service_skus.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -111,13 +109,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ResourceSkuResults", pipeline_response) @@ -127,11 +125,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -143,7 +141,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_available_service_skus.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/skus" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_skus_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_skus_operations.py index 109f61cd8b2e..aa5e770d4073 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_skus_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_skus_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -57,7 +57,6 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.ApiManagementSku"]: """Gets the list of Microsoft.ApiManagement SKUs available for your Subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiManagementSku or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiManagementSku] @@ -80,15 +79,14 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ApiManagementSku"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -100,13 +98,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ApiManagementSkusResult", pipeline_response) @@ -116,11 +114,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,5 +130,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/skus"} diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_operations.py index c59441fc4931..8c28e203c901 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -98,7 +99,6 @@ def list_by_api( :type skip: int :param tags: Include tags in the response. Default value is None. :type tags: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.OperationContract] @@ -121,7 +121,7 @@ def list_by_api( def prepare_request(next_link=None): if not next_link: - request = build_list_by_api_request( + _request = build_list_by_api_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -131,12 +131,11 @@ def prepare_request(next_link=None): skip=skip, tags=tags, api_version=api_version, - template_url=self.list_by_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -148,13 +147,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("OperationCollection", pipeline_response) @@ -164,11 +163,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -181,10 +180,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, api_id: str, operation_id: str, **kwargs: Any @@ -202,7 +197,6 @@ async def get_entity_tag( :param operation_id: Operation identifier within an API. Must be unique in the current API Management service instance. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -221,23 +215,22 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,13 +244,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, api_id: str, operation_id: str, **kwargs: Any @@ -275,7 +264,6 @@ async def get( :param operation_id: Operation identifier within an API. Must be unique in the current API Management service instance. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OperationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -294,23 +282,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -326,13 +313,9 @@ async def get( deserialized = self._deserialize("OperationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -368,7 +351,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OperationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -381,7 +363,7 @@ async def create_or_update( service_name: str, api_id: str, operation_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -401,14 +383,13 @@ async def create_or_update( Management service instance. Required. :type operation_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OperationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -421,7 +402,7 @@ async def create_or_update( service_name: str, api_id: str, operation_id: str, - parameters: Union[_models.OperationContract, IO], + parameters: Union[_models.OperationContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.OperationContract: @@ -438,16 +419,12 @@ async def create_or_update( :param operation_id: Operation identifier within an API. Must be unique in the current API Management service instance. Required. :type operation_id: str - :param parameters: Create parameters. Is either a OperationContract type or a IO type. + :param parameters: Create parameters. Is either a OperationContract type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.OperationContract or IO + :type parameters: ~azure.mgmt.apimanagement.models.OperationContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OperationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -470,12 +447,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "OperationContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -486,16 +463,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -521,10 +497,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" - } - @overload async def update( self, @@ -559,7 +531,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OperationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -573,7 +544,7 @@ async def update( api_id: str, operation_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -595,11 +566,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: API Operation Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OperationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -613,7 +583,7 @@ async def update( api_id: str, operation_id: str, if_match: str, - parameters: Union[_models.OperationUpdateContract, IO], + parameters: Union[_models.OperationUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.OperationContract: """Updates the details of the operation in the API specified by its identifier. @@ -633,12 +603,8 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: API Operation Update parameters. Is either a OperationUpdateContract type or - a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.OperationUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.OperationUpdateContract or IO[bytes] :return: OperationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OperationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -661,12 +627,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "OperationUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -677,16 +643,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -702,13 +667,9 @@ async def update( deserialized = self._deserialize("OperationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -730,7 +691,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -749,7 +709,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -757,16 +717,15 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -777,8 +736,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_policy_operations.py index 575575b9d0f0..ccaab7636299 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_policy_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -74,7 +75,6 @@ async def list_by_operation( :param operation_id: Operation identifier within an API. Must be unique in the current API Management service instance. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -93,23 +93,22 @@ async def list_by_operation( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None) - request = build_list_by_operation_request( + _request = build_list_by_operation_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_operation.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -122,13 +121,9 @@ async def list_by_operation( deserialized = self._deserialize("PolicyCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_operation.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies" - } + return deserialized # type: ignore @distributed_trace_async async def get_entity_tag( @@ -155,7 +150,6 @@ async def get_entity_tag( :type operation_id: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -174,7 +168,7 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -182,16 +176,15 @@ async def get_entity_tag( policy_id=policy_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -205,13 +198,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}" - } - @distributed_trace_async async def get( self, @@ -241,7 +230,6 @@ async def get( :param format: Policy Export Format. Known values are: "xml" and "rawxml". Default value is "xml". :type format: str or ~azure.mgmt.apimanagement.models.PolicyExportFormat - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -260,7 +248,7 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -269,16 +257,15 @@ async def get( subscription_id=self._config.subscription_id, format=format, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -294,13 +281,9 @@ async def get( deserialized = self._deserialize("PolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -339,7 +322,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -353,7 +335,7 @@ async def create_or_update( api_id: str, operation_id: str, policy_id: Union[str, _models.PolicyIdName], - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -375,14 +357,13 @@ async def create_or_update( :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName :param parameters: The policy contents to apply. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -396,7 +377,7 @@ async def create_or_update( api_id: str, operation_id: str, policy_id: Union[str, _models.PolicyIdName], - parameters: Union[_models.PolicyContract, IO], + parameters: Union[_models.PolicyContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.PolicyContract: @@ -415,16 +396,12 @@ async def create_or_update( :type operation_id: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO + :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -447,12 +424,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PolicyContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -464,16 +441,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -499,10 +475,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, @@ -532,7 +504,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -551,7 +522,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -560,16 +531,15 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -580,8 +550,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operations.py index 900226c8a735..3ef0a274184d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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 @@ -104,7 +105,6 @@ def list_by_service( :param expand_api_version_set: Include full ApiVersionSet resource in response. Default value is None. :type expand_api_version_set: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -126,7 +126,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -136,12 +136,11 @@ def prepare_request(next_link=None): tags=tags, expand_api_version_set=expand_api_version_set, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -153,13 +152,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ApiCollection", pipeline_response) @@ -169,11 +168,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,10 +185,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis" - } - @distributed_trace_async async def get_entity_tag(self, resource_group_name: str, service_name: str, api_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the API specified by its identifier. @@ -202,7 +197,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, api_ :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -221,22 +215,21 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, api_ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -250,13 +243,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, api_ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" - } - @distributed_trace_async async def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs: Any) -> _models.ApiContract: """Gets the details of the API specified by its identifier. @@ -269,7 +258,6 @@ async def get(self, resource_group_name: str, service_name: str, api_id: str, ** :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -288,22 +276,21 @@ async def get(self, resource_group_name: str, service_name: str, api_id: str, ** api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApiContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -319,20 +306,16 @@ async def get(self, resource_group_name: str, service_name: str, api_id: str, ** deserialized = self._deserialize("ApiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, service_name: str, api_id: str, - parameters: Union[_models.ApiCreateOrUpdateParameter, IO], + parameters: Union[_models.ApiCreateOrUpdateParameter, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> Optional[_models.ApiContract]: @@ -354,12 +337,12 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiCreateOrUpdateParameter") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -369,16 +352,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -401,13 +383,9 @@ async def _create_or_update_initial( deserialized = self._deserialize("ApiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -439,14 +417,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ApiContract or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiContract] @@ -459,7 +429,7 @@ async def begin_create_or_update( resource_group_name: str, service_name: str, api_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -476,21 +446,13 @@ async def begin_create_or_update( instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required. :type api_id: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ApiContract or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiContract] @@ -503,7 +465,7 @@ async def begin_create_or_update( resource_group_name: str, service_name: str, api_id: str, - parameters: Union[_models.ApiCreateOrUpdateParameter, IO], + parameters: Union[_models.ApiCreateOrUpdateParameter, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> AsyncLROPoller[_models.ApiContract]: @@ -518,22 +480,11 @@ async def begin_create_or_update( instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required. :type api_id: str :param parameters: Create or update parameters. Is either a ApiCreateOrUpdateParameter type or - a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ApiCreateOrUpdateParameter or IO + a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ApiCreateOrUpdateParameter or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ApiContract or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiContract] @@ -571,7 +522,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("ApiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -583,17 +534,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ApiContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" - } + return AsyncLROPoller[_models.ApiContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update( @@ -625,7 +574,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -638,7 +586,7 @@ async def update( service_name: str, api_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -657,11 +605,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: API Update Contract parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -674,7 +621,7 @@ async def update( service_name: str, api_id: str, if_match: str, - parameters: Union[_models.ApiUpdateContract, IO], + parameters: Union[_models.ApiUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.ApiContract: """Updates the specified API of the API Management service instance. @@ -690,13 +637,9 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: API Update Contract parameters. Is either a ApiUpdateContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ApiUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: API Update Contract parameters. Is either a ApiUpdateContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ApiUpdateContract or IO[bytes] :return: ApiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -719,12 +662,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -734,16 +677,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -759,13 +701,9 @@ async def update( deserialized = self._deserialize("ApiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -792,7 +730,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :type if_match: str :param delete_revisions: Delete all revisions of the Api. Default value is None. :type delete_revisions: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -811,7 +748,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -819,16 +756,15 @@ async def delete( # pylint: disable=inconsistent-return-statements if_match=if_match, delete_revisions=delete_revisions, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -839,11 +775,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_by_tags( @@ -880,7 +812,6 @@ def list_by_tags( :type skip: int :param include_not_tagged_apis: Include not tagged APIs. Default value is None. :type include_not_tagged_apis: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TagResourceContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagResourceContract] @@ -903,7 +834,7 @@ def list_by_tags( def prepare_request(next_link=None): if not next_link: - request = build_list_by_tags_request( + _request = build_list_by_tags_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -912,12 +843,11 @@ def prepare_request(next_link=None): skip=skip, include_not_tagged_apis=include_not_tagged_apis, api_version=api_version, - template_url=self.list_by_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -929,13 +859,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("TagResourceCollection", pipeline_response) @@ -945,11 +875,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -961,7 +891,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apisByTags" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_policy_operations.py index 1ed610ac38c7..7dd4eb436f2a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_policy_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -71,7 +72,6 @@ async def list_by_api( :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -90,22 +90,21 @@ async def list_by_api( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None) - request = build_list_by_api_request( + _request = build_list_by_api_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -118,13 +117,9 @@ async def list_by_api( deserialized = self._deserialize("PolicyCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies" - } + return deserialized # type: ignore @distributed_trace_async async def get_entity_tag( @@ -147,7 +142,6 @@ async def get_entity_tag( :type api_id: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -166,23 +160,22 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, policy_id=policy_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -196,13 +189,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}" - } - @distributed_trace_async async def get( self, @@ -228,7 +217,6 @@ async def get( :param format: Policy Export Format. Known values are: "xml" and "rawxml". Default value is "xml". :type format: str or ~azure.mgmt.apimanagement.models.PolicyExportFormat - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -247,7 +235,7 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -255,16 +243,15 @@ async def get( subscription_id=self._config.subscription_id, format=format, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -290,10 +277,6 @@ async def get( return deserialized # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}" - } - @overload async def create_or_update( self, @@ -327,7 +310,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -340,7 +322,7 @@ async def create_or_update( service_name: str, api_id: str, policy_id: Union[str, _models.PolicyIdName], - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -359,14 +341,13 @@ async def create_or_update( :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName :param parameters: The policy contents to apply. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -379,7 +360,7 @@ async def create_or_update( service_name: str, api_id: str, policy_id: Union[str, _models.PolicyIdName], - parameters: Union[_models.PolicyContract, IO], + parameters: Union[_models.PolicyContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.PolicyContract: @@ -395,16 +376,12 @@ async def create_or_update( :type api_id: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO + :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -427,12 +404,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PolicyContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -443,16 +420,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -478,10 +454,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, @@ -507,7 +479,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -526,7 +497,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -534,16 +505,15 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -554,8 +524,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_product_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_product_operations.py index 0140e7637b02..9bac8262d0d4 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_product_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_product_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -83,7 +83,6 @@ def list_by_apis( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProductContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ProductContract] @@ -106,7 +105,7 @@ def list_by_apis( def prepare_request(next_link=None): if not next_link: - request = build_list_by_apis_request( + _request = build_list_by_apis_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -115,12 +114,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_apis.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -132,13 +130,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ProductCollection", pipeline_response) @@ -148,11 +146,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -164,7 +162,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_apis.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/products" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_release_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_release_operations.py index 3209088fbb49..fc1b729d416d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_release_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_release_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -93,7 +94,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiReleaseContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiReleaseContract] @@ -116,7 +116,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -125,12 +125,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -142,13 +141,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ApiReleaseCollection", pipeline_response) @@ -158,11 +157,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -175,10 +174,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, api_id: str, release_id: str, **kwargs: Any @@ -196,7 +191,6 @@ async def get_entity_tag( :param release_id: Release identifier within an API. Must be unique in the current API Management service instance. Required. :type release_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -215,23 +209,22 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, release_id=release_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -245,13 +238,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, api_id: str, release_id: str, **kwargs: Any @@ -269,7 +258,6 @@ async def get( :param release_id: Release identifier within an API. Must be unique in the current API Management service instance. Required. :type release_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiReleaseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -288,23 +276,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApiReleaseContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, release_id=release_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -320,13 +307,9 @@ async def get( deserialized = self._deserialize("ApiReleaseContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -362,7 +345,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiReleaseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -375,7 +357,7 @@ async def create_or_update( service_name: str, api_id: str, release_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -395,14 +377,13 @@ async def create_or_update( Management service instance. Required. :type release_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiReleaseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -415,7 +396,7 @@ async def create_or_update( service_name: str, api_id: str, release_id: str, - parameters: Union[_models.ApiReleaseContract, IO], + parameters: Union[_models.ApiReleaseContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.ApiReleaseContract: @@ -432,16 +413,12 @@ async def create_or_update( :param release_id: Release identifier within an API. Must be unique in the current API Management service instance. Required. :type release_id: str - :param parameters: Create parameters. Is either a ApiReleaseContract type or a IO type. + :param parameters: Create parameters. Is either a ApiReleaseContract type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract or IO + :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiReleaseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -464,12 +441,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiReleaseContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -480,16 +457,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -515,10 +491,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" - } - @overload async def update( self, @@ -553,7 +525,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiReleaseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -567,7 +538,7 @@ async def update( api_id: str, release_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -589,11 +560,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: API Release Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiReleaseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -607,7 +577,7 @@ async def update( api_id: str, release_id: str, if_match: str, - parameters: Union[_models.ApiReleaseContract, IO], + parameters: Union[_models.ApiReleaseContract, IO[bytes]], **kwargs: Any ) -> _models.ApiReleaseContract: """Updates the details of the release of the API specified by its identifier. @@ -626,13 +596,9 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: API Release Update parameters. Is either a ApiReleaseContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: API Release Update parameters. Is either a ApiReleaseContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract or IO[bytes] :return: ApiReleaseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -655,12 +621,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiReleaseContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -671,16 +637,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -696,13 +661,9 @@ async def update( deserialized = self._deserialize("ApiReleaseContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -724,7 +685,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -743,7 +703,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -751,16 +711,15 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -771,8 +730,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_revision_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_revision_operations.py index 643aa10cf83f..dcf50132e204 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_revision_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_revision_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -83,7 +83,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiRevisionContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiRevisionContract] @@ -106,7 +105,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -115,12 +114,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -132,13 +130,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ApiRevisionCollection", pipeline_response) @@ -148,11 +146,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -164,7 +162,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/revisions" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_schema_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_schema_operations.py index 163408db9d4c..782a6061539b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_schema_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_schema_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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 @@ -92,7 +93,6 @@ def list_by_api( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SchemaContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.SchemaContract] @@ -115,7 +115,7 @@ def list_by_api( def prepare_request(next_link=None): if not next_link: - request = build_list_by_api_request( + _request = build_list_by_api_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -124,12 +124,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -141,13 +140,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("SchemaCollection", pipeline_response) @@ -157,11 +156,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -174,10 +173,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, api_id: str, schema_id: str, **kwargs: Any @@ -195,7 +190,6 @@ async def get_entity_tag( :param schema_id: Schema id identifier. Must be unique in the current API Management service instance. Required. :type schema_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -214,23 +208,22 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, schema_id=schema_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -244,13 +237,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, api_id: str, schema_id: str, **kwargs: Any @@ -268,7 +257,6 @@ async def get( :param schema_id: Schema id identifier. Must be unique in the current API Management service instance. Required. :type schema_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SchemaContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SchemaContract :raises ~azure.core.exceptions.HttpResponseError: @@ -287,23 +275,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SchemaContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, schema_id=schema_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -319,13 +306,9 @@ async def get( deserialized = self._deserialize("SchemaContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, @@ -333,7 +316,7 @@ async def _create_or_update_initial( service_name: str, api_id: str, schema_id: str, - parameters: Union[_models.SchemaContract, IO], + parameters: Union[_models.SchemaContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> Optional[_models.SchemaContract]: @@ -355,12 +338,12 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SchemaContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -371,16 +354,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -403,13 +385,9 @@ async def _create_or_update_initial( deserialized = self._deserialize("SchemaContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -445,14 +423,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either SchemaContract or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.SchemaContract] @@ -466,7 +436,7 @@ async def begin_create_or_update( service_name: str, api_id: str, schema_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -486,21 +456,13 @@ async def begin_create_or_update( instance. Required. :type schema_id: str :param parameters: The schema contents to apply. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either SchemaContract or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.SchemaContract] @@ -514,7 +476,7 @@ async def begin_create_or_update( service_name: str, api_id: str, schema_id: str, - parameters: Union[_models.SchemaContract, IO], + parameters: Union[_models.SchemaContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> AsyncLROPoller[_models.SchemaContract]: @@ -531,23 +493,12 @@ async def begin_create_or_update( :param schema_id: Schema id identifier. Must be unique in the current API Management service instance. Required. :type schema_id: str - :param parameters: The schema contents to apply. Is either a SchemaContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.SchemaContract or IO + :param parameters: The schema contents to apply. Is either a SchemaContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.SchemaContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either SchemaContract or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.SchemaContract] @@ -586,7 +537,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("SchemaContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -598,17 +549,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.SchemaContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" - } + return AsyncLROPoller[_models.SchemaContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -640,7 +589,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param force: If true removes all references to the schema before deleting it. Default value is None. :type force: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -659,7 +607,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -668,16 +616,15 @@ async def delete( # pylint: disable=inconsistent-return-statements if_match=if_match, force=force, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -688,8 +635,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_tag_description_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_tag_description_operations.py index b8585a855624..eca451c070c7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_tag_description_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_tag_description_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -92,7 +93,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TagDescriptionContract or the result of cls(response) :rtype: @@ -116,7 +116,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -125,12 +125,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -142,13 +141,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("TagDescriptionCollection", pipeline_response) @@ -158,11 +157,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -175,10 +174,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, api_id: str, tag_description_id: str, **kwargs: Any @@ -196,7 +191,6 @@ async def get_entity_tag( :param tag_description_id: Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. Required. :type tag_description_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -215,23 +209,22 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, tag_description_id=tag_description_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -245,13 +238,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, api_id: str, tag_description_id: str, **kwargs: Any @@ -269,7 +258,6 @@ async def get( :param tag_description_id: Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. Required. :type tag_description_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagDescriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagDescriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -288,23 +276,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TagDescriptionContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, tag_description_id=tag_description_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -320,13 +307,9 @@ async def get( deserialized = self._deserialize("TagDescriptionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -362,7 +345,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagDescriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagDescriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -375,7 +357,7 @@ async def create_or_update( service_name: str, api_id: str, tag_description_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -395,14 +377,13 @@ async def create_or_update( API/Tag association. Based on API and Tag names. Required. :type tag_description_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagDescriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagDescriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -415,7 +396,7 @@ async def create_or_update( service_name: str, api_id: str, tag_description_id: str, - parameters: Union[_models.TagDescriptionCreateParameters, IO], + parameters: Union[_models.TagDescriptionCreateParameters, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.TagDescriptionContract: @@ -432,16 +413,12 @@ async def create_or_update( :param tag_description_id: Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. Required. :type tag_description_id: str - :param parameters: Create parameters. Is either a TagDescriptionCreateParameters type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.TagDescriptionCreateParameters or IO + :param parameters: Create parameters. Is either a TagDescriptionCreateParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.TagDescriptionCreateParameters or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagDescriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagDescriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -464,12 +441,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagDescriptionCreateParameters") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -480,16 +457,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -515,10 +491,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, @@ -545,7 +517,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -564,7 +535,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -572,16 +543,15 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -592,8 +562,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_version_set_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_version_set_operations.py index 31fbe10e986f..96169927d64f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_version_set_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_version_set_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -86,7 +87,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiVersionSetContract or the result of cls(response) :rtype: @@ -110,7 +110,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -118,12 +118,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -135,13 +134,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ApiVersionSetCollection", pipeline_response) @@ -151,11 +150,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -168,10 +167,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, version_set_id: str, **kwargs: Any @@ -186,7 +181,6 @@ async def get_entity_tag( :param version_set_id: Api Version Set identifier. Must be unique in the current API Management service instance. Required. :type version_set_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -205,22 +199,21 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, version_set_id=version_set_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,13 +227,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, version_set_id: str, **kwargs: Any @@ -255,7 +244,6 @@ async def get( :param version_set_id: Api Version Set identifier. Must be unique in the current API Management service instance. Required. :type version_set_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiVersionSetContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract :raises ~azure.core.exceptions.HttpResponseError: @@ -274,22 +262,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApiVersionSetContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, version_set_id=version_set_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -305,13 +292,9 @@ async def get( deserialized = self._deserialize("ApiVersionSetContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -343,7 +326,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiVersionSetContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract :raises ~azure.core.exceptions.HttpResponseError: @@ -355,7 +337,7 @@ async def create_or_update( resource_group_name: str, service_name: str, version_set_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -372,14 +354,13 @@ async def create_or_update( service instance. Required. :type version_set_id: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiVersionSetContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract :raises ~azure.core.exceptions.HttpResponseError: @@ -391,7 +372,7 @@ async def create_or_update( resource_group_name: str, service_name: str, version_set_id: str, - parameters: Union[_models.ApiVersionSetContract, IO], + parameters: Union[_models.ApiVersionSetContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.ApiVersionSetContract: @@ -405,16 +386,12 @@ async def create_or_update( :param version_set_id: Api Version Set identifier. Must be unique in the current API Management service instance. Required. :type version_set_id: str - :param parameters: Create or update parameters. Is either a ApiVersionSetContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetContract or IO + :param parameters: Create or update parameters. Is either a ApiVersionSetContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiVersionSetContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract :raises ~azure.core.exceptions.HttpResponseError: @@ -437,12 +414,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiVersionSetContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, version_set_id=version_set_id, @@ -452,16 +429,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -487,10 +463,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" - } - @overload async def update( self, @@ -521,7 +493,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiVersionSetContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract :raises ~azure.core.exceptions.HttpResponseError: @@ -534,7 +505,7 @@ async def update( service_name: str, version_set_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -553,11 +524,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiVersionSetContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract :raises ~azure.core.exceptions.HttpResponseError: @@ -570,7 +540,7 @@ async def update( service_name: str, version_set_id: str, if_match: str, - parameters: Union[_models.ApiVersionSetUpdateParameters, IO], + parameters: Union[_models.ApiVersionSetUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.ApiVersionSetContract: """Updates the details of the Api VersionSet specified by its identifier. @@ -586,13 +556,9 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a ApiVersionSetUpdateParameters type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a ApiVersionSetUpdateParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetUpdateParameters or IO[bytes] :return: ApiVersionSetContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract :raises ~azure.core.exceptions.HttpResponseError: @@ -615,12 +581,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiVersionSetUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, version_set_id=version_set_id, @@ -630,16 +596,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -655,13 +620,9 @@ async def update( deserialized = self._deserialize("ApiVersionSetContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -680,7 +641,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -699,23 +659,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, version_set_id=version_set_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -726,8 +685,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wiki_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wiki_operations.py index 7d0501a35e68..43bc87ba9a75 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wiki_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wiki_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -69,7 +70,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, api_ :param api_id: API identifier. Must be unique in the current API Management service instance. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -88,22 +88,21 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, api_ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -117,13 +116,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, api_ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, api_id: str, **kwargs: Any @@ -138,7 +133,6 @@ async def get( :param api_id: API identifier. Must be unique in the current API Management service instance. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -157,22 +151,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WikiContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,13 +181,9 @@ async def get( deserialized = self._deserialize("WikiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -226,7 +215,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -238,7 +226,7 @@ async def create_or_update( resource_group_name: str, service_name: str, api_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -255,14 +243,13 @@ async def create_or_update( Required. :type api_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -274,7 +261,7 @@ async def create_or_update( resource_group_name: str, service_name: str, api_id: str, - parameters: Union[_models.WikiContract, IO], + parameters: Union[_models.WikiContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.WikiContract: @@ -288,15 +275,12 @@ async def create_or_update( :param api_id: API identifier. Must be unique in the current API Management service instance. Required. :type api_id: str - :param parameters: Create parameters. Is either a WikiContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.WikiContract or IO + :param parameters: Create parameters. Is either a WikiContract type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.apimanagement.models.WikiContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -319,12 +303,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WikiContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -334,16 +318,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,10 +352,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" - } - @overload async def update( self, @@ -403,7 +382,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -416,7 +394,7 @@ async def update( service_name: str, api_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -435,11 +413,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Wiki Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -452,7 +429,7 @@ async def update( service_name: str, api_id: str, if_match: str, - parameters: Union[_models.WikiUpdateContract, IO], + parameters: Union[_models.WikiUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.WikiContract: """Updates the details of the Wiki for an API specified by its identifier. @@ -468,13 +445,9 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Wiki Update parameters. Is either a WikiUpdateContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.WikiUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Wiki Update parameters. Is either a WikiUpdateContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.WikiUpdateContract or IO[bytes] :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -497,12 +470,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WikiUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -512,16 +485,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -537,13 +509,9 @@ async def update( deserialized = self._deserialize("WikiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -562,7 +530,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -581,23 +548,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -608,8 +574,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wikis_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wikis_operations.py index 7fd8aac8c7db..7f810130fc5c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wikis_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wikis_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -82,7 +82,6 @@ def list( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WikiContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.WikiContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -104,7 +103,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -113,12 +112,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -130,13 +128,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("WikiCollection", pipeline_response) @@ -146,11 +144,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -162,7 +160,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_access_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_access_policy_operations.py index f27278d3a0ec..e8bf6cabba8e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_access_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_access_policy_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -92,7 +93,6 @@ def list_by_authorization( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AuthorizationAccessPolicyContract or the result of cls(response) :rtype: @@ -116,7 +116,7 @@ def list_by_authorization( def prepare_request(next_link=None): if not next_link: - request = build_list_by_authorization_request( + _request = build_list_by_authorization_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -126,12 +126,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_authorization.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -143,13 +142,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("AuthorizationAccessPolicyCollection", pipeline_response) @@ -159,11 +158,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,10 +175,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_authorization.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies" - } - @distributed_trace_async async def get( self, @@ -203,7 +198,6 @@ async def get( :type authorization_id: str :param authorization_access_policy_id: Identifier of the authorization access policy. Required. :type authorization_access_policy_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationAccessPolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -222,7 +216,7 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AuthorizationAccessPolicyContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -230,16 +224,15 @@ async def get( authorization_access_policy_id=authorization_access_policy_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -255,13 +248,9 @@ async def get( deserialized = self._deserialize("AuthorizationAccessPolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -298,7 +287,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationAccessPolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -312,7 +300,7 @@ async def create_or_update( authorization_provider_id: str, authorization_id: str, authorization_access_policy_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -332,14 +320,13 @@ async def create_or_update( :param authorization_access_policy_id: Identifier of the authorization access policy. Required. :type authorization_access_policy_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationAccessPolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -353,7 +340,7 @@ async def create_or_update( authorization_provider_id: str, authorization_id: str, authorization_access_policy_id: str, - parameters: Union[_models.AuthorizationAccessPolicyContract, IO], + parameters: Union[_models.AuthorizationAccessPolicyContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.AuthorizationAccessPolicyContract: @@ -371,15 +358,12 @@ async def create_or_update( :param authorization_access_policy_id: Identifier of the authorization access policy. Required. :type authorization_access_policy_id: str :param parameters: Create parameters. Is either a AuthorizationAccessPolicyContract type or a - IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract or IO + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract or + IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationAccessPolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -402,12 +386,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AuthorizationAccessPolicyContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -419,16 +403,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -454,10 +437,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, @@ -485,7 +464,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -504,7 +482,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -513,16 +491,15 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,8 +510,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_login_links_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_login_links_operations.py index 7689d35a7822..c923aa35aaf4 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_login_links_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_login_links_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -79,7 +80,6 @@ async def post( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationLoginResponseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationLoginResponseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -92,7 +92,7 @@ async def post( service_name: str, authorization_provider_id: str, authorization_id: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -109,11 +109,10 @@ async def post( :param authorization_id: Identifier of the authorization. Required. :type authorization_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationLoginResponseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationLoginResponseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -126,7 +125,7 @@ async def post( service_name: str, authorization_provider_id: str, authorization_id: str, - parameters: Union[_models.AuthorizationLoginRequestContract, IO], + parameters: Union[_models.AuthorizationLoginRequestContract, IO[bytes]], **kwargs: Any ) -> _models.AuthorizationLoginResponseContract: """Gets authorization login links. @@ -141,12 +140,9 @@ async def post( :param authorization_id: Identifier of the authorization. Required. :type authorization_id: str :param parameters: Create parameters. Is either a AuthorizationLoginRequestContract type or a - IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationLoginRequestContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationLoginRequestContract or + IO[bytes] :return: AuthorizationLoginResponseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationLoginResponseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -169,12 +165,12 @@ async def post( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AuthorizationLoginRequestContract") - request = build_post_request( + _request = build_post_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -184,16 +180,15 @@ async def post( content_type=content_type, json=_json, content=_content, - template_url=self.post.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -209,10 +204,6 @@ async def post( deserialized = self._deserialize("AuthorizationLoginResponseContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - post.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/getLoginLinks" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_operations.py index 3787060a33f0..918b0be6666e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -90,7 +91,6 @@ def list_by_authorization_provider( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AuthorizationContract or the result of cls(response) :rtype: @@ -114,7 +114,7 @@ def list_by_authorization_provider( def prepare_request(next_link=None): if not next_link: - request = build_list_by_authorization_provider_request( + _request = build_list_by_authorization_provider_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -123,12 +123,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_authorization_provider.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -140,13 +139,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("AuthorizationCollection", pipeline_response) @@ -156,11 +155,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -173,10 +172,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_authorization_provider.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations" - } - @distributed_trace_async async def get( self, @@ -197,7 +192,6 @@ async def get( :type authorization_provider_id: str :param authorization_id: Identifier of the authorization. Required. :type authorization_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -216,23 +210,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AuthorizationContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, authorization_id=authorization_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -248,13 +241,9 @@ async def get( deserialized = self._deserialize("AuthorizationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -288,7 +277,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -301,7 +289,7 @@ async def create_or_update( service_name: str, authorization_provider_id: str, authorization_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -319,14 +307,13 @@ async def create_or_update( :param authorization_id: Identifier of the authorization. Required. :type authorization_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -339,7 +326,7 @@ async def create_or_update( service_name: str, authorization_provider_id: str, authorization_id: str, - parameters: Union[_models.AuthorizationContract, IO], + parameters: Union[_models.AuthorizationContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.AuthorizationContract: @@ -354,16 +341,12 @@ async def create_or_update( :type authorization_provider_id: str :param authorization_id: Identifier of the authorization. Required. :type authorization_id: str - :param parameters: Create parameters. Is either a AuthorizationContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationContract or IO + :param parameters: Create parameters. Is either a AuthorizationContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -386,12 +369,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AuthorizationContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -402,16 +385,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -437,10 +419,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, @@ -465,7 +443,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -484,7 +461,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -492,16 +469,15 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -512,11 +488,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def confirm_consent_code( # pylint: disable=inconsistent-return-statements @@ -547,7 +519,6 @@ async def confirm_consent_code( # pylint: disable=inconsistent-return-statement :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -560,7 +531,7 @@ async def confirm_consent_code( # pylint: disable=inconsistent-return-statement service_name: str, authorization_provider_id: str, authorization_id: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -577,11 +548,10 @@ async def confirm_consent_code( # pylint: disable=inconsistent-return-statement :param authorization_id: Identifier of the authorization. Required. :type authorization_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -594,7 +564,7 @@ async def confirm_consent_code( # pylint: disable=inconsistent-return-statement service_name: str, authorization_provider_id: str, authorization_id: str, - parameters: Union[_models.AuthorizationConfirmConsentCodeRequestContract, IO], + parameters: Union[_models.AuthorizationConfirmConsentCodeRequestContract, IO[bytes]], **kwargs: Any ) -> None: """Confirm valid consent code to suppress Authorizations anti-phishing page. @@ -609,13 +579,9 @@ async def confirm_consent_code( # pylint: disable=inconsistent-return-statement :param authorization_id: Identifier of the authorization. Required. :type authorization_id: str :param parameters: Create parameters. Is either a - AuthorizationConfirmConsentCodeRequestContract type or a IO type. Required. + AuthorizationConfirmConsentCodeRequestContract type or a IO[bytes] type. Required. :type parameters: - ~azure.mgmt.apimanagement.models.AuthorizationConfirmConsentCodeRequestContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.apimanagement.models.AuthorizationConfirmConsentCodeRequestContract or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -638,12 +604,12 @@ async def confirm_consent_code( # pylint: disable=inconsistent-return-statement content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AuthorizationConfirmConsentCodeRequestContract") - request = build_confirm_consent_code_request( + _request = build_confirm_consent_code_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -653,16 +619,15 @@ async def confirm_consent_code( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, content=_content, - template_url=self.confirm_consent_code.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -676,8 +641,4 @@ async def confirm_consent_code( # pylint: disable=inconsistent-return-statement response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) - - confirm_consent_code.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/confirmConsentCode" - } + return cls(pipeline_response, None, response_headers) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_provider_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_provider_operations.py index b118ea2b89b1..a62b4a0d731e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_provider_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_provider_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -86,7 +87,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AuthorizationProviderContract or the result of cls(response) :rtype: @@ -110,7 +110,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -118,12 +118,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -135,13 +134,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("AuthorizationProviderCollection", pipeline_response) @@ -151,11 +150,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -168,10 +167,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, authorization_provider_id: str, **kwargs: Any @@ -185,7 +180,6 @@ async def get( :type service_name: str :param authorization_provider_id: Identifier of the authorization provider. Required. :type authorization_provider_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -204,22 +198,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AuthorizationProviderContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -235,13 +228,9 @@ async def get( deserialized = self._deserialize("AuthorizationProviderContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -272,7 +261,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -284,7 +272,7 @@ async def create_or_update( resource_group_name: str, service_name: str, authorization_provider_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -300,14 +288,13 @@ async def create_or_update( :param authorization_provider_id: Identifier of the authorization provider. Required. :type authorization_provider_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -319,7 +306,7 @@ async def create_or_update( resource_group_name: str, service_name: str, authorization_provider_id: str, - parameters: Union[_models.AuthorizationProviderContract, IO], + parameters: Union[_models.AuthorizationProviderContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.AuthorizationProviderContract: @@ -332,16 +319,12 @@ async def create_or_update( :type service_name: str :param authorization_provider_id: Identifier of the authorization provider. Required. :type authorization_provider_id: str - :param parameters: Create parameters. Is either a AuthorizationProviderContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationProviderContract or IO + :param parameters: Create parameters. Is either a AuthorizationProviderContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationProviderContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -364,12 +347,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AuthorizationProviderContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -379,16 +362,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -414,10 +396,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, authorization_provider_id: str, if_match: str, **kwargs: Any @@ -434,7 +412,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -453,23 +430,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -480,8 +456,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_server_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_server_operations.py index ced04340ee0c..8f992607cc7c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_server_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_server_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -89,7 +90,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AuthorizationServerContract or the result of cls(response) :rtype: @@ -113,7 +113,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -121,12 +121,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -138,13 +137,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("AuthorizationServerCollection", pipeline_response) @@ -154,11 +153,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -171,10 +170,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers" - } - @distributed_trace_async async def get_entity_tag(self, resource_group_name: str, service_name: str, authsid: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the authorizationServer specified by its identifier. @@ -186,7 +181,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, auth :type service_name: str :param authsid: Identifier of the authorization server. Required. :type authsid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -205,22 +199,21 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, auth api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, authsid=authsid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,13 +227,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, auth response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, authsid: str, **kwargs: Any @@ -254,7 +243,6 @@ async def get( :type service_name: str :param authsid: Identifier of the authorization server. Required. :type authsid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationServerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -273,22 +261,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AuthorizationServerContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, authsid=authsid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -304,13 +291,9 @@ async def get( deserialized = self._deserialize("AuthorizationServerContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -341,7 +324,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationServerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -353,7 +335,7 @@ async def create_or_update( resource_group_name: str, service_name: str, authsid: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -369,14 +351,13 @@ async def create_or_update( :param authsid: Identifier of the authorization server. Required. :type authsid: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationServerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -388,7 +369,7 @@ async def create_or_update( resource_group_name: str, service_name: str, authsid: str, - parameters: Union[_models.AuthorizationServerContract, IO], + parameters: Union[_models.AuthorizationServerContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.AuthorizationServerContract: @@ -402,15 +383,11 @@ async def create_or_update( :param authsid: Identifier of the authorization server. Required. :type authsid: str :param parameters: Create or update parameters. Is either a AuthorizationServerContract type or - a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationServerContract or IO + a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationServerContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationServerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -433,12 +410,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AuthorizationServerContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, authsid=authsid, @@ -448,16 +425,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -483,10 +459,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" - } - @overload async def update( self, @@ -516,7 +488,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationServerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -529,7 +500,7 @@ async def update( service_name: str, authsid: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -547,11 +518,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: OAuth2 Server settings Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationServerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -564,7 +534,7 @@ async def update( service_name: str, authsid: str, if_match: str, - parameters: Union[_models.AuthorizationServerUpdateContract, IO], + parameters: Union[_models.AuthorizationServerUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.AuthorizationServerContract: """Updates the details of the authorization server specified by its identifier. @@ -580,12 +550,9 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: OAuth2 Server settings Update parameters. Is either a - AuthorizationServerUpdateContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationServerUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + AuthorizationServerUpdateContract type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationServerUpdateContract or + IO[bytes] :return: AuthorizationServerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -608,12 +575,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AuthorizationServerUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, authsid=authsid, @@ -623,16 +590,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -648,13 +614,9 @@ async def update( deserialized = self._deserialize("AuthorizationServerContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -672,7 +634,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -691,23 +652,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, authsid=authsid, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -718,11 +678,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def list_secrets( @@ -737,7 +693,6 @@ async def list_secrets( :type service_name: str :param authsid: Identifier of the authorization server. Required. :type authsid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationServerSecretsContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerSecretsContract :raises ~azure.core.exceptions.HttpResponseError: @@ -756,22 +711,21 @@ async def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AuthorizationServerSecretsContract] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, service_name=service_name, authsid=authsid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -787,10 +741,6 @@ async def list_secrets( deserialized = self._deserialize("AuthorizationServerSecretsContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_backend_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_backend_operations.py index 3a065b2fc2ed..8400c1866d51 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_backend_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_backend_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -90,7 +91,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BackendContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.BackendContract] @@ -113,7 +113,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -121,12 +121,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -138,13 +137,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("BackendCollection", pipeline_response) @@ -154,11 +153,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -171,10 +170,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends" - } - @distributed_trace_async async def get_entity_tag(self, resource_group_name: str, service_name: str, backend_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the backend specified by its identifier. @@ -187,7 +182,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, back :param backend_id: Identifier of the Backend entity. Must be unique in the current API Management service instance. Required. :type backend_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -206,22 +200,21 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, back api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, backend_id=backend_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -235,13 +228,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, back response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, backend_id: str, **kwargs: Any @@ -256,7 +245,6 @@ async def get( :param backend_id: Identifier of the Backend entity. Must be unique in the current API Management service instance. Required. :type backend_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BackendContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.BackendContract :raises ~azure.core.exceptions.HttpResponseError: @@ -275,22 +263,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackendContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, backend_id=backend_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -306,13 +293,9 @@ async def get( deserialized = self._deserialize("BackendContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -344,7 +327,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BackendContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.BackendContract :raises ~azure.core.exceptions.HttpResponseError: @@ -356,7 +338,7 @@ async def create_or_update( resource_group_name: str, service_name: str, backend_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -373,14 +355,13 @@ async def create_or_update( Management service instance. Required. :type backend_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BackendContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.BackendContract :raises ~azure.core.exceptions.HttpResponseError: @@ -392,7 +373,7 @@ async def create_or_update( resource_group_name: str, service_name: str, backend_id: str, - parameters: Union[_models.BackendContract, IO], + parameters: Union[_models.BackendContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.BackendContract: @@ -406,15 +387,12 @@ async def create_or_update( :param backend_id: Identifier of the Backend entity. Must be unique in the current API Management service instance. Required. :type backend_id: str - :param parameters: Create parameters. Is either a BackendContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.BackendContract or IO + :param parameters: Create parameters. Is either a BackendContract type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.apimanagement.models.BackendContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BackendContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.BackendContract :raises ~azure.core.exceptions.HttpResponseError: @@ -437,12 +415,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BackendContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, backend_id=backend_id, @@ -452,16 +430,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -487,10 +464,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" - } - @overload async def update( self, @@ -521,7 +494,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BackendContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.BackendContract :raises ~azure.core.exceptions.HttpResponseError: @@ -534,7 +506,7 @@ async def update( service_name: str, backend_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -553,11 +525,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: BackendContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.BackendContract :raises ~azure.core.exceptions.HttpResponseError: @@ -570,7 +541,7 @@ async def update( service_name: str, backend_id: str, if_match: str, - parameters: Union[_models.BackendUpdateParameters, IO], + parameters: Union[_models.BackendUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.BackendContract: """Updates an existing backend. @@ -586,13 +557,9 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a BackendUpdateParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.BackendUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a BackendUpdateParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.BackendUpdateParameters or IO[bytes] :return: BackendContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.BackendContract :raises ~azure.core.exceptions.HttpResponseError: @@ -615,12 +582,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BackendUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, backend_id=backend_id, @@ -630,16 +597,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -655,13 +621,9 @@ async def update( deserialized = self._deserialize("BackendContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -680,7 +642,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -699,23 +660,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, backend_id=backend_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -726,11 +686,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def reconnect( # pylint: disable=inconsistent-return-statements @@ -759,7 +715,6 @@ async def reconnect( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -771,7 +726,7 @@ async def reconnect( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, backend_id: str, - parameters: Optional[IO] = None, + parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -788,11 +743,10 @@ async def reconnect( # pylint: disable=inconsistent-return-statements Management service instance. Required. :type backend_id: str :param parameters: Reconnect request parameters. Default value is None. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -804,7 +758,7 @@ async def reconnect( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, backend_id: str, - parameters: Optional[Union[_models.BackendReconnectContract, IO]] = None, + parameters: Optional[Union[_models.BackendReconnectContract, IO[bytes]]] = None, **kwargs: Any ) -> None: """Notifies the API Management gateway to create a new connection to the backend after the @@ -819,12 +773,8 @@ async def reconnect( # pylint: disable=inconsistent-return-statements Management service instance. Required. :type backend_id: str :param parameters: Reconnect request parameters. Is either a BackendReconnectContract type or a - IO type. Default value is None. - :type parameters: ~azure.mgmt.apimanagement.models.BackendReconnectContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.apimanagement.models.BackendReconnectContract or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -847,7 +797,7 @@ async def reconnect( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: if parameters is not None: @@ -855,7 +805,7 @@ async def reconnect( # pylint: disable=inconsistent-return-statements else: _json = None - request = build_reconnect_request( + _request = build_reconnect_request( resource_group_name=resource_group_name, service_name=service_name, backend_id=backend_id, @@ -864,16 +814,15 @@ async def reconnect( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.reconnect.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -884,8 +833,4 @@ async def reconnect( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - reconnect.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}/reconnect" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_cache_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_cache_operations.py index 2681d55a6ba6..38f9f19324b7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_cache_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_cache_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -81,7 +82,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CacheContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.CacheContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -103,19 +103,18 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -127,13 +126,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("CacheCollection", pipeline_response) @@ -143,11 +142,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -160,10 +159,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches" - } - @distributed_trace_async async def get_entity_tag(self, resource_group_name: str, service_name: str, cache_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the Cache specified by its identifier. @@ -176,7 +171,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, cach :param cache_id: Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). Required. :type cache_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -195,22 +189,21 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, cach api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, cache_id=cache_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -224,13 +217,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, cach response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, cache_id: str, **kwargs: Any @@ -245,7 +234,6 @@ async def get( :param cache_id: Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). Required. :type cache_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CacheContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CacheContract :raises ~azure.core.exceptions.HttpResponseError: @@ -264,22 +252,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CacheContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, cache_id=cache_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -295,13 +282,9 @@ async def get( deserialized = self._deserialize("CacheContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -336,7 +319,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CacheContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CacheContract :raises ~azure.core.exceptions.HttpResponseError: @@ -348,7 +330,7 @@ async def create_or_update( resource_group_name: str, service_name: str, cache_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -368,14 +350,13 @@ async def create_or_update( or valid Azure region identifier). Required. :type cache_id: str :param parameters: Create or Update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CacheContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CacheContract :raises ~azure.core.exceptions.HttpResponseError: @@ -387,7 +368,7 @@ async def create_or_update( resource_group_name: str, service_name: str, cache_id: str, - parameters: Union[_models.CacheContract, IO], + parameters: Union[_models.CacheContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.CacheContract: @@ -404,16 +385,12 @@ async def create_or_update( :param cache_id: Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). Required. :type cache_id: str - :param parameters: Create or Update parameters. Is either a CacheContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.CacheContract or IO + :param parameters: Create or Update parameters. Is either a CacheContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.CacheContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CacheContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CacheContract :raises ~azure.core.exceptions.HttpResponseError: @@ -436,12 +413,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CacheContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, cache_id=cache_id, @@ -451,16 +428,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -486,10 +462,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" - } - @overload async def update( self, @@ -520,7 +492,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CacheContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CacheContract :raises ~azure.core.exceptions.HttpResponseError: @@ -533,7 +504,7 @@ async def update( service_name: str, cache_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -552,11 +523,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: CacheContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CacheContract :raises ~azure.core.exceptions.HttpResponseError: @@ -569,7 +539,7 @@ async def update( service_name: str, cache_id: str, if_match: str, - parameters: Union[_models.CacheUpdateParameters, IO], + parameters: Union[_models.CacheUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.CacheContract: """Updates the details of the cache specified by its identifier. @@ -585,13 +555,9 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a CacheUpdateParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.CacheUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a CacheUpdateParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.CacheUpdateParameters or IO[bytes] :return: CacheContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CacheContract :raises ~azure.core.exceptions.HttpResponseError: @@ -614,12 +580,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CacheUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, cache_id=cache_id, @@ -629,16 +595,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -654,13 +619,9 @@ async def update( deserialized = self._deserialize("CacheContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -679,7 +640,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -698,23 +658,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, cache_id=cache_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -725,8 +684,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_certificate_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_certificate_operations.py index 6d093b06041b..afc6d711f935 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_certificate_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_certificate_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -93,7 +94,6 @@ def list_by_service( :param is_key_vault_refresh_failed: When set to true, the response contains only certificates entities which failed refresh. Default value is None. :type is_key_vault_refresh_failed: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CertificateContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.CertificateContract] @@ -116,7 +116,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -125,12 +125,11 @@ def prepare_request(next_link=None): skip=skip, is_key_vault_refresh_failed=is_key_vault_refresh_failed, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -142,13 +141,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("CertificateCollection", pipeline_response) @@ -158,11 +157,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -175,10 +174,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, certificate_id: str, **kwargs: Any @@ -193,7 +188,6 @@ async def get_entity_tag( :param certificate_id: Identifier of the certificate entity. Must be unique in the current API Management service instance. Required. :type certificate_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -212,22 +206,21 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, certificate_id=certificate_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -241,13 +234,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, certificate_id: str, **kwargs: Any @@ -262,7 +251,6 @@ async def get( :param certificate_id: Identifier of the certificate entity. Must be unique in the current API Management service instance. Required. :type certificate_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CertificateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -281,22 +269,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, certificate_id=certificate_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -312,13 +299,9 @@ async def get( deserialized = self._deserialize("CertificateContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -354,7 +337,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CertificateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -366,7 +348,7 @@ async def create_or_update( resource_group_name: str, service_name: str, certificate_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -387,14 +369,13 @@ async def create_or_update( Management service instance. Required. :type certificate_id: str :param parameters: Create or Update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CertificateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -406,7 +387,7 @@ async def create_or_update( resource_group_name: str, service_name: str, certificate_id: str, - parameters: Union[_models.CertificateCreateOrUpdateParameters, IO], + parameters: Union[_models.CertificateCreateOrUpdateParameters, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.CertificateContract: @@ -425,15 +406,12 @@ async def create_or_update( Management service instance. Required. :type certificate_id: str :param parameters: Create or Update parameters. Is either a CertificateCreateOrUpdateParameters - type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.CertificateCreateOrUpdateParameters or IO + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.CertificateCreateOrUpdateParameters or + IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CertificateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -456,12 +434,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, certificate_id=certificate_id, @@ -471,16 +449,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -506,10 +483,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, certificate_id: str, if_match: str, **kwargs: Any @@ -527,7 +500,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -546,23 +518,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, certificate_id=certificate_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -573,11 +544,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def refresh_secret( @@ -597,7 +564,6 @@ async def refresh_secret( :param certificate_id: Identifier of the certificate entity. Must be unique in the current API Management service instance. Required. :type certificate_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CertificateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -616,22 +582,21 @@ async def refresh_secret( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateContract] = kwargs.pop("cls", None) - request = build_refresh_secret_request( + _request = build_refresh_secret_request( resource_group_name=resource_group_name, service_name=service_name, certificate_id=certificate_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.refresh_secret.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -647,10 +612,6 @@ async def refresh_secret( deserialized = self._deserialize("CertificateContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - refresh_secret.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}/refreshSecret" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_item_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_item_operations.py index 9b74c349c357..5fa69b548a9a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_item_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_item_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -73,7 +74,6 @@ def list_by_service( :type service_name: str :param content_type_id: Content type identifier. Required. :type content_type_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContentItemContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ContentItemContract] @@ -96,18 +96,17 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, content_type_id=content_type_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +118,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ContentItemCollection", pipeline_response) @@ -135,11 +134,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -152,10 +151,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, content_type_id: str, content_item_id: str, **kwargs: Any @@ -172,7 +167,6 @@ async def get_entity_tag( :type content_type_id: str :param content_item_id: Content item identifier. Required. :type content_item_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -191,23 +185,22 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, content_type_id=content_type_id, content_item_id=content_item_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -221,13 +214,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, content_type_id: str, content_item_id: str, **kwargs: Any @@ -243,7 +232,6 @@ async def get( :type content_type_id: str :param content_item_id: Content item identifier. Required. :type content_item_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContentItemContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ContentItemContract :raises ~azure.core.exceptions.HttpResponseError: @@ -262,23 +250,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContentItemContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, content_type_id=content_type_id, content_item_id=content_item_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -294,13 +281,9 @@ async def get( deserialized = self._deserialize("ContentItemContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -334,7 +317,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContentItemContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ContentItemContract :raises ~azure.core.exceptions.HttpResponseError: @@ -347,7 +329,7 @@ async def create_or_update( service_name: str, content_type_id: str, content_item_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -365,14 +347,13 @@ async def create_or_update( :param content_item_id: Content item identifier. Required. :type content_item_id: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContentItemContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ContentItemContract :raises ~azure.core.exceptions.HttpResponseError: @@ -385,7 +366,7 @@ async def create_or_update( service_name: str, content_type_id: str, content_item_id: str, - parameters: Union[_models.ContentItemContract, IO], + parameters: Union[_models.ContentItemContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.ContentItemContract: @@ -400,16 +381,12 @@ async def create_or_update( :type content_type_id: str :param content_item_id: Content item identifier. Required. :type content_item_id: str - :param parameters: Create or update parameters. Is either a ContentItemContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ContentItemContract or IO + :param parameters: Create or update parameters. Is either a ContentItemContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ContentItemContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContentItemContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ContentItemContract :raises ~azure.core.exceptions.HttpResponseError: @@ -432,12 +409,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ContentItemContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, content_type_id=content_type_id, @@ -448,16 +425,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -483,10 +459,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, @@ -511,7 +483,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -530,7 +501,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, content_type_id=content_type_id, @@ -538,16 +509,15 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -558,8 +528,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_type_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_type_operations.py index f3da96a9741c..555f8ae358f1 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_type_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_type_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -71,7 +72,6 @@ def list_by_service( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContentTypeContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ContentTypeContract] @@ -94,17 +94,16 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -116,13 +115,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ContentTypeCollection", pipeline_response) @@ -132,11 +131,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -149,10 +148,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, content_type_id: str, **kwargs: Any @@ -167,7 +162,6 @@ async def get( :type service_name: str :param content_type_id: Content type identifier. Required. :type content_type_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContentTypeContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ContentTypeContract :raises ~azure.core.exceptions.HttpResponseError: @@ -186,22 +180,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContentTypeContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, content_type_id=content_type_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -217,13 +210,9 @@ async def get( deserialized = self._deserialize("ContentTypeContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -256,7 +245,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContentTypeContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ContentTypeContract :raises ~azure.core.exceptions.HttpResponseError: @@ -268,7 +256,7 @@ async def create_or_update( resource_group_name: str, service_name: str, content_type_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -286,14 +274,13 @@ async def create_or_update( :param content_type_id: Content type identifier. Required. :type content_type_id: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContentTypeContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ContentTypeContract :raises ~azure.core.exceptions.HttpResponseError: @@ -305,7 +292,7 @@ async def create_or_update( resource_group_name: str, service_name: str, content_type_id: str, - parameters: Union[_models.ContentTypeContract, IO], + parameters: Union[_models.ContentTypeContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.ContentTypeContract: @@ -320,16 +307,12 @@ async def create_or_update( :type service_name: str :param content_type_id: Content type identifier. Required. :type content_type_id: str - :param parameters: Create or update parameters. Is either a ContentTypeContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ContentTypeContract or IO + :param parameters: Create or update parameters. Is either a ContentTypeContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ContentTypeContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContentTypeContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ContentTypeContract :raises ~azure.core.exceptions.HttpResponseError: @@ -352,12 +335,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ContentTypeContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, content_type_id=content_type_id, @@ -367,16 +350,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -402,10 +384,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, content_type_id: str, if_match: str, **kwargs: Any @@ -424,7 +402,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -443,23 +420,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, content_type_id=content_type_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -470,8 +446,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_delegation_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_delegation_settings_operations.py index e0c85ae23482..118980ca6af7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_delegation_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_delegation_settings_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -66,7 +67,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -85,21 +85,20 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -113,13 +112,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation" - } - @distributed_trace_async async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.PortalDelegationSettings: """Get Delegation Settings for the Portal. @@ -129,7 +124,6 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalDelegationSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalDelegationSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -148,21 +142,20 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PortalDelegationSettings] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -178,13 +171,9 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) deserialized = self._deserialize("PortalDelegationSettings", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation" - } + return deserialized # type: ignore @overload async def update( # pylint: disable=inconsistent-return-statements @@ -212,7 +201,6 @@ async def update( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -224,7 +212,7 @@ async def update( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -240,11 +228,10 @@ async def update( # pylint: disable=inconsistent-return-statements response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update Delegation settings. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -256,7 +243,7 @@ async def update( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, if_match: str, - parameters: Union[_models.PortalDelegationSettings, IO], + parameters: Union[_models.PortalDelegationSettings, IO[bytes]], **kwargs: Any ) -> None: """Update Delegation settings. @@ -270,12 +257,8 @@ async def update( # pylint: disable=inconsistent-return-statements response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update Delegation settings. Is either a PortalDelegationSettings type or a - IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalDelegationSettings or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalDelegationSettings or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -298,12 +281,12 @@ async def update( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalDelegationSettings") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -312,16 +295,15 @@ async def update( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -332,11 +314,7 @@ async def update( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def create_or_update( @@ -364,7 +342,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalDelegationSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalDelegationSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -375,7 +352,7 @@ async def create_or_update( self, resource_group_name: str, service_name: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -389,14 +366,13 @@ async def create_or_update( :param service_name: The name of the API Management service. Required. :type service_name: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalDelegationSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalDelegationSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -407,7 +383,7 @@ async def create_or_update( self, resource_group_name: str, service_name: str, - parameters: Union[_models.PortalDelegationSettings, IO], + parameters: Union[_models.PortalDelegationSettings, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.PortalDelegationSettings: @@ -419,15 +395,11 @@ async def create_or_update( :param service_name: The name of the API Management service. Required. :type service_name: str :param parameters: Create or update parameters. Is either a PortalDelegationSettings type or a - IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalDelegationSettings or IO + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalDelegationSettings or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalDelegationSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalDelegationSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -450,12 +422,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalDelegationSettings") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -464,16 +436,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -486,13 +457,9 @@ async def create_or_update( deserialized = self._deserialize("PortalDelegationSettings", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation" - } + return deserialized # type: ignore @distributed_trace_async async def list_secrets( @@ -505,7 +472,6 @@ async def list_secrets( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSettingValidationKeyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSettingValidationKeyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -524,21 +490,20 @@ async def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PortalSettingValidationKeyContract] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -551,10 +516,6 @@ async def list_secrets( deserialized = self._deserialize("PortalSettingValidationKeyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_deleted_services_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_deleted_services_operations.py index 34b438ae9398..f142e9a597ee 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_deleted_services_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_deleted_services_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -64,7 +64,6 @@ def __init__(self, *args, **kwargs) -> None: def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.DeletedServiceContract"]: """Lists all soft-deleted services available for undelete for the given subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeletedServiceContract or the result of cls(response) :rtype: @@ -88,15 +87,14 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.DeletedS def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -108,13 +106,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("DeletedServicesCollection", pipeline_response) @@ -124,11 +122,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -141,10 +139,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/deletedservices" - } - @distributed_trace_async async def get_by_name(self, service_name: str, location: str, **kwargs: Any) -> _models.DeletedServiceContract: """Get soft-deleted Api Management Service by name. @@ -153,7 +147,6 @@ async def get_by_name(self, service_name: str, location: str, **kwargs: Any) -> :type service_name: str :param location: The location of the deleted API Management service. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DeletedServiceContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DeletedServiceContract :raises ~azure.core.exceptions.HttpResponseError: @@ -172,21 +165,20 @@ async def get_by_name(self, service_name: str, location: str, **kwargs: Any) -> api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeletedServiceContract] = kwargs.pop("cls", None) - request = build_get_by_name_request( + _request = build_get_by_name_request( service_name=service_name, location=location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_name.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -199,13 +191,9 @@ async def get_by_name(self, service_name: str, location: str, **kwargs: Any) -> deserialized = self._deserialize("DeletedServiceContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_by_name.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}" - } + return deserialized # type: ignore async def _purge_initial( self, service_name: str, location: str, **kwargs: Any @@ -224,21 +212,20 @@ async def _purge_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.DeletedServiceContract]] = kwargs.pop("cls", None) - request = build_purge_request( + _request = build_purge_request( service_name=service_name, location=location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._purge_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -256,13 +243,9 @@ async def _purge_initial( deserialized = self._deserialize("DeletedServiceContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _purge_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_purge( @@ -274,14 +257,6 @@ async def begin_purge( :type service_name: str :param location: The location of the deleted API Management service. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DeletedServiceContract or the result of cls(response) :rtype: @@ -315,7 +290,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("DeletedServiceContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -327,14 +302,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.DeletedServiceContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_purge.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}" - } + return AsyncLROPoller[_models.DeletedServiceContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_diagnostic_operations.py index 9f30af6fa939..b92f0d1a114c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_diagnostic_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_diagnostic_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -87,7 +88,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiagnosticContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.DiagnosticContract] @@ -110,7 +110,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -118,12 +118,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -135,13 +134,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("DiagnosticCollection", pipeline_response) @@ -151,11 +150,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -168,10 +167,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, diagnostic_id: str, **kwargs: Any @@ -186,7 +181,6 @@ async def get_entity_tag( :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management service instance. Required. :type diagnostic_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -205,22 +199,21 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, diagnostic_id=diagnostic_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,13 +227,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, diagnostic_id: str, **kwargs: Any @@ -255,7 +244,6 @@ async def get( :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management service instance. Required. :type diagnostic_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -274,22 +262,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, diagnostic_id=diagnostic_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -305,13 +292,9 @@ async def get( deserialized = self._deserialize("DiagnosticContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -343,7 +326,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -355,7 +337,7 @@ async def create_or_update( resource_group_name: str, service_name: str, diagnostic_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -372,14 +354,13 @@ async def create_or_update( service instance. Required. :type diagnostic_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -391,7 +372,7 @@ async def create_or_update( resource_group_name: str, service_name: str, diagnostic_id: str, - parameters: Union[_models.DiagnosticContract, IO], + parameters: Union[_models.DiagnosticContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.DiagnosticContract: @@ -405,16 +386,12 @@ async def create_or_update( :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management service instance. Required. :type diagnostic_id: str - :param parameters: Create parameters. Is either a DiagnosticContract type or a IO type. + :param parameters: Create parameters. Is either a DiagnosticContract type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO + :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -437,12 +414,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DiagnosticContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, diagnostic_id=diagnostic_id, @@ -452,16 +429,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -487,10 +463,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" - } - @overload async def update( self, @@ -521,7 +493,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -534,7 +505,7 @@ async def update( service_name: str, diagnostic_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -553,11 +524,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Diagnostic Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -570,7 +540,7 @@ async def update( service_name: str, diagnostic_id: str, if_match: str, - parameters: Union[_models.DiagnosticContract, IO], + parameters: Union[_models.DiagnosticContract, IO[bytes]], **kwargs: Any ) -> _models.DiagnosticContract: """Updates the details of the Diagnostic specified by its identifier. @@ -586,13 +556,9 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Diagnostic Update parameters. Is either a DiagnosticContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Diagnostic Update parameters. Is either a DiagnosticContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO[bytes] :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -615,12 +581,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DiagnosticContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, diagnostic_id=diagnostic_id, @@ -630,16 +596,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -655,13 +620,9 @@ async def update( deserialized = self._deserialize("DiagnosticContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -680,7 +641,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -699,23 +659,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, diagnostic_id=diagnostic_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -726,8 +685,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_documentation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_documentation_operations.py index 333766f61a94..6041eadfd5d0 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_documentation_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_documentation_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -86,7 +87,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DocumentationContract or the result of cls(response) :rtype: @@ -110,7 +110,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -118,12 +118,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -135,13 +134,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("DocumentationCollection", pipeline_response) @@ -151,11 +150,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -168,10 +167,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, documentation_id: str, **kwargs: Any @@ -186,7 +181,6 @@ async def get_entity_tag( :param documentation_id: Documentation identifier. Must be unique in the current API Management service instance. Required. :type documentation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -205,22 +199,21 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, documentation_id=documentation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,13 +227,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, documentation_id: str, **kwargs: Any @@ -255,7 +244,6 @@ async def get( :param documentation_id: Documentation identifier. Must be unique in the current API Management service instance. Required. :type documentation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DocumentationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DocumentationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -274,22 +262,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DocumentationContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, documentation_id=documentation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -305,13 +292,9 @@ async def get( deserialized = self._deserialize("DocumentationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -343,7 +326,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DocumentationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DocumentationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -355,7 +337,7 @@ async def create_or_update( resource_group_name: str, service_name: str, documentation_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -372,14 +354,13 @@ async def create_or_update( service instance. Required. :type documentation_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DocumentationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DocumentationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -391,7 +372,7 @@ async def create_or_update( resource_group_name: str, service_name: str, documentation_id: str, - parameters: Union[_models.DocumentationContract, IO], + parameters: Union[_models.DocumentationContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.DocumentationContract: @@ -405,16 +386,12 @@ async def create_or_update( :param documentation_id: Documentation identifier. Must be unique in the current API Management service instance. Required. :type documentation_id: str - :param parameters: Create parameters. Is either a DocumentationContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.DocumentationContract or IO + :param parameters: Create parameters. Is either a DocumentationContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.DocumentationContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DocumentationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DocumentationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -437,12 +414,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DocumentationContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, documentation_id=documentation_id, @@ -452,16 +429,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -487,10 +463,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" - } - @overload async def update( self, @@ -521,7 +493,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DocumentationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DocumentationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -534,7 +505,7 @@ async def update( service_name: str, documentation_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -553,11 +524,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Documentation Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: DocumentationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DocumentationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -570,7 +540,7 @@ async def update( service_name: str, documentation_id: str, if_match: str, - parameters: Union[_models.DocumentationUpdateContract, IO], + parameters: Union[_models.DocumentationUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.DocumentationContract: """Updates the details of the Documentation for an API specified by its identifier. @@ -587,12 +557,8 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Documentation Update parameters. Is either a DocumentationUpdateContract - type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.DocumentationUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.DocumentationUpdateContract or IO[bytes] :return: DocumentationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DocumentationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -615,12 +581,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DocumentationUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, documentation_id=documentation_id, @@ -630,16 +596,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -655,13 +620,9 @@ async def update( deserialized = self._deserialize("DocumentationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -680,7 +641,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -699,23 +659,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, documentation_id=documentation_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -726,8 +685,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_email_template_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_email_template_operations.py index 21bbb49b633e..5afa030b8d0e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_email_template_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_email_template_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -87,7 +88,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EmailTemplateContract or the result of cls(response) :rtype: @@ -111,7 +111,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -119,12 +119,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -136,13 +135,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("EmailTemplateCollection", pipeline_response) @@ -152,11 +151,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -169,10 +168,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates" - } - @distributed_trace_async async def get_entity_tag( self, @@ -197,7 +192,6 @@ async def get_entity_tag( "passwordResetByAdminNotificationMessage", "rejectDeveloperNotificationMessage", and "requestDeveloperNotificationMessage". Required. :type template_name: str or ~azure.mgmt.apimanagement.models.TemplateName - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -216,22 +210,21 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, template_name=template_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -245,13 +238,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" - } - @distributed_trace_async async def get( self, @@ -276,7 +265,6 @@ async def get( "passwordResetByAdminNotificationMessage", "rejectDeveloperNotificationMessage", and "requestDeveloperNotificationMessage". Required. :type template_name: str or ~azure.mgmt.apimanagement.models.TemplateName - :keyword callable cls: A custom type or function that will be passed the direct response :return: EmailTemplateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -295,22 +283,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EmailTemplateContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, template_name=template_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -326,13 +313,9 @@ async def get( deserialized = self._deserialize("EmailTemplateContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -370,7 +353,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EmailTemplateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -382,7 +364,7 @@ async def create_or_update( resource_group_name: str, service_name: str, template_name: Union[str, _models.TemplateName], - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -405,14 +387,13 @@ async def create_or_update( "requestDeveloperNotificationMessage". Required. :type template_name: str or ~azure.mgmt.apimanagement.models.TemplateName :param parameters: Email Template update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EmailTemplateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -424,7 +405,7 @@ async def create_or_update( resource_group_name: str, service_name: str, template_name: Union[str, _models.TemplateName], - parameters: Union[_models.EmailTemplateUpdateParameters, IO], + parameters: Union[_models.EmailTemplateUpdateParameters, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.EmailTemplateContract: @@ -445,15 +426,11 @@ async def create_or_update( "requestDeveloperNotificationMessage". Required. :type template_name: str or ~azure.mgmt.apimanagement.models.TemplateName :param parameters: Email Template update parameters. Is either a EmailTemplateUpdateParameters - type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.EmailTemplateUpdateParameters or IO + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.EmailTemplateUpdateParameters or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EmailTemplateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -476,12 +453,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "EmailTemplateUpdateParameters") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, template_name=template_name, @@ -491,16 +468,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -521,10 +497,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" - } - @overload async def update( self, @@ -561,7 +533,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EmailTemplateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -574,7 +545,7 @@ async def update( service_name: str, template_name: Union[str, _models.TemplateName], if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -599,11 +570,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: EmailTemplateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -616,7 +586,7 @@ async def update( service_name: str, template_name: Union[str, _models.TemplateName], if_match: str, - parameters: Union[_models.EmailTemplateUpdateParameters, IO], + parameters: Union[_models.EmailTemplateUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.EmailTemplateContract: """Updates API Management email template. @@ -638,13 +608,9 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a EmailTemplateUpdateParameters type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.EmailTemplateUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a EmailTemplateUpdateParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.EmailTemplateUpdateParameters or IO[bytes] :return: EmailTemplateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -667,12 +633,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "EmailTemplateUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, template_name=template_name, @@ -682,16 +648,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -707,13 +672,9 @@ async def update( deserialized = self._deserialize("EmailTemplateContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -743,7 +704,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -762,23 +722,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, template_name=template_name, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -789,8 +748,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_api_operations.py index 5396b8dbac8a..44ac6852140b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_api_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_api_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -89,7 +90,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -111,7 +111,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -120,12 +120,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -137,13 +136,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ApiCollection", pipeline_response) @@ -153,11 +152,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -170,10 +169,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, gateway_id: str, api_id: str, **kwargs: Any @@ -191,7 +186,6 @@ async def get_entity_tag( :param api_id: API identifier. Must be unique in the current API Management service instance. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -210,23 +204,22 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,13 +233,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}" - } - @overload async def create_or_update( self, @@ -277,7 +266,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -290,7 +278,7 @@ async def create_or_update( service_name: str, gateway_id: str, api_id: str, - parameters: Optional[IO] = None, + parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -309,11 +297,10 @@ async def create_or_update( Required. :type api_id: str :param parameters: Default value is None. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -326,7 +313,7 @@ async def create_or_update( service_name: str, gateway_id: str, api_id: str, - parameters: Optional[Union[_models.AssociationContract, IO]] = None, + parameters: Optional[Union[_models.AssociationContract, IO[bytes]]] = None, **kwargs: Any ) -> _models.ApiContract: """Adds an API to the specified Gateway. @@ -342,12 +329,9 @@ async def create_or_update( :param api_id: API identifier. Must be unique in the current API Management service instance. Required. :type api_id: str - :param parameters: Is either a AssociationContract type or a IO type. Default value is None. - :type parameters: ~azure.mgmt.apimanagement.models.AssociationContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Is either a AssociationContract type or a IO[bytes] type. Default value is + None. + :type parameters: ~azure.mgmt.apimanagement.models.AssociationContract or IO[bytes] :return: ApiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -370,7 +354,7 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: if parameters is not None: @@ -378,7 +362,7 @@ async def create_or_update( else: _json = None - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -388,16 +372,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,10 +401,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, gateway_id: str, api_id: str, **kwargs: Any @@ -439,7 +418,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param api_id: API identifier. Must be unique in the current API Management service instance. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -458,23 +436,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -485,8 +462,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_certificate_authority_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_certificate_authority_operations.py index 669da7b38a1d..0a4aab7cd7f8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_certificate_authority_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_certificate_authority_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -89,7 +90,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GatewayCertificateAuthorityContract or the result of cls(response) :rtype: @@ -113,7 +113,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -122,12 +122,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -139,13 +138,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("GatewayCertificateAuthorityCollection", pipeline_response) @@ -155,11 +154,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -172,10 +171,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, gateway_id: str, certificate_id: str, **kwargs: Any @@ -193,7 +188,6 @@ async def get_entity_tag( :param certificate_id: Identifier of the certificate entity. Must be unique in the current API Management service instance. Required. :type certificate_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -212,23 +206,22 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, certificate_id=certificate_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,13 +235,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, gateway_id: str, certificate_id: str, **kwargs: Any @@ -266,7 +255,6 @@ async def get( :param certificate_id: Identifier of the certificate entity. Must be unique in the current API Management service instance. Required. :type certificate_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayCertificateAuthorityContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityContract :raises ~azure.core.exceptions.HttpResponseError: @@ -285,23 +273,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GatewayCertificateAuthorityContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, certificate_id=certificate_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -317,13 +304,9 @@ async def get( deserialized = self._deserialize("GatewayCertificateAuthorityContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -359,7 +342,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayCertificateAuthorityContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityContract :raises ~azure.core.exceptions.HttpResponseError: @@ -372,7 +354,7 @@ async def create_or_update( service_name: str, gateway_id: str, certificate_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -392,14 +374,13 @@ async def create_or_update( Management service instance. Required. :type certificate_id: str :param parameters: Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayCertificateAuthorityContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityContract :raises ~azure.core.exceptions.HttpResponseError: @@ -412,7 +393,7 @@ async def create_or_update( service_name: str, gateway_id: str, certificate_id: str, - parameters: Union[_models.GatewayCertificateAuthorityContract, IO], + parameters: Union[_models.GatewayCertificateAuthorityContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.GatewayCertificateAuthorityContract: @@ -429,15 +410,13 @@ async def create_or_update( :param certificate_id: Identifier of the certificate entity. Must be unique in the current API Management service instance. Required. :type certificate_id: str - :param parameters: Is either a GatewayCertificateAuthorityContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityContract or IO + :param parameters: Is either a GatewayCertificateAuthorityContract type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityContract or + IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayCertificateAuthorityContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityContract :raises ~azure.core.exceptions.HttpResponseError: @@ -460,12 +439,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GatewayCertificateAuthorityContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -476,16 +455,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -511,10 +489,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, @@ -541,7 +515,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -560,7 +533,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -568,16 +541,15 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -588,8 +560,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_hostname_configuration_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_hostname_configuration_operations.py index a4ccb3975e8f..02dbddaafcec 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_hostname_configuration_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_hostname_configuration_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -91,7 +92,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GatewayHostnameConfigurationContract or the result of cls(response) :rtype: @@ -115,7 +115,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -124,12 +124,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -141,13 +140,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("GatewayHostnameConfigurationCollection", pipeline_response) @@ -157,11 +156,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -174,10 +173,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, gateway_id: str, hc_id: str, **kwargs: Any @@ -196,7 +191,6 @@ async def get_entity_tag( :param hc_id: Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. Required. :type hc_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -215,23 +209,22 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, hc_id=hc_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -245,13 +238,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, gateway_id: str, hc_id: str, **kwargs: Any @@ -269,7 +258,6 @@ async def get( :param hc_id: Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. Required. :type hc_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayHostnameConfigurationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -288,23 +276,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GatewayHostnameConfigurationContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, hc_id=hc_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -320,13 +307,9 @@ async def get( deserialized = self._deserialize("GatewayHostnameConfigurationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -362,7 +345,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayHostnameConfigurationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -375,7 +357,7 @@ async def create_or_update( service_name: str, gateway_id: str, hc_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -395,14 +377,13 @@ async def create_or_update( Gateway entity. Required. :type hc_id: str :param parameters: Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayHostnameConfigurationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -415,7 +396,7 @@ async def create_or_update( service_name: str, gateway_id: str, hc_id: str, - parameters: Union[_models.GatewayHostnameConfigurationContract, IO], + parameters: Union[_models.GatewayHostnameConfigurationContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.GatewayHostnameConfigurationContract: @@ -432,16 +413,13 @@ async def create_or_update( :param hc_id: Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. Required. :type hc_id: str - :param parameters: Is either a GatewayHostnameConfigurationContract type or a IO type. + :param parameters: Is either a GatewayHostnameConfigurationContract type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationContract or IO + :type parameters: ~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationContract or + IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayHostnameConfigurationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -464,12 +442,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GatewayHostnameConfigurationContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -480,16 +458,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -515,10 +492,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, gateway_id: str, hc_id: str, if_match: str, **kwargs: Any @@ -539,7 +512,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -558,7 +530,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -566,16 +538,15 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -586,8 +557,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_operations.py index 10b0fb2e29a6..c17451ca21cd 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -92,7 +93,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GatewayContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GatewayContract] @@ -115,7 +115,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -123,12 +123,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -140,13 +139,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("GatewayCollection", pipeline_response) @@ -156,11 +155,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -173,10 +172,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways" - } - @distributed_trace_async async def get_entity_tag(self, resource_group_name: str, service_name: str, gateway_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the Gateway specified by its identifier. @@ -189,7 +184,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, gate :param gateway_id: Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. Required. :type gateway_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -208,22 +202,21 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, gate api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,13 +230,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, gate response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, gateway_id: str, **kwargs: Any @@ -258,7 +247,6 @@ async def get( :param gateway_id: Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. Required. :type gateway_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayContract :raises ~azure.core.exceptions.HttpResponseError: @@ -277,22 +265,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GatewayContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -308,13 +295,9 @@ async def get( deserialized = self._deserialize("GatewayContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -346,7 +329,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayContract :raises ~azure.core.exceptions.HttpResponseError: @@ -358,7 +340,7 @@ async def create_or_update( resource_group_name: str, service_name: str, gateway_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -375,14 +357,13 @@ async def create_or_update( service instance. Must not have value 'managed'. Required. :type gateway_id: str :param parameters: Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayContract :raises ~azure.core.exceptions.HttpResponseError: @@ -394,7 +375,7 @@ async def create_or_update( resource_group_name: str, service_name: str, gateway_id: str, - parameters: Union[_models.GatewayContract, IO], + parameters: Union[_models.GatewayContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.GatewayContract: @@ -408,15 +389,11 @@ async def create_or_update( :param gateway_id: Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. Required. :type gateway_id: str - :param parameters: Is either a GatewayContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.GatewayContract or IO + :param parameters: Is either a GatewayContract type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.GatewayContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayContract :raises ~azure.core.exceptions.HttpResponseError: @@ -439,12 +416,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GatewayContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -454,16 +431,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -489,10 +465,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" - } - @overload async def update( self, @@ -523,7 +495,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayContract :raises ~azure.core.exceptions.HttpResponseError: @@ -536,7 +507,7 @@ async def update( service_name: str, gateway_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -555,11 +526,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayContract :raises ~azure.core.exceptions.HttpResponseError: @@ -572,7 +542,7 @@ async def update( service_name: str, gateway_id: str, if_match: str, - parameters: Union[_models.GatewayContract, IO], + parameters: Union[_models.GatewayContract, IO[bytes]], **kwargs: Any ) -> _models.GatewayContract: """Updates the details of the gateway specified by its identifier. @@ -588,12 +558,8 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Is either a GatewayContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.GatewayContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Is either a GatewayContract type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.GatewayContract or IO[bytes] :return: GatewayContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayContract :raises ~azure.core.exceptions.HttpResponseError: @@ -616,12 +582,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GatewayContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -631,16 +597,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -656,13 +621,9 @@ async def update( deserialized = self._deserialize("GatewayContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -681,7 +642,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -700,23 +660,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -727,11 +686,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def list_keys( @@ -747,7 +702,6 @@ async def list_keys( :param gateway_id: Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. Required. :type gateway_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayKeysContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayKeysContract :raises ~azure.core.exceptions.HttpResponseError: @@ -766,22 +720,21 @@ async def list_keys( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GatewayKeysContract] = kwargs.pop("cls", None) - request = build_list_keys_request( + _request = build_list_keys_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -797,13 +750,9 @@ async def list_keys( deserialized = self._deserialize("GatewayKeysContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - list_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listKeys" - } + return deserialized # type: ignore @overload async def regenerate_key( # pylint: disable=inconsistent-return-statements @@ -831,7 +780,6 @@ async def regenerate_key( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -843,7 +791,7 @@ async def regenerate_key( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, gateway_id: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -859,11 +807,10 @@ async def regenerate_key( # pylint: disable=inconsistent-return-statements service instance. Must not have value 'managed'. Required. :type gateway_id: str :param parameters: Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -875,7 +822,7 @@ async def regenerate_key( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, gateway_id: str, - parameters: Union[_models.GatewayKeyRegenerationRequestContract, IO], + parameters: Union[_models.GatewayKeyRegenerationRequestContract, IO[bytes]], **kwargs: Any ) -> None: """Regenerates specified gateway key invalidating any tokens created with it. @@ -888,13 +835,10 @@ async def regenerate_key( # pylint: disable=inconsistent-return-statements :param gateway_id: Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. Required. :type gateway_id: str - :param parameters: Is either a GatewayKeyRegenerationRequestContract type or a IO type. + :param parameters: Is either a GatewayKeyRegenerationRequestContract type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.GatewayKeyRegenerationRequestContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :type parameters: ~azure.mgmt.apimanagement.models.GatewayKeyRegenerationRequestContract or + IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -917,12 +861,12 @@ async def regenerate_key( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GatewayKeyRegenerationRequestContract") - request = build_regenerate_key_request( + _request = build_regenerate_key_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -931,16 +875,15 @@ async def regenerate_key( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.regenerate_key.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -951,11 +894,7 @@ async def regenerate_key( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - regenerate_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/regenerateKey" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def generate_token( @@ -983,7 +922,6 @@ async def generate_token( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayTokenContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayTokenContract :raises ~azure.core.exceptions.HttpResponseError: @@ -995,7 +933,7 @@ async def generate_token( resource_group_name: str, service_name: str, gateway_id: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1011,11 +949,10 @@ async def generate_token( service instance. Must not have value 'managed'. Required. :type gateway_id: str :param parameters: Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayTokenContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayTokenContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1027,7 +964,7 @@ async def generate_token( resource_group_name: str, service_name: str, gateway_id: str, - parameters: Union[_models.GatewayTokenRequestContract, IO], + parameters: Union[_models.GatewayTokenRequestContract, IO[bytes]], **kwargs: Any ) -> _models.GatewayTokenContract: """Gets the Shared Access Authorization Token for the gateway. @@ -1040,12 +977,8 @@ async def generate_token( :param gateway_id: Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. Required. :type gateway_id: str - :param parameters: Is either a GatewayTokenRequestContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.GatewayTokenRequestContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Is either a GatewayTokenRequestContract type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.GatewayTokenRequestContract or IO[bytes] :return: GatewayTokenContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayTokenContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1068,12 +1001,12 @@ async def generate_token( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GatewayTokenRequestContract") - request = build_generate_token_request( + _request = build_generate_token_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -1082,16 +1015,15 @@ async def generate_token( content_type=content_type, json=_json, content=_content, - template_url=self.generate_token.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1104,10 +1036,6 @@ async def generate_token( deserialized = self._deserialize("GatewayTokenContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - generate_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/generateToken" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_global_schema_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_global_schema_operations.py index 360c009d8ae2..a3de1118cb3e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_global_schema_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_global_schema_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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 @@ -88,7 +89,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GlobalSchemaContract or the result of cls(response) :rtype: @@ -112,7 +112,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -120,12 +120,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -137,13 +136,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("GlobalSchemaCollection", pipeline_response) @@ -153,11 +152,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -170,10 +169,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas" - } - @distributed_trace_async async def get_entity_tag(self, resource_group_name: str, service_name: str, schema_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the Schema specified by its identifier. @@ -186,7 +181,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, sche :param schema_id: Schema id identifier. Must be unique in the current API Management service instance. Required. :type schema_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -205,22 +199,21 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, sche api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, schema_id=schema_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,13 +227,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, sche response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, schema_id: str, **kwargs: Any @@ -255,7 +244,6 @@ async def get( :param schema_id: Schema id identifier. Must be unique in the current API Management service instance. Required. :type schema_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalSchemaContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GlobalSchemaContract :raises ~azure.core.exceptions.HttpResponseError: @@ -274,22 +262,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalSchemaContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, schema_id=schema_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -305,20 +292,16 @@ async def get( deserialized = self._deserialize("GlobalSchemaContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, service_name: str, schema_id: str, - parameters: Union[_models.GlobalSchemaContract, IO], + parameters: Union[_models.GlobalSchemaContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> Optional[_models.GlobalSchemaContract]: @@ -340,12 +323,12 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GlobalSchemaContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, schema_id=schema_id, @@ -355,16 +338,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -387,13 +369,9 @@ async def _create_or_update_initial( deserialized = self._deserialize("GlobalSchemaContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -425,14 +403,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either GlobalSchemaContract or the result of cls(response) :rtype: @@ -446,7 +416,7 @@ async def begin_create_or_update( resource_group_name: str, service_name: str, schema_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -463,21 +433,13 @@ async def begin_create_or_update( instance. Required. :type schema_id: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either GlobalSchemaContract or the result of cls(response) :rtype: @@ -491,7 +453,7 @@ async def begin_create_or_update( resource_group_name: str, service_name: str, schema_id: str, - parameters: Union[_models.GlobalSchemaContract, IO], + parameters: Union[_models.GlobalSchemaContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> AsyncLROPoller[_models.GlobalSchemaContract]: @@ -505,23 +467,12 @@ async def begin_create_or_update( :param schema_id: Schema id identifier. Must be unique in the current API Management service instance. Required. :type schema_id: str - :param parameters: Create or update parameters. Is either a GlobalSchemaContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.GlobalSchemaContract or IO + :param parameters: Create or update parameters. Is either a GlobalSchemaContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.GlobalSchemaContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either GlobalSchemaContract or the result of cls(response) :rtype: @@ -560,7 +511,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("GlobalSchemaContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -572,17 +523,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.GlobalSchemaContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" - } + return AsyncLROPoller[_models.GlobalSchemaContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -601,7 +550,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -620,23 +568,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, schema_id=schema_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -647,8 +594,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_operations.py index ee2184a609eb..555b58801e64 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -94,7 +95,6 @@ def list_by_api( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResolverContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ResolverContract] @@ -117,7 +117,7 @@ def list_by_api( def prepare_request(next_link=None): if not next_link: - request = build_list_by_api_request( + _request = build_list_by_api_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -126,12 +126,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -143,13 +142,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ResolverCollection", pipeline_response) @@ -159,11 +158,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,10 +175,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, api_id: str, resolver_id: str, **kwargs: Any @@ -197,7 +192,6 @@ async def get_entity_tag( :param resolver_id: Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. Required. :type resolver_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -216,23 +210,22 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, resolver_id=resolver_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,13 +239,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, api_id: str, resolver_id: str, **kwargs: Any @@ -270,7 +259,6 @@ async def get( :param resolver_id: Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. Required. :type resolver_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ResolverContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ResolverContract :raises ~azure.core.exceptions.HttpResponseError: @@ -289,23 +277,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResolverContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, resolver_id=resolver_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -321,13 +308,9 @@ async def get( deserialized = self._deserialize("ResolverContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -363,7 +346,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ResolverContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ResolverContract :raises ~azure.core.exceptions.HttpResponseError: @@ -376,7 +358,7 @@ async def create_or_update( service_name: str, api_id: str, resolver_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -396,14 +378,13 @@ async def create_or_update( Management service instance. Required. :type resolver_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ResolverContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ResolverContract :raises ~azure.core.exceptions.HttpResponseError: @@ -416,7 +397,7 @@ async def create_or_update( service_name: str, api_id: str, resolver_id: str, - parameters: Union[_models.ResolverContract, IO], + parameters: Union[_models.ResolverContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.ResolverContract: @@ -433,15 +414,12 @@ async def create_or_update( :param resolver_id: Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. Required. :type resolver_id: str - :param parameters: Create parameters. Is either a ResolverContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ResolverContract or IO + :param parameters: Create parameters. Is either a ResolverContract type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.apimanagement.models.ResolverContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ResolverContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ResolverContract :raises ~azure.core.exceptions.HttpResponseError: @@ -464,12 +442,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ResolverContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -480,16 +458,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -515,10 +492,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" - } - @overload async def update( self, @@ -553,7 +526,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ResolverContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ResolverContract :raises ~azure.core.exceptions.HttpResponseError: @@ -567,7 +539,7 @@ async def update( api_id: str, resolver_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -589,11 +561,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: GraphQL API Resolver Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: ResolverContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ResolverContract :raises ~azure.core.exceptions.HttpResponseError: @@ -607,7 +578,7 @@ async def update( api_id: str, resolver_id: str, if_match: str, - parameters: Union[_models.ResolverUpdateContract, IO], + parameters: Union[_models.ResolverUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.ResolverContract: """Updates the details of the resolver in the GraphQL API specified by its identifier. @@ -627,12 +598,8 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: GraphQL API Resolver Update parameters. Is either a ResolverUpdateContract - type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ResolverUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ResolverUpdateContract or IO[bytes] :return: ResolverContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ResolverContract :raises ~azure.core.exceptions.HttpResponseError: @@ -655,12 +622,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ResolverUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -671,16 +638,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -696,13 +662,9 @@ async def update( deserialized = self._deserialize("ResolverContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -724,7 +686,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -743,7 +704,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -751,16 +712,15 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -771,8 +731,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_policy_operations.py index f26a5f6032aa..62c4dce33e88 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_policy_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -77,7 +78,6 @@ def list_by_resolver( :param resolver_id: Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. Required. :type resolver_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PolicyContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.PolicyContract] @@ -100,19 +100,18 @@ def list_by_resolver( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resolver_request( + _request = build_list_by_resolver_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, resolver_id=resolver_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resolver.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -124,13 +123,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("PolicyCollection", pipeline_response) @@ -140,11 +139,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -157,10 +156,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resolver.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies" - } - @distributed_trace_async async def get_entity_tag( self, @@ -187,7 +182,6 @@ async def get_entity_tag( :type resolver_id: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -206,7 +200,7 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -214,16 +208,15 @@ async def get_entity_tag( policy_id=policy_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,13 +230,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}" - } - @distributed_trace_async async def get( self, @@ -273,7 +262,6 @@ async def get( :param format: Policy Export Format. Known values are: "xml" and "rawxml". Default value is "xml". :type format: str or ~azure.mgmt.apimanagement.models.PolicyExportFormat - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -292,7 +280,7 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -301,16 +289,15 @@ async def get( subscription_id=self._config.subscription_id, format=format, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -326,13 +313,9 @@ async def get( deserialized = self._deserialize("PolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -371,7 +354,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -385,7 +367,7 @@ async def create_or_update( api_id: str, resolver_id: str, policy_id: Union[str, _models.PolicyIdName], - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -407,14 +389,13 @@ async def create_or_update( :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName :param parameters: The policy contents to apply. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -428,7 +409,7 @@ async def create_or_update( api_id: str, resolver_id: str, policy_id: Union[str, _models.PolicyIdName], - parameters: Union[_models.PolicyContract, IO], + parameters: Union[_models.PolicyContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.PolicyContract: @@ -447,16 +428,12 @@ async def create_or_update( :type resolver_id: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO + :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -479,12 +456,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PolicyContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -496,16 +473,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -531,10 +507,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, @@ -564,7 +536,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -583,7 +554,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -592,16 +563,15 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -612,8 +582,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_operations.py index c332578e9abe..66fe9a062bc9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -92,7 +93,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GroupContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GroupContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -114,7 +114,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -122,12 +122,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -139,13 +138,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("GroupCollection", pipeline_response) @@ -155,11 +154,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -172,10 +171,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups" - } - @distributed_trace_async async def get_entity_tag(self, resource_group_name: str, service_name: str, group_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the group specified by its identifier. @@ -188,7 +183,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, grou :param group_id: Group identifier. Must be unique in the current API Management service instance. Required. :type group_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -207,22 +201,21 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, grou api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, group_id=group_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,13 +229,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, grou response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, group_id: str, **kwargs: Any @@ -257,7 +246,6 @@ async def get( :param group_id: Group identifier. Must be unique in the current API Management service instance. Required. :type group_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GroupContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GroupContract :raises ~azure.core.exceptions.HttpResponseError: @@ -276,22 +264,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GroupContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, group_id=group_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -307,13 +294,9 @@ async def get( deserialized = self._deserialize("GroupContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -345,7 +328,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GroupContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GroupContract :raises ~azure.core.exceptions.HttpResponseError: @@ -357,7 +339,7 @@ async def create_or_update( resource_group_name: str, service_name: str, group_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -374,14 +356,13 @@ async def create_or_update( instance. Required. :type group_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GroupContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GroupContract :raises ~azure.core.exceptions.HttpResponseError: @@ -393,7 +374,7 @@ async def create_or_update( resource_group_name: str, service_name: str, group_id: str, - parameters: Union[_models.GroupCreateParameters, IO], + parameters: Union[_models.GroupCreateParameters, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.GroupContract: @@ -407,16 +388,12 @@ async def create_or_update( :param group_id: Group identifier. Must be unique in the current API Management service instance. Required. :type group_id: str - :param parameters: Create parameters. Is either a GroupCreateParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.GroupCreateParameters or IO + :param parameters: Create parameters. Is either a GroupCreateParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.GroupCreateParameters or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GroupContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GroupContract :raises ~azure.core.exceptions.HttpResponseError: @@ -439,12 +416,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GroupCreateParameters") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, group_id=group_id, @@ -454,16 +431,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -489,10 +465,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" - } - @overload async def update( self, @@ -523,7 +495,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GroupContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GroupContract :raises ~azure.core.exceptions.HttpResponseError: @@ -536,7 +507,7 @@ async def update( service_name: str, group_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -555,11 +526,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: GroupContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GroupContract :raises ~azure.core.exceptions.HttpResponseError: @@ -572,7 +542,7 @@ async def update( service_name: str, group_id: str, if_match: str, - parameters: Union[_models.GroupUpdateParameters, IO], + parameters: Union[_models.GroupUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.GroupContract: """Updates the details of the group specified by its identifier. @@ -588,13 +558,9 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a GroupUpdateParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.GroupUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a GroupUpdateParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.GroupUpdateParameters or IO[bytes] :return: GroupContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GroupContract :raises ~azure.core.exceptions.HttpResponseError: @@ -617,12 +583,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GroupUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, group_id=group_id, @@ -632,16 +598,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -657,13 +622,9 @@ async def update( deserialized = self._deserialize("GroupContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -682,7 +643,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -701,23 +661,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, group_id=group_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -728,8 +687,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_user_operations.py index 25d7e69b499d..e76b8629c58d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_user_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_user_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -93,7 +93,6 @@ def list( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.UserContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -115,7 +114,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, service_name=service_name, group_id=group_id, @@ -124,12 +123,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -141,13 +139,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("UserCollection", pipeline_response) @@ -157,11 +155,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -174,10 +172,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users" - } - @distributed_trace_async async def check_entity_exists( self, resource_group_name: str, service_name: str, group_id: str, user_id: str, **kwargs: Any @@ -195,7 +189,6 @@ async def check_entity_exists( :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -214,23 +207,22 @@ async def check_entity_exists( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_check_entity_exists_request( + _request = build_check_entity_exists_request( resource_group_name=resource_group_name, service_name=service_name, group_id=group_id, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.check_entity_exists.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -241,13 +233,9 @@ async def check_entity_exists( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 - check_entity_exists.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}" - } - @distributed_trace_async async def create( self, resource_group_name: str, service_name: str, group_id: str, user_id: str, **kwargs: Any @@ -265,7 +253,6 @@ async def create( :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserContract :raises ~azure.core.exceptions.HttpResponseError: @@ -284,23 +271,22 @@ async def create( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UserContract] = kwargs.pop("cls", None) - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, service_name=service_name, group_id=group_id, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -321,10 +307,6 @@ async def create( return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, group_id: str, user_id: str, **kwargs: Any @@ -342,7 +324,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -361,23 +342,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, group_id=group_id, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -388,8 +368,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_identity_provider_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_identity_provider_operations.py index 93d77489e3c6..8124d13b6033 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_identity_provider_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_identity_provider_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -77,7 +78,6 @@ def list_by_service( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IdentityProviderContract or the result of cls(response) :rtype: @@ -101,17 +101,16 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -123,13 +122,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("IdentityProviderList", pipeline_response) @@ -139,11 +138,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -156,10 +155,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders" - } - @distributed_trace_async async def get_entity_tag( self, @@ -178,7 +173,6 @@ async def get_entity_tag( :param identity_provider_name: Identity Provider Type identifier. Known values are: "facebook", "google", "microsoft", "twitter", "aad", and "aadB2C". Required. :type identity_provider_name: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -197,22 +191,21 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, identity_provider_name=identity_provider_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -226,13 +219,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" - } - @distributed_trace_async async def get( self, @@ -252,7 +241,6 @@ async def get( :param identity_provider_name: Identity Provider Type identifier. Known values are: "facebook", "google", "microsoft", "twitter", "aad", and "aadB2C". Required. :type identity_provider_name: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :keyword callable cls: A custom type or function that will be passed the direct response :return: IdentityProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -271,22 +259,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IdentityProviderContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, identity_provider_name=identity_provider_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,13 +289,9 @@ async def get( deserialized = self._deserialize("IdentityProviderContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -340,7 +323,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IdentityProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -352,7 +334,7 @@ async def create_or_update( resource_group_name: str, service_name: str, identity_provider_name: Union[str, _models.IdentityProviderType], - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -369,14 +351,13 @@ async def create_or_update( "google", "microsoft", "twitter", "aad", and "aadB2C". Required. :type identity_provider_name: str or ~azure.mgmt.apimanagement.models.IdentityProviderType :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IdentityProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -388,7 +369,7 @@ async def create_or_update( resource_group_name: str, service_name: str, identity_provider_name: Union[str, _models.IdentityProviderType], - parameters: Union[_models.IdentityProviderCreateContract, IO], + parameters: Union[_models.IdentityProviderCreateContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.IdentityProviderContract: @@ -402,16 +383,12 @@ async def create_or_update( :param identity_provider_name: Identity Provider Type identifier. Known values are: "facebook", "google", "microsoft", "twitter", "aad", and "aadB2C". Required. :type identity_provider_name: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :param parameters: Create parameters. Is either a IdentityProviderCreateContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.IdentityProviderCreateContract or IO + :param parameters: Create parameters. Is either a IdentityProviderCreateContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.IdentityProviderCreateContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IdentityProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -434,12 +411,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "IdentityProviderCreateContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, identity_provider_name=identity_provider_name, @@ -449,16 +426,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -484,10 +460,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" - } - @overload async def update( self, @@ -518,7 +490,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IdentityProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -531,7 +502,7 @@ async def update( service_name: str, identity_provider_name: Union[str, _models.IdentityProviderType], if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -550,11 +521,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: IdentityProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -567,7 +537,7 @@ async def update( service_name: str, identity_provider_name: Union[str, _models.IdentityProviderType], if_match: str, - parameters: Union[_models.IdentityProviderUpdateParameters, IO], + parameters: Union[_models.IdentityProviderUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.IdentityProviderContract: """Updates an existing IdentityProvider configuration. @@ -583,13 +553,10 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a IdentityProviderUpdateParameters type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.IdentityProviderUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a IdentityProviderUpdateParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.IdentityProviderUpdateParameters or + IO[bytes] :return: IdentityProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -612,12 +579,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "IdentityProviderUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, identity_provider_name=identity_provider_name, @@ -627,16 +594,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -652,13 +618,9 @@ async def update( deserialized = self._deserialize("IdentityProviderContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -682,7 +644,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -701,23 +662,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, identity_provider_name=identity_provider_name, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -728,11 +688,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def list_secrets( @@ -752,7 +708,6 @@ async def list_secrets( :param identity_provider_name: Identity Provider Type identifier. Known values are: "facebook", "google", "microsoft", "twitter", "aad", and "aadB2C". Required. :type identity_provider_name: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :keyword callable cls: A custom type or function that will be passed the direct response :return: ClientSecretContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ClientSecretContract :raises ~azure.core.exceptions.HttpResponseError: @@ -771,22 +726,21 @@ async def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClientSecretContract] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, service_name=service_name, identity_provider_name=identity_provider_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -802,10 +756,6 @@ async def list_secrets( deserialized = self._deserialize("ClientSecretContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_issue_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_issue_operations.py index 6f44336414f7..7c44f282deeb 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_issue_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_issue_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -84,7 +84,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IssueContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.IssueContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -106,7 +105,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -114,12 +113,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -131,13 +129,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("IssueCollection", pipeline_response) @@ -147,11 +145,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -164,10 +162,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, issue_id: str, **kwargs: Any @@ -182,7 +176,6 @@ async def get( :param issue_id: Issue identifier. Must be unique in the current API Management service instance. Required. :type issue_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueContract :raises ~azure.core.exceptions.HttpResponseError: @@ -201,22 +194,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IssueContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, issue_id=issue_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,10 +224,6 @@ async def get( deserialized = self._deserialize("IssueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues/{issueId}" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_logger_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_logger_operations.py index 7f485bca50f3..1b0664de5d3e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_logger_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_logger_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -92,7 +93,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LoggerContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.LoggerContract] @@ -115,7 +115,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -123,12 +123,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -140,13 +139,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("LoggerCollection", pipeline_response) @@ -156,11 +155,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -173,10 +172,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers" - } - @distributed_trace_async async def get_entity_tag(self, resource_group_name: str, service_name: str, logger_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the logger specified by its identifier. @@ -189,7 +184,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, logg :param logger_id: Logger identifier. Must be unique in the API Management service instance. Required. :type logger_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -208,22 +202,21 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, logg api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, logger_id=logger_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,13 +230,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, logg response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, logger_id: str, **kwargs: Any @@ -258,7 +247,6 @@ async def get( :param logger_id: Logger identifier. Must be unique in the API Management service instance. Required. :type logger_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LoggerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.LoggerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -277,22 +265,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LoggerContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, logger_id=logger_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -308,13 +295,9 @@ async def get( deserialized = self._deserialize("LoggerContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -346,7 +329,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LoggerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.LoggerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -358,7 +340,7 @@ async def create_or_update( resource_group_name: str, service_name: str, logger_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -375,14 +357,13 @@ async def create_or_update( Required. :type logger_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LoggerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.LoggerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -394,7 +375,7 @@ async def create_or_update( resource_group_name: str, service_name: str, logger_id: str, - parameters: Union[_models.LoggerContract, IO], + parameters: Union[_models.LoggerContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.LoggerContract: @@ -408,15 +389,12 @@ async def create_or_update( :param logger_id: Logger identifier. Must be unique in the API Management service instance. Required. :type logger_id: str - :param parameters: Create parameters. Is either a LoggerContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.LoggerContract or IO + :param parameters: Create parameters. Is either a LoggerContract type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.apimanagement.models.LoggerContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LoggerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.LoggerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -439,12 +417,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "LoggerContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, logger_id=logger_id, @@ -454,16 +432,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -489,10 +466,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" - } - @overload async def update( self, @@ -523,7 +496,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LoggerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.LoggerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -536,7 +508,7 @@ async def update( service_name: str, logger_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -555,11 +527,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: LoggerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.LoggerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -572,7 +543,7 @@ async def update( service_name: str, logger_id: str, if_match: str, - parameters: Union[_models.LoggerUpdateContract, IO], + parameters: Union[_models.LoggerUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.LoggerContract: """Updates an existing logger. @@ -588,13 +559,9 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a LoggerUpdateContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.LoggerUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a LoggerUpdateContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.LoggerUpdateContract or IO[bytes] :return: LoggerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.LoggerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -617,12 +584,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "LoggerUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, logger_id=logger_id, @@ -632,16 +599,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -657,13 +623,9 @@ async def update( deserialized = self._deserialize("LoggerContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -682,7 +644,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -701,23 +662,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, logger_id=logger_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -728,8 +688,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_named_value_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_named_value_operations.py index 8e5625834c73..3e912822bda3 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_named_value_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_named_value_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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 @@ -99,7 +100,6 @@ def list_by_service( :param is_key_vault_refresh_failed: When set to true, the response contains only named value entities which failed refresh. Default value is None. :type is_key_vault_refresh_failed: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NamedValueContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.NamedValueContract] @@ -122,7 +122,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -131,12 +131,11 @@ def prepare_request(next_link=None): skip=skip, is_key_vault_refresh_failed=is_key_vault_refresh_failed, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -148,13 +147,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("NamedValueCollection", pipeline_response) @@ -164,11 +163,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -181,10 +180,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, named_value_id: str, **kwargs: Any @@ -198,7 +193,6 @@ async def get_entity_tag( :type service_name: str :param named_value_id: Identifier of the NamedValue. Required. :type named_value_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -217,22 +211,21 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,13 +239,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, named_value_id: str, **kwargs: Any @@ -266,7 +255,6 @@ async def get( :type service_name: str :param named_value_id: Identifier of the NamedValue. Required. :type named_value_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NamedValueContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.NamedValueContract :raises ~azure.core.exceptions.HttpResponseError: @@ -285,22 +273,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NamedValueContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -316,20 +303,16 @@ async def get( deserialized = self._deserialize("NamedValueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, service_name: str, named_value_id: str, - parameters: Union[_models.NamedValueCreateContract, IO], + parameters: Union[_models.NamedValueCreateContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> Optional[_models.NamedValueContract]: @@ -351,12 +334,12 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "NamedValueCreateContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, @@ -366,16 +349,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -398,13 +380,9 @@ async def _create_or_update_initial( deserialized = self._deserialize("NamedValueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -435,14 +413,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either NamedValueContract or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] @@ -455,7 +425,7 @@ async def begin_create_or_update( resource_group_name: str, service_name: str, named_value_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -471,21 +441,13 @@ async def begin_create_or_update( :param named_value_id: Identifier of the NamedValue. Required. :type named_value_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either NamedValueContract or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] @@ -498,7 +460,7 @@ async def begin_create_or_update( resource_group_name: str, service_name: str, named_value_id: str, - parameters: Union[_models.NamedValueCreateContract, IO], + parameters: Union[_models.NamedValueCreateContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> AsyncLROPoller[_models.NamedValueContract]: @@ -511,23 +473,12 @@ async def begin_create_or_update( :type service_name: str :param named_value_id: Identifier of the NamedValue. Required. :type named_value_id: str - :param parameters: Create parameters. Is either a NamedValueCreateContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.NamedValueCreateContract or IO + :param parameters: Create parameters. Is either a NamedValueCreateContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.NamedValueCreateContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either NamedValueContract or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] @@ -565,7 +516,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("NamedValueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -577,17 +528,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.NamedValueContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" - } + return AsyncLROPoller[_models.NamedValueContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, @@ -595,7 +544,7 @@ async def _update_initial( service_name: str, named_value_id: str, if_match: str, - parameters: Union[_models.NamedValueUpdateParameters, IO], + parameters: Union[_models.NamedValueUpdateParameters, IO[bytes]], **kwargs: Any ) -> Optional[_models.NamedValueContract]: error_map = { @@ -616,12 +565,12 @@ async def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "NamedValueUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, @@ -631,16 +580,15 @@ async def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -658,13 +606,9 @@ async def _update_initial( deserialized = self._deserialize("NamedValueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -695,14 +639,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either NamedValueContract or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] @@ -716,7 +652,7 @@ async def begin_update( service_name: str, named_value_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -734,18 +670,10 @@ async def begin_update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either NamedValueContract or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] @@ -759,7 +687,7 @@ async def begin_update( service_name: str, named_value_id: str, if_match: str, - parameters: Union[_models.NamedValueUpdateParameters, IO], + parameters: Union[_models.NamedValueUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.NamedValueContract]: """Updates the specific named value. @@ -774,20 +702,9 @@ async def begin_update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a NamedValueUpdateParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.NamedValueUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Update parameters. Is either a NamedValueUpdateParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.NamedValueUpdateParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either NamedValueContract or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] @@ -825,7 +742,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("NamedValueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -837,17 +754,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.NamedValueContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" - } + return AsyncLROPoller[_models.NamedValueContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -865,7 +780,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -884,23 +798,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -911,11 +824,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def list_value( @@ -930,7 +839,6 @@ async def list_value( :type service_name: str :param named_value_id: Identifier of the NamedValue. Required. :type named_value_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NamedValueSecretContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.NamedValueSecretContract :raises ~azure.core.exceptions.HttpResponseError: @@ -949,22 +857,21 @@ async def list_value( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NamedValueSecretContract] = kwargs.pop("cls", None) - request = build_list_value_request( + _request = build_list_value_request( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_value.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -980,13 +887,9 @@ async def list_value( deserialized = self._deserialize("NamedValueSecretContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - list_value.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/listValue" - } + return deserialized # type: ignore async def _refresh_secret_initial( self, resource_group_name: str, service_name: str, named_value_id: str, **kwargs: Any @@ -1005,22 +908,21 @@ async def _refresh_secret_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.NamedValueContract]] = kwargs.pop("cls", None) - request = build_refresh_secret_request( + _request = build_refresh_secret_request( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._refresh_secret_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1038,13 +940,9 @@ async def _refresh_secret_initial( deserialized = self._deserialize("NamedValueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _refresh_secret_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/refreshSecret" - } + return deserialized # type: ignore @distributed_trace_async async def begin_refresh_secret( @@ -1059,14 +957,6 @@ async def begin_refresh_secret( :type service_name: str :param named_value_id: Identifier of the NamedValue. Required. :type named_value_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either NamedValueContract or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] @@ -1100,7 +990,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("NamedValueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -1112,14 +1002,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.NamedValueContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_refresh_secret.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/refreshSecret" - } + return AsyncLROPoller[_models.NamedValueContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_network_status_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_network_status_operations.py index e4bf6b5fdc89..f38a7f53653a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_network_status_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_network_status_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -64,7 +64,6 @@ async def list_by_service( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: list of NetworkStatusContractByLocation or the result of cls(response) :rtype: list[~azure.mgmt.apimanagement.models.NetworkStatusContractByLocation] :raises ~azure.core.exceptions.HttpResponseError: @@ -83,21 +82,20 @@ async def list_by_service( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[List[_models.NetworkStatusContractByLocation]] = kwargs.pop("cls", None) - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -110,13 +108,9 @@ async def list_by_service( deserialized = self._deserialize("[NetworkStatusContractByLocation]", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/networkstatus" - } + return deserialized # type: ignore @distributed_trace_async async def list_by_location( @@ -134,7 +128,6 @@ async def list_by_location( :param location_name: Location in which the API Management service is deployed. This is one of the Azure Regions like West US, East US, South Central US. Required. :type location_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkStatusContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.NetworkStatusContract :raises ~azure.core.exceptions.HttpResponseError: @@ -153,22 +146,21 @@ async def list_by_location( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NetworkStatusContract] = kwargs.pop("cls", None) - request = build_list_by_location_request( + _request = build_list_by_location_request( resource_group_name=resource_group_name, service_name=service_name, location_name=location_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_location.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -181,10 +173,6 @@ async def list_by_location( deserialized = self._deserialize("NetworkStatusContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_by_location.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/locations/{locationName}/networkstatus" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_operations.py index e6b6339466e0..32518cdedc6a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -78,7 +78,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NotificationContract or the result of cls(response) :rtype: @@ -102,19 +101,18 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -126,13 +124,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("NotificationCollection", pipeline_response) @@ -142,11 +140,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -159,10 +157,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications" - } - @distributed_trace_async async def get( self, @@ -183,7 +177,6 @@ async def get( "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage", "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required. :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName - :keyword callable cls: A custom type or function that will be passed the direct response :return: NotificationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.NotificationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -202,22 +195,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NotificationContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -230,13 +222,9 @@ async def get( deserialized = self._deserialize("NotificationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}" - } + return deserialized # type: ignore @distributed_trace_async async def create_or_update( @@ -262,7 +250,6 @@ async def create_or_update( :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NotificationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.NotificationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -281,23 +268,22 @@ async def create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NotificationContract] = kwargs.pop("cls", None) - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -310,10 +296,6 @@ async def create_or_update( deserialized = self._deserialize("NotificationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_recipient_email_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_recipient_email_operations.py index 50e06047b3ce..9525272c57b7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_recipient_email_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_recipient_email_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -76,7 +76,6 @@ async def list_by_notification( "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage", "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required. :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName - :keyword callable cls: A custom type or function that will be passed the direct response :return: RecipientEmailCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.RecipientEmailCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -95,22 +94,21 @@ async def list_by_notification( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecipientEmailCollection] = kwargs.pop("cls", None) - request = build_list_by_notification_request( + _request = build_list_by_notification_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_notification.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -123,13 +121,9 @@ async def list_by_notification( deserialized = self._deserialize("RecipientEmailCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_by_notification.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails" - } + return deserialized # type: ignore @distributed_trace_async async def check_entity_exists( @@ -154,7 +148,6 @@ async def check_entity_exists( :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName :param email: Email identifier. Required. :type email: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -173,23 +166,22 @@ async def check_entity_exists( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_check_entity_exists_request( + _request = build_check_entity_exists_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, email=email, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.check_entity_exists.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -200,13 +192,9 @@ async def check_entity_exists( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 - check_entity_exists.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}" - } - @distributed_trace_async async def create_or_update( self, @@ -230,7 +218,6 @@ async def create_or_update( :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName :param email: Email identifier. Required. :type email: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RecipientEmailContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.RecipientEmailContract :raises ~azure.core.exceptions.HttpResponseError: @@ -249,23 +236,22 @@ async def create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecipientEmailContract] = kwargs.pop("cls", None) - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, email=email, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -286,10 +272,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, @@ -313,7 +295,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName :param email: Email identifier. Required. :type email: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -332,23 +313,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, email=email, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -359,8 +339,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_recipient_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_recipient_user_operations.py index 8abfd5f3717d..6e3db7b28d5c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_recipient_user_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_recipient_user_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -76,7 +76,6 @@ async def list_by_notification( "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage", "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required. :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName - :keyword callable cls: A custom type or function that will be passed the direct response :return: RecipientUserCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.RecipientUserCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -95,22 +94,21 @@ async def list_by_notification( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecipientUserCollection] = kwargs.pop("cls", None) - request = build_list_by_notification_request( + _request = build_list_by_notification_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_notification.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -123,13 +121,9 @@ async def list_by_notification( deserialized = self._deserialize("RecipientUserCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_by_notification.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers" - } + return deserialized # type: ignore @distributed_trace_async async def check_entity_exists( @@ -155,7 +149,6 @@ async def check_entity_exists( :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -174,23 +167,22 @@ async def check_entity_exists( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_check_entity_exists_request( + _request = build_check_entity_exists_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.check_entity_exists.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -201,13 +193,9 @@ async def check_entity_exists( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 - check_entity_exists.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}" - } - @distributed_trace_async async def create_or_update( self, @@ -232,7 +220,6 @@ async def create_or_update( :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RecipientUserContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.RecipientUserContract :raises ~azure.core.exceptions.HttpResponseError: @@ -251,23 +238,22 @@ async def create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecipientUserContract] = kwargs.pop("cls", None) - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -288,10 +274,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, @@ -316,7 +298,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -335,23 +316,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -362,8 +342,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_open_id_connect_provider_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_open_id_connect_provider_operations.py index 263a613ed53a..581718936e7f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_open_id_connect_provider_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_open_id_connect_provider_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -89,7 +90,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OpenidConnectProviderContract or the result of cls(response) :rtype: @@ -113,7 +113,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -121,12 +121,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -138,13 +137,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("OpenIdConnectProviderCollection", pipeline_response) @@ -154,11 +153,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -171,10 +170,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders" - } - @distributed_trace_async async def get_entity_tag(self, resource_group_name: str, service_name: str, opid: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the openIdConnectProvider specified by its identifier. @@ -186,7 +181,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, opid :type service_name: str :param opid: Identifier of the OpenID Connect Provider. Required. :type opid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -205,22 +199,21 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, opid api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, opid=opid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,13 +227,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, opid response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, opid: str, **kwargs: Any @@ -254,7 +243,6 @@ async def get( :type service_name: str :param opid: Identifier of the OpenID Connect Provider. Required. :type opid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OpenidConnectProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -273,22 +261,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OpenidConnectProviderContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, opid=opid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -304,13 +291,9 @@ async def get( deserialized = self._deserialize("OpenidConnectProviderContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -341,7 +324,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OpenidConnectProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -353,7 +335,7 @@ async def create_or_update( resource_group_name: str, service_name: str, opid: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -369,14 +351,13 @@ async def create_or_update( :param opid: Identifier of the OpenID Connect Provider. Required. :type opid: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OpenidConnectProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -388,7 +369,7 @@ async def create_or_update( resource_group_name: str, service_name: str, opid: str, - parameters: Union[_models.OpenidConnectProviderContract, IO], + parameters: Union[_models.OpenidConnectProviderContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.OpenidConnectProviderContract: @@ -401,16 +382,12 @@ async def create_or_update( :type service_name: str :param opid: Identifier of the OpenID Connect Provider. Required. :type opid: str - :param parameters: Create parameters. Is either a OpenidConnectProviderContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract or IO + :param parameters: Create parameters. Is either a OpenidConnectProviderContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OpenidConnectProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -433,12 +410,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "OpenidConnectProviderContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, opid=opid, @@ -448,16 +425,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -483,10 +459,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" - } - @overload async def update( self, @@ -516,7 +488,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OpenidConnectProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -529,7 +500,7 @@ async def update( service_name: str, opid: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -547,11 +518,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: OpenidConnectProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -564,7 +534,7 @@ async def update( service_name: str, opid: str, if_match: str, - parameters: Union[_models.OpenidConnectProviderUpdateContract, IO], + parameters: Union[_models.OpenidConnectProviderUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.OpenidConnectProviderContract: """Updates the specific OpenID Connect Provider. @@ -580,12 +550,9 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Is either a OpenidConnectProviderUpdateContract type or a - IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.OpenidConnectProviderUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.OpenidConnectProviderUpdateContract or + IO[bytes] :return: OpenidConnectProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -608,12 +575,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "OpenidConnectProviderUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, opid=opid, @@ -623,16 +590,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -648,13 +614,9 @@ async def update( deserialized = self._deserialize("OpenidConnectProviderContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -672,7 +634,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -691,23 +652,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, opid=opid, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -718,11 +678,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def list_secrets( @@ -737,7 +693,6 @@ async def list_secrets( :type service_name: str :param opid: Identifier of the OpenID Connect Provider. Required. :type opid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ClientSecretContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ClientSecretContract :raises ~azure.core.exceptions.HttpResponseError: @@ -756,22 +711,21 @@ async def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClientSecretContract] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, service_name=service_name, opid=opid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -787,10 +741,6 @@ async def list_secrets( deserialized = self._deserialize("ClientSecretContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_operation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_operation_operations.py index 6949bbe89ffe..8d098e3e845b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_operation_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_operation_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -91,7 +91,6 @@ def list_by_tags( :type skip: int :param include_not_tagged_operations: Include not tagged Operations. Default value is None. :type include_not_tagged_operations: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TagResourceContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagResourceContract] @@ -114,7 +113,7 @@ def list_by_tags( def prepare_request(next_link=None): if not next_link: - request = build_list_by_tags_request( + _request = build_list_by_tags_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -124,12 +123,11 @@ def prepare_request(next_link=None): skip=skip, include_not_tagged_operations=include_not_tagged_operations, api_version=api_version, - template_url=self.list_by_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -141,13 +139,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("TagResourceCollection", pipeline_response) @@ -157,11 +155,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -173,7 +171,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operationsByTags" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_outbound_network_dependencies_endpoints_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_outbound_network_dependencies_endpoints_operations.py index 7390ab261d1f..d8b835cf8b2b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_outbound_network_dependencies_endpoints_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_outbound_network_dependencies_endpoints_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,7 +32,7 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class OutboundNetworkDependenciesEndpointsOperations: +class OutboundNetworkDependenciesEndpointsOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -62,7 +62,6 @@ async def list_by_service( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OutboundEnvironmentEndpointList or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OutboundEnvironmentEndpointList :raises ~azure.core.exceptions.HttpResponseError: @@ -81,21 +80,20 @@ async def list_by_service( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OutboundEnvironmentEndpointList] = kwargs.pop("cls", None) - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -108,10 +106,6 @@ async def list_by_service( deserialized = self._deserialize("OutboundEnvironmentEndpointList", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/outboundNetworkDependenciesEndpoints" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_description_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_description_operations.py index 032f5020c0b1..14d5e699a480 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_description_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_description_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -69,7 +69,6 @@ async def list_by_service( :param scope: Policy scope. Known values are: "Tenant", "Product", "Api", "Operation", and "All". Default value is None. :type scope: str or ~azure.mgmt.apimanagement.models.PolicyScopeContract - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyDescriptionCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyDescriptionCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -88,22 +87,21 @@ async def list_by_service( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyDescriptionCollection] = kwargs.pop("cls", None) - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, scope=scope, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -116,10 +114,6 @@ async def list_by_service( deserialized = self._deserialize("PolicyDescriptionCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyDescriptions" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_fragment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_fragment_operations.py index deee5de871a1..7b333551dae6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_fragment_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_fragment_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -91,7 +92,6 @@ async def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyFragmentCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyFragmentCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -110,7 +110,7 @@ async def list_by_service( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyFragmentCollection] = kwargs.pop("cls", None) - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -119,16 +119,15 @@ async def list_by_service( top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -141,13 +140,9 @@ async def list_by_service( deserialized = self._deserialize("PolicyFragmentCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments" - } + return deserialized # type: ignore @distributed_trace_async async def get_entity_tag(self, resource_group_name: str, service_name: str, id: str, **kwargs: Any) -> bool: @@ -160,7 +155,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, id: :type service_name: str :param id: A resource identifier. Required. :type id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -179,22 +173,21 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, id: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, id=id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -208,13 +201,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, id: response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" - } - @distributed_trace_async async def get( self, @@ -236,7 +225,6 @@ async def get( :param format: Policy fragment content format. Known values are: "xml" and "rawxml". Default value is None. :type format: str or ~azure.mgmt.apimanagement.models.PolicyFragmentContentFormat - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyFragmentContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyFragmentContract :raises ~azure.core.exceptions.HttpResponseError: @@ -255,23 +243,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyFragmentContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, id=id, subscription_id=self._config.subscription_id, format=format, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -287,20 +274,16 @@ async def get( deserialized = self._deserialize("PolicyFragmentContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, service_name: str, id: str, - parameters: Union[_models.PolicyFragmentContract, IO], + parameters: Union[_models.PolicyFragmentContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> Optional[_models.PolicyFragmentContract]: @@ -322,12 +305,12 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PolicyFragmentContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, id=id, @@ -337,16 +320,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -372,13 +354,9 @@ async def _create_or_update_initial( response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -409,14 +387,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PolicyFragmentContract or the result of cls(response) :rtype: @@ -430,7 +400,7 @@ async def begin_create_or_update( resource_group_name: str, service_name: str, id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -446,21 +416,13 @@ async def begin_create_or_update( :param id: A resource identifier. Required. :type id: str :param parameters: The policy fragment contents to apply. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PolicyFragmentContract or the result of cls(response) :rtype: @@ -474,7 +436,7 @@ async def begin_create_or_update( resource_group_name: str, service_name: str, id: str, - parameters: Union[_models.PolicyFragmentContract, IO], + parameters: Union[_models.PolicyFragmentContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> AsyncLROPoller[_models.PolicyFragmentContract]: @@ -488,22 +450,11 @@ async def begin_create_or_update( :param id: A resource identifier. Required. :type id: str :param parameters: The policy fragment contents to apply. Is either a PolicyFragmentContract - type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.PolicyFragmentContract or IO + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PolicyFragmentContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PolicyFragmentContract or the result of cls(response) :rtype: @@ -542,7 +493,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("PolicyFragmentContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -554,17 +505,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PolicyFragmentContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" - } + return AsyncLROPoller[_models.PolicyFragmentContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -582,7 +531,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -601,23 +549,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, id=id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -628,11 +575,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def list_references( @@ -657,7 +600,6 @@ async def list_references( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: ResourceCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ResourceCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -676,7 +618,7 @@ async def list_references( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceCollection] = kwargs.pop("cls", None) - request = build_list_references_request( + _request = build_list_references_request( resource_group_name=resource_group_name, service_name=service_name, id=id, @@ -684,16 +626,15 @@ async def list_references( top=top, skip=skip, api_version=api_version, - template_url=self.list_references.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -706,10 +647,6 @@ async def list_references( deserialized = self._deserialize("ResourceCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_references.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}/listReferences" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_operations.py index d96b3603f7df..3577a75500f8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -68,7 +69,6 @@ async def list_by_service( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -87,21 +87,20 @@ async def list_by_service( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None) - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -114,13 +113,9 @@ async def list_by_service( deserialized = self._deserialize("PolicyCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies" - } + return deserialized # type: ignore @distributed_trace_async async def get_entity_tag( @@ -136,7 +131,6 @@ async def get_entity_tag( :type service_name: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -155,22 +149,21 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, policy_id=policy_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -184,13 +177,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}" - } - @distributed_trace_async async def get( self, @@ -212,7 +201,6 @@ async def get( :param format: Policy Export Format. Known values are: "xml" and "rawxml". Default value is "xml". :type format: str or ~azure.mgmt.apimanagement.models.PolicyExportFormat - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -231,23 +219,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, policy_id=policy_id, subscription_id=self._config.subscription_id, format=format, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -263,13 +250,9 @@ async def get( deserialized = self._deserialize("PolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -300,7 +283,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -312,7 +294,7 @@ async def create_or_update( resource_group_name: str, service_name: str, policy_id: Union[str, _models.PolicyIdName], - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -328,14 +310,13 @@ async def create_or_update( :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName :param parameters: The policy contents to apply. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -347,7 +328,7 @@ async def create_or_update( resource_group_name: str, service_name: str, policy_id: Union[str, _models.PolicyIdName], - parameters: Union[_models.PolicyContract, IO], + parameters: Union[_models.PolicyContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.PolicyContract: @@ -360,16 +341,12 @@ async def create_or_update( :type service_name: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO + :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -392,12 +369,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PolicyContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, policy_id=policy_id, @@ -407,16 +384,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -442,10 +418,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, @@ -467,7 +439,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -486,23 +457,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, policy_id=policy_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -513,8 +483,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_config_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_config_operations.py index e82f6e989b99..6e9b65e0193d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_config_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_config_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -68,7 +69,6 @@ async def list_by_service( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalConfigCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalConfigCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -87,21 +87,20 @@ async def list_by_service( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PortalConfigCollection] = kwargs.pop("cls", None) - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -114,13 +113,9 @@ async def list_by_service( deserialized = self._deserialize("PortalConfigCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs" - } + return deserialized # type: ignore @distributed_trace_async async def get_entity_tag( @@ -135,7 +130,6 @@ async def get_entity_tag( :type service_name: str :param portal_config_id: Portal configuration identifier. Required. :type portal_config_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -154,22 +148,21 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, portal_config_id=portal_config_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,13 +176,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, portal_config_id: str, **kwargs: Any @@ -203,7 +192,6 @@ async def get( :type service_name: str :param portal_config_id: Portal configuration identifier. Required. :type portal_config_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalConfigContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract :raises ~azure.core.exceptions.HttpResponseError: @@ -222,22 +210,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PortalConfigContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, portal_config_id=portal_config_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -253,13 +240,9 @@ async def get( deserialized = self._deserialize("PortalConfigContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}" - } + return deserialized # type: ignore @overload async def update( @@ -290,7 +273,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalConfigContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract :raises ~azure.core.exceptions.HttpResponseError: @@ -303,7 +285,7 @@ async def update( service_name: str, portal_config_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -321,11 +303,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update the developer portal configuration. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalConfigContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract :raises ~azure.core.exceptions.HttpResponseError: @@ -338,7 +319,7 @@ async def update( service_name: str, portal_config_id: str, if_match: str, - parameters: Union[_models.PortalConfigContract, IO], + parameters: Union[_models.PortalConfigContract, IO[bytes]], **kwargs: Any ) -> _models.PortalConfigContract: """Update the developer portal configuration. @@ -354,12 +335,8 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update the developer portal configuration. Is either a PortalConfigContract - type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalConfigContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalConfigContract or IO[bytes] :return: PortalConfigContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract :raises ~azure.core.exceptions.HttpResponseError: @@ -382,12 +359,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalConfigContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, portal_config_id=portal_config_id, @@ -397,16 +374,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -419,13 +395,9 @@ async def update( deserialized = self._deserialize("PortalConfigContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -456,7 +428,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalConfigContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract :raises ~azure.core.exceptions.HttpResponseError: @@ -469,7 +440,7 @@ async def create_or_update( service_name: str, portal_config_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -487,11 +458,10 @@ async def create_or_update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update the developer portal configuration. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalConfigContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract :raises ~azure.core.exceptions.HttpResponseError: @@ -504,7 +474,7 @@ async def create_or_update( service_name: str, portal_config_id: str, if_match: str, - parameters: Union[_models.PortalConfigContract, IO], + parameters: Union[_models.PortalConfigContract, IO[bytes]], **kwargs: Any ) -> _models.PortalConfigContract: """Create or update the developer portal configuration. @@ -520,12 +490,8 @@ async def create_or_update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update the developer portal configuration. Is either a PortalConfigContract - type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalConfigContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalConfigContract or IO[bytes] :return: PortalConfigContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract :raises ~azure.core.exceptions.HttpResponseError: @@ -548,12 +514,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalConfigContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, portal_config_id=portal_config_id, @@ -563,16 +529,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -585,10 +550,6 @@ async def create_or_update( deserialized = self._deserialize("PortalConfigContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_revision_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_revision_operations.py index fb55aa5e9abf..f0c549b59fd3 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_revision_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_revision_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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 @@ -96,7 +97,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PortalRevisionContract or the result of cls(response) :rtype: @@ -120,7 +120,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -128,12 +128,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -145,13 +144,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("PortalRevisionCollection", pipeline_response) @@ -161,11 +160,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -178,10 +177,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, portal_revision_id: str, **kwargs: Any @@ -196,7 +191,6 @@ async def get_entity_tag( :param portal_revision_id: Portal revision identifier. Must be unique in the current API Management service instance. Required. :type portal_revision_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -215,22 +209,21 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, portal_revision_id=portal_revision_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -244,13 +237,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, portal_revision_id: str, **kwargs: Any @@ -265,7 +254,6 @@ async def get( :param portal_revision_id: Portal revision identifier. Must be unique in the current API Management service instance. Required. :type portal_revision_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalRevisionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalRevisionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -284,22 +272,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PortalRevisionContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, portal_revision_id=portal_revision_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -315,20 +302,16 @@ async def get( deserialized = self._deserialize("PortalRevisionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, service_name: str, portal_revision_id: str, - parameters: Union[_models.PortalRevisionContract, IO], + parameters: Union[_models.PortalRevisionContract, IO[bytes]], **kwargs: Any ) -> Optional[_models.PortalRevisionContract]: error_map = { @@ -349,12 +332,12 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalRevisionContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, portal_revision_id=portal_revision_id, @@ -363,16 +346,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -390,13 +372,9 @@ async def _create_or_update_initial( deserialized = self._deserialize("PortalRevisionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -425,14 +403,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PortalRevisionContract or the result of cls(response) :rtype: @@ -446,7 +416,7 @@ async def begin_create_or_update( resource_group_name: str, service_name: str, portal_revision_id: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -463,18 +433,10 @@ async def begin_create_or_update( Management service instance. Required. :type portal_revision_id: str :param parameters: Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PortalRevisionContract or the result of cls(response) :rtype: @@ -488,7 +450,7 @@ async def begin_create_or_update( resource_group_name: str, service_name: str, portal_revision_id: str, - parameters: Union[_models.PortalRevisionContract, IO], + parameters: Union[_models.PortalRevisionContract, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PortalRevisionContract]: """Creates a new developer portal's revision by running the portal's publishing. The ``isCurrent`` @@ -502,19 +464,8 @@ async def begin_create_or_update( :param portal_revision_id: Portal revision identifier. Must be unique in the current API Management service instance. Required. :type portal_revision_id: str - :param parameters: Is either a PortalRevisionContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalRevisionContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Is either a PortalRevisionContract type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalRevisionContract or IO[bytes] :return: An instance of AsyncLROPoller that returns either PortalRevisionContract or the result of cls(response) :rtype: @@ -552,7 +503,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("PortalRevisionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -564,17 +515,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PortalRevisionContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" - } + return AsyncLROPoller[_models.PortalRevisionContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, @@ -582,7 +531,7 @@ async def _update_initial( service_name: str, portal_revision_id: str, if_match: str, - parameters: Union[_models.PortalRevisionContract, IO], + parameters: Union[_models.PortalRevisionContract, IO[bytes]], **kwargs: Any ) -> Optional[_models.PortalRevisionContract]: error_map = { @@ -603,12 +552,12 @@ async def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalRevisionContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, portal_revision_id=portal_revision_id, @@ -618,16 +567,15 @@ async def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -645,13 +593,9 @@ async def _update_initial( deserialized = self._deserialize("PortalRevisionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -683,14 +627,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PortalRevisionContract or the result of cls(response) :rtype: @@ -705,7 +641,7 @@ async def begin_update( service_name: str, portal_revision_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -724,18 +660,10 @@ async def begin_update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PortalRevisionContract or the result of cls(response) :rtype: @@ -750,7 +678,7 @@ async def begin_update( service_name: str, portal_revision_id: str, if_match: str, - parameters: Union[_models.PortalRevisionContract, IO], + parameters: Union[_models.PortalRevisionContract, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PortalRevisionContract]: """Updates the description of specified portal revision or makes it current. @@ -766,19 +694,8 @@ async def begin_update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Is either a PortalRevisionContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalRevisionContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Is either a PortalRevisionContract type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalRevisionContract or IO[bytes] :return: An instance of AsyncLROPoller that returns either PortalRevisionContract or the result of cls(response) :rtype: @@ -817,7 +734,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("PortalRevisionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -829,14 +746,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PortalRevisionContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" - } + return AsyncLROPoller[_models.PortalRevisionContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_settings_operations.py index 5e4f4d6718ee..77c5fd150ed8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_settings_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -62,7 +62,6 @@ async def list_by_service( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSettingsCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSettingsCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -81,21 +80,20 @@ async def list_by_service( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PortalSettingsCollection] = kwargs.pop("cls", None) - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -108,10 +106,6 @@ async def list_by_service( deserialized = self._deserialize("PortalSettingsCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_private_endpoint_connection_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_private_endpoint_connection_operations.py index 2908d03a1f91..03f3dee131ef 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_private_endpoint_connection_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_private_endpoint_connection_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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 @@ -74,7 +75,6 @@ def list_by_service( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -98,17 +98,16 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -120,13 +119,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("PrivateEndpointConnectionListResult", pipeline_response) @@ -136,11 +135,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -153,10 +152,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections" - } - @distributed_trace_async async def get_by_name( self, resource_group_name: str, service_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -170,7 +165,6 @@ async def get_by_name( :type service_name: str :param private_endpoint_connection_name: Name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: @@ -189,22 +183,21 @@ async def get_by_name( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_by_name_request( + _request = build_get_by_name_request( resource_group_name=resource_group_name, service_name=service_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_name.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -217,20 +210,16 @@ async def get_by_name( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_by_name.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, service_name: str, private_endpoint_connection_name: str, - private_endpoint_connection_request: Union[_models.PrivateEndpointConnectionRequest, IO], + private_endpoint_connection_request: Union[_models.PrivateEndpointConnectionRequest, IO[bytes]], **kwargs: Any ) -> Optional[_models.PrivateEndpointConnection]: error_map = { @@ -251,12 +240,12 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(private_endpoint_connection_request, (IO, bytes)): + if isinstance(private_endpoint_connection_request, (IOBase, bytes)): _content = private_endpoint_connection_request else: _json = self._serialize.body(private_endpoint_connection_request, "PrivateEndpointConnectionRequest") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -265,16 +254,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -289,13 +277,9 @@ async def _create_or_update_initial( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -323,14 +307,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -344,7 +320,7 @@ async def begin_create_or_update( resource_group_name: str, service_name: str, private_endpoint_connection_name: str, - private_endpoint_connection_request: IO, + private_endpoint_connection_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -359,18 +335,10 @@ async def begin_create_or_update( :param private_endpoint_connection_name: Name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection_request: Required. - :type private_endpoint_connection_request: IO + :type private_endpoint_connection_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -384,7 +352,7 @@ async def begin_create_or_update( resource_group_name: str, service_name: str, private_endpoint_connection_name: str, - private_endpoint_connection_request: Union[_models.PrivateEndpointConnectionRequest, IO], + private_endpoint_connection_request: Union[_models.PrivateEndpointConnectionRequest, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Creates a new Private Endpoint Connection or updates an existing one. @@ -397,20 +365,9 @@ async def begin_create_or_update( :param private_endpoint_connection_name: Name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection_request: Is either a PrivateEndpointConnectionRequest type - or a IO type. Required. + or a IO[bytes] type. Required. :type private_endpoint_connection_request: - ~azure.mgmt.apimanagement.models.PrivateEndpointConnectionRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ~azure.mgmt.apimanagement.models.PrivateEndpointConnectionRequest or IO[bytes] :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -444,7 +401,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -454,17 +411,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return AsyncLROPoller[_models.PrivateEndpointConnection]( + 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, service_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -483,22 +438,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -509,11 +463,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -528,14 +478,6 @@ async def begin_delete( :type service_name: str :param private_endpoint_connection_name: Name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -563,7 +505,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -572,17 +514,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def list_private_link_resources( @@ -595,7 +533,6 @@ async def list_private_link_resources( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResourceListResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: @@ -614,21 +551,20 @@ async def list_private_link_resources( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - request = build_list_private_link_resources_request( + _request = build_list_private_link_resources_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_private_link_resources.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -641,13 +577,9 @@ async def list_private_link_resources( deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_private_link_resources.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources" - } + return deserialized # type: ignore @distributed_trace_async async def get_private_link_resource( @@ -662,7 +594,6 @@ async def get_private_link_resource( :type service_name: str :param private_link_sub_resource_name: Name of the private link resource. Required. :type private_link_sub_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PrivateLinkResource :raises ~azure.core.exceptions.HttpResponseError: @@ -681,22 +612,21 @@ async def get_private_link_resource( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - request = build_get_private_link_resource_request( + _request = build_get_private_link_resource_request( resource_group_name=resource_group_name, service_name=service_name, private_link_sub_resource_name=private_link_sub_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_private_link_resource.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -709,10 +639,6 @@ async def get_private_link_resource( deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_private_link_resource.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources/{privateLinkSubResourceName}" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_api_operations.py index 2ca42cfa626a..1cf613ff7711 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_api_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_api_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -93,7 +93,6 @@ def list_by_product( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -115,7 +114,7 @@ def list_by_product( def prepare_request(next_link=None): if not next_link: - request = build_list_by_product_request( + _request = build_list_by_product_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -124,12 +123,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -141,13 +139,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ApiCollection", pipeline_response) @@ -157,11 +155,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -174,10 +172,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis" - } - @distributed_trace_async async def check_entity_exists( self, resource_group_name: str, service_name: str, product_id: str, api_id: str, **kwargs: Any @@ -195,7 +189,6 @@ async def check_entity_exists( :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -214,23 +207,22 @@ async def check_entity_exists( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_check_entity_exists_request( + _request = build_check_entity_exists_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.check_entity_exists.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -241,13 +233,9 @@ async def check_entity_exists( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 - check_entity_exists.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}" - } - @distributed_trace_async async def create_or_update( self, resource_group_name: str, service_name: str, product_id: str, api_id: str, **kwargs: Any @@ -265,7 +253,6 @@ async def create_or_update( :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -284,23 +271,22 @@ async def create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApiContract] = kwargs.pop("cls", None) - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -321,10 +307,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, product_id: str, api_id: str, **kwargs: Any @@ -342,7 +324,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -361,23 +342,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -388,8 +368,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_group_operations.py index a2c0cb5547e2..eb6e7f7ff8a3 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_group_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_group_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -89,7 +89,6 @@ def list_by_product( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GroupContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GroupContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -111,7 +110,7 @@ def list_by_product( def prepare_request(next_link=None): if not next_link: - request = build_list_by_product_request( + _request = build_list_by_product_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -120,12 +119,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -137,13 +135,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("GroupCollection", pipeline_response) @@ -153,11 +151,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -170,10 +168,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups" - } - @distributed_trace_async async def check_entity_exists( self, resource_group_name: str, service_name: str, product_id: str, group_id: str, **kwargs: Any @@ -191,7 +185,6 @@ async def check_entity_exists( :param group_id: Group identifier. Must be unique in the current API Management service instance. Required. :type group_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -210,23 +203,22 @@ async def check_entity_exists( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_check_entity_exists_request( + _request = build_check_entity_exists_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, group_id=group_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.check_entity_exists.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,13 +229,9 @@ async def check_entity_exists( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 - check_entity_exists.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}" - } - @distributed_trace_async async def create_or_update( self, resource_group_name: str, service_name: str, product_id: str, group_id: str, **kwargs: Any @@ -261,7 +249,6 @@ async def create_or_update( :param group_id: Group identifier. Must be unique in the current API Management service instance. Required. :type group_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GroupContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GroupContract :raises ~azure.core.exceptions.HttpResponseError: @@ -280,23 +267,22 @@ async def create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GroupContract] = kwargs.pop("cls", None) - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, group_id=group_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -317,10 +303,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, product_id: str, group_id: str, **kwargs: Any @@ -338,7 +320,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param group_id: Group identifier. Must be unique in the current API Management service instance. Required. :type group_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -357,23 +338,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, group_id=group_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -384,8 +364,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_operations.py index 114034b4a903..895e92a68c2b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -99,7 +100,6 @@ def list_by_service( :type expand_groups: bool :param tags: Products which are part of a specific tag. Default value is None. :type tags: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProductContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ProductContract] @@ -122,7 +122,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -132,12 +132,11 @@ def prepare_request(next_link=None): expand_groups=expand_groups, tags=tags, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -149,13 +148,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ProductCollection", pipeline_response) @@ -165,11 +164,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -182,10 +181,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products" - } - @distributed_trace_async async def get_entity_tag(self, resource_group_name: str, service_name: str, product_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the product specified by its identifier. @@ -198,7 +193,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, prod :param product_id: Product identifier. Must be unique in the current API Management service instance. Required. :type product_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -217,22 +211,21 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, prod api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,13 +239,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, prod response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, product_id: str, **kwargs: Any @@ -267,7 +256,6 @@ async def get( :param product_id: Product identifier. Must be unique in the current API Management service instance. Required. :type product_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ProductContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ProductContract :raises ~azure.core.exceptions.HttpResponseError: @@ -286,22 +274,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProductContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -317,13 +304,9 @@ async def get( deserialized = self._deserialize("ProductContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -355,7 +338,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ProductContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ProductContract :raises ~azure.core.exceptions.HttpResponseError: @@ -367,7 +349,7 @@ async def create_or_update( resource_group_name: str, service_name: str, product_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -384,14 +366,13 @@ async def create_or_update( instance. Required. :type product_id: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ProductContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ProductContract :raises ~azure.core.exceptions.HttpResponseError: @@ -403,7 +384,7 @@ async def create_or_update( resource_group_name: str, service_name: str, product_id: str, - parameters: Union[_models.ProductContract, IO], + parameters: Union[_models.ProductContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.ProductContract: @@ -417,16 +398,12 @@ async def create_or_update( :param product_id: Product identifier. Must be unique in the current API Management service instance. Required. :type product_id: str - :param parameters: Create or update parameters. Is either a ProductContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.ProductContract or IO + :param parameters: Create or update parameters. Is either a ProductContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ProductContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ProductContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ProductContract :raises ~azure.core.exceptions.HttpResponseError: @@ -449,12 +426,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ProductContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -464,16 +441,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -499,10 +475,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" - } - @overload async def update( self, @@ -533,7 +505,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ProductContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ProductContract :raises ~azure.core.exceptions.HttpResponseError: @@ -546,7 +517,7 @@ async def update( service_name: str, product_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -565,11 +536,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: ProductContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ProductContract :raises ~azure.core.exceptions.HttpResponseError: @@ -582,7 +552,7 @@ async def update( service_name: str, product_id: str, if_match: str, - parameters: Union[_models.ProductUpdateParameters, IO], + parameters: Union[_models.ProductUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.ProductContract: """Update existing product details. @@ -598,13 +568,9 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a ProductUpdateParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.ProductUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a ProductUpdateParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ProductUpdateParameters or IO[bytes] :return: ProductContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ProductContract :raises ~azure.core.exceptions.HttpResponseError: @@ -627,12 +593,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ProductUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -642,16 +608,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -667,13 +632,9 @@ async def update( deserialized = self._deserialize("ProductContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -701,7 +662,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param delete_subscriptions: Delete existing subscriptions associated with the product or not. Default value is None. :type delete_subscriptions: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -720,7 +680,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -728,16 +688,15 @@ async def delete( # pylint: disable=inconsistent-return-statements if_match=if_match, delete_subscriptions=delete_subscriptions, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -748,11 +707,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_by_tags( @@ -787,7 +742,6 @@ def list_by_tags( :type skip: int :param include_not_tagged_products: Include not tagged Products. Default value is None. :type include_not_tagged_products: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TagResourceContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagResourceContract] @@ -810,7 +764,7 @@ def list_by_tags( def prepare_request(next_link=None): if not next_link: - request = build_list_by_tags_request( + _request = build_list_by_tags_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -819,12 +773,11 @@ def prepare_request(next_link=None): skip=skip, include_not_tagged_products=include_not_tagged_products, api_version=api_version, - template_url=self.list_by_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -836,13 +789,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("TagResourceCollection", pipeline_response) @@ -852,11 +805,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -868,7 +821,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/productsByTags" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_policy_operations.py index 98c695d56231..b5b309742b0a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_policy_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -71,7 +72,6 @@ async def list_by_product( :param product_id: Product identifier. Must be unique in the current API Management service instance. Required. :type product_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -90,22 +90,21 @@ async def list_by_product( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None) - request = build_list_by_product_request( + _request = build_list_by_product_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -118,13 +117,9 @@ async def list_by_product( deserialized = self._deserialize("PolicyCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies" - } + return deserialized # type: ignore @distributed_trace_async async def get_entity_tag( @@ -147,7 +142,6 @@ async def get_entity_tag( :type product_id: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -166,23 +160,22 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, policy_id=policy_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -196,13 +189,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}" - } - @distributed_trace_async async def get( self, @@ -228,7 +217,6 @@ async def get( :param format: Policy Export Format. Known values are: "xml" and "rawxml". Default value is "xml". :type format: str or ~azure.mgmt.apimanagement.models.PolicyExportFormat - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -247,7 +235,7 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -255,16 +243,15 @@ async def get( subscription_id=self._config.subscription_id, format=format, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -280,13 +267,9 @@ async def get( deserialized = self._deserialize("PolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -321,7 +304,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -334,7 +316,7 @@ async def create_or_update( service_name: str, product_id: str, policy_id: Union[str, _models.PolicyIdName], - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -353,14 +335,13 @@ async def create_or_update( :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName :param parameters: The policy contents to apply. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -373,7 +354,7 @@ async def create_or_update( service_name: str, product_id: str, policy_id: Union[str, _models.PolicyIdName], - parameters: Union[_models.PolicyContract, IO], + parameters: Union[_models.PolicyContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.PolicyContract: @@ -389,16 +370,12 @@ async def create_or_update( :type product_id: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO + :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -421,12 +398,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PolicyContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -437,16 +414,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -472,10 +448,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, @@ -501,7 +473,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -520,7 +491,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -528,16 +499,15 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -548,8 +518,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_subscriptions_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_subscriptions_operations.py index e350e8396346..d14ab1fb3888 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_subscriptions_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_subscriptions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -90,7 +90,6 @@ def list( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SubscriptionContract or the result of cls(response) :rtype: @@ -114,7 +113,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -123,12 +122,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -140,13 +138,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("SubscriptionCollection", pipeline_response) @@ -156,11 +154,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -172,7 +170,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/subscriptions" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wiki_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wiki_operations.py index e616224e66f4..a3ca08f65521 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wiki_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wiki_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -69,7 +70,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, prod :param product_id: Product identifier. Must be unique in the current API Management service instance. Required. :type product_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -88,22 +88,21 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, prod api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -117,13 +116,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, prod response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, product_id: str, **kwargs: Any @@ -138,7 +133,6 @@ async def get( :param product_id: Product identifier. Must be unique in the current API Management service instance. Required. :type product_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -157,22 +151,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WikiContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,13 +181,9 @@ async def get( deserialized = self._deserialize("WikiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -226,7 +215,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -238,7 +226,7 @@ async def create_or_update( resource_group_name: str, service_name: str, product_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -255,14 +243,13 @@ async def create_or_update( instance. Required. :type product_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -274,7 +261,7 @@ async def create_or_update( resource_group_name: str, service_name: str, product_id: str, - parameters: Union[_models.WikiContract, IO], + parameters: Union[_models.WikiContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.WikiContract: @@ -288,15 +275,12 @@ async def create_or_update( :param product_id: Product identifier. Must be unique in the current API Management service instance. Required. :type product_id: str - :param parameters: Create parameters. Is either a WikiContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.WikiContract or IO + :param parameters: Create parameters. Is either a WikiContract type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.apimanagement.models.WikiContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -319,12 +303,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WikiContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -334,16 +318,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,10 +352,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" - } - @overload async def update( self, @@ -403,7 +382,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -416,7 +394,7 @@ async def update( service_name: str, product_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -435,11 +413,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Wiki Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -452,7 +429,7 @@ async def update( service_name: str, product_id: str, if_match: str, - parameters: Union[_models.WikiUpdateContract, IO], + parameters: Union[_models.WikiUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.WikiContract: """Updates the details of the Wiki for a Product specified by its identifier. @@ -468,13 +445,9 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Wiki Update parameters. Is either a WikiUpdateContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.WikiUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Wiki Update parameters. Is either a WikiUpdateContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.WikiUpdateContract or IO[bytes] :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -497,12 +470,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WikiUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -512,16 +485,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -537,13 +509,9 @@ async def update( deserialized = self._deserialize("WikiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -562,7 +530,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -581,23 +548,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -608,8 +574,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wikis_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wikis_operations.py index 898949cf5bf4..2c2606a23e70 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wikis_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wikis_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -82,7 +82,6 @@ def list( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WikiContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.WikiContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -104,7 +103,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -113,12 +112,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -130,13 +128,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("WikiCollection", pipeline_response) @@ -146,11 +144,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -162,7 +160,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_counter_keys_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_counter_keys_operations.py index 813f9c808f4d..ee0aeabcc296 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_counter_keys_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_counter_keys_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -72,7 +73,6 @@ async def list_by_service( counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key. Required. :type quota_counter_key: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: QuotaCounterCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.QuotaCounterCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -91,22 +91,21 @@ async def list_by_service( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.QuotaCounterCollection] = kwargs.pop("cls", None) - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, quota_counter_key=quota_counter_key, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -119,13 +118,9 @@ async def list_by_service( deserialized = self._deserialize("QuotaCounterCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}" - } + return deserialized # type: ignore @overload async def update( @@ -157,7 +152,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: QuotaCounterCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.QuotaCounterCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -169,7 +163,7 @@ async def update( resource_group_name: str, service_name: str, quota_counter_key: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -189,11 +183,10 @@ async def update( :type quota_counter_key: str :param parameters: The value of the quota counter to be applied to all quota counter periods. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: QuotaCounterCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.QuotaCounterCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -205,7 +198,7 @@ async def update( resource_group_name: str, service_name: str, quota_counter_key: str, - parameters: Union[_models.QuotaCounterValueUpdateContract, IO], + parameters: Union[_models.QuotaCounterValueUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.QuotaCounterCollection: """Updates all the quota counter values specified with the existing quota counter key to a value @@ -222,12 +215,8 @@ async def update( as counter-key="@("b"+"a")" then it will be accessible by "ba" key. Required. :type quota_counter_key: str :param parameters: The value of the quota counter to be applied to all quota counter periods. - Is either a QuotaCounterValueUpdateContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.QuotaCounterValueUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + Is either a QuotaCounterValueUpdateContract type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.QuotaCounterValueUpdateContract or IO[bytes] :return: QuotaCounterCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.QuotaCounterCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -250,12 +239,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "QuotaCounterValueUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, quota_counter_key=quota_counter_key, @@ -264,16 +253,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -286,10 +274,6 @@ async def update( deserialized = self._deserialize("QuotaCounterCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_period_keys_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_period_keys_operations.py index 893702243da0..93f162491d7e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_period_keys_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_period_keys_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -74,7 +75,6 @@ async def get( :type quota_counter_key: str :param quota_period_key: Quota period key identifier. Required. :type quota_period_key: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: QuotaCounterContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.QuotaCounterContract :raises ~azure.core.exceptions.HttpResponseError: @@ -93,23 +93,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.QuotaCounterContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, quota_counter_key=quota_counter_key, quota_period_key=quota_period_key, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -122,13 +121,9 @@ async def get( deserialized = self._deserialize("QuotaCounterContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}" - } + return deserialized # type: ignore @overload async def update( @@ -162,7 +157,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: QuotaCounterContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.QuotaCounterContract :raises ~azure.core.exceptions.HttpResponseError: @@ -175,7 +169,7 @@ async def update( service_name: str, quota_counter_key: str, quota_period_key: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -196,11 +190,10 @@ async def update( :type quota_period_key: str :param parameters: The value of the Quota counter to be applied on the specified period. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: QuotaCounterContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.QuotaCounterContract :raises ~azure.core.exceptions.HttpResponseError: @@ -213,7 +206,7 @@ async def update( service_name: str, quota_counter_key: str, quota_period_key: str, - parameters: Union[_models.QuotaCounterValueUpdateContract, IO], + parameters: Union[_models.QuotaCounterValueUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.QuotaCounterContract: """Updates an existing quota counter value in the specified service instance. @@ -231,12 +224,8 @@ async def update( :param quota_period_key: Quota period key identifier. Required. :type quota_period_key: str :param parameters: The value of the Quota counter to be applied on the specified period. Is - either a QuotaCounterValueUpdateContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.QuotaCounterValueUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + either a QuotaCounterValueUpdateContract type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.QuotaCounterValueUpdateContract or IO[bytes] :return: QuotaCounterContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.QuotaCounterContract :raises ~azure.core.exceptions.HttpResponseError: @@ -259,12 +248,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "QuotaCounterValueUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, quota_counter_key=quota_counter_key, @@ -274,16 +263,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -296,10 +284,6 @@ async def update( deserialized = self._deserialize("QuotaCounterContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_region_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_region_operations.py index bb848961c98d..2430035d6d73 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_region_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_region_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -64,7 +64,6 @@ def list_by_service( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegionContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.RegionContract] @@ -87,17 +86,16 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -109,13 +107,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("RegionListResult", pipeline_response) @@ -125,11 +123,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -141,7 +139,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/regions" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_reports_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_reports_operations.py index ddf2de919bc4..a9b25627e75c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_reports_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_reports_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -89,7 +89,6 @@ def list_by_api( :type skip: int :param orderby: OData order by query option. Default value is None. :type orderby: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportRecordContract or the result of cls(response) :rtype: @@ -113,7 +112,7 @@ def list_by_api( def prepare_request(next_link=None): if not next_link: - request = build_list_by_api_request( + _request = build_list_by_api_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -122,12 +121,11 @@ def prepare_request(next_link=None): skip=skip, orderby=orderby, api_version=api_version, - template_url=self.list_by_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -139,13 +137,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ReportCollection", pipeline_response) @@ -155,11 +153,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -172,10 +170,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byApi" - } - @distributed_trace def list_by_user( self, @@ -215,7 +209,6 @@ def list_by_user( :type skip: int :param orderby: OData order by query option. Default value is None. :type orderby: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportRecordContract or the result of cls(response) :rtype: @@ -239,7 +232,7 @@ def list_by_user( def prepare_request(next_link=None): if not next_link: - request = build_list_by_user_request( + _request = build_list_by_user_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -248,12 +241,11 @@ def prepare_request(next_link=None): skip=skip, orderby=orderby, api_version=api_version, - template_url=self.list_by_user.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -265,13 +257,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ReportCollection", pipeline_response) @@ -281,11 +273,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -298,10 +290,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_user.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byUser" - } - @distributed_trace def list_by_operation( self, @@ -341,7 +329,6 @@ def list_by_operation( :type skip: int :param orderby: OData order by query option. Default value is None. :type orderby: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportRecordContract or the result of cls(response) :rtype: @@ -365,7 +352,7 @@ def list_by_operation( def prepare_request(next_link=None): if not next_link: - request = build_list_by_operation_request( + _request = build_list_by_operation_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -374,12 +361,11 @@ def prepare_request(next_link=None): skip=skip, orderby=orderby, api_version=api_version, - template_url=self.list_by_operation.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -391,13 +377,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ReportCollection", pipeline_response) @@ -407,11 +393,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -424,10 +410,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_operation.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byOperation" - } - @distributed_trace def list_by_product( self, @@ -466,7 +448,6 @@ def list_by_product( :type skip: int :param orderby: OData order by query option. Default value is None. :type orderby: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportRecordContract or the result of cls(response) :rtype: @@ -490,7 +471,7 @@ def list_by_product( def prepare_request(next_link=None): if not next_link: - request = build_list_by_product_request( + _request = build_list_by_product_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -499,12 +480,11 @@ def prepare_request(next_link=None): skip=skip, orderby=orderby, api_version=api_version, - template_url=self.list_by_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -516,13 +496,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ReportCollection", pipeline_response) @@ -532,11 +512,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -549,10 +529,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byProduct" - } - @distributed_trace def list_by_geo( self, @@ -588,7 +564,6 @@ def list_by_geo( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportRecordContract or the result of cls(response) :rtype: @@ -612,7 +587,7 @@ def list_by_geo( def prepare_request(next_link=None): if not next_link: - request = build_list_by_geo_request( + _request = build_list_by_geo_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -620,12 +595,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_geo.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -637,13 +611,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ReportCollection", pipeline_response) @@ -653,11 +627,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -670,10 +644,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_geo.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byGeo" - } - @distributed_trace def list_by_subscription( self, @@ -712,7 +682,6 @@ def list_by_subscription( :type skip: int :param orderby: OData order by query option. Default value is None. :type orderby: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportRecordContract or the result of cls(response) :rtype: @@ -736,7 +705,7 @@ def list_by_subscription( def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -745,12 +714,11 @@ def prepare_request(next_link=None): skip=skip, orderby=orderby, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -762,13 +730,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ReportCollection", pipeline_response) @@ -778,11 +746,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -795,10 +763,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/bySubscription" - } - @distributed_trace def list_by_time( self, @@ -842,7 +806,6 @@ def list_by_time( :type skip: int :param orderby: OData order by query option. Default value is None. :type orderby: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportRecordContract or the result of cls(response) :rtype: @@ -866,7 +829,7 @@ def list_by_time( def prepare_request(next_link=None): if not next_link: - request = build_list_by_time_request( + _request = build_list_by_time_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -876,12 +839,11 @@ def prepare_request(next_link=None): skip=skip, orderby=orderby, api_version=api_version, - template_url=self.list_by_time.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -893,13 +855,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("ReportCollection", pipeline_response) @@ -909,11 +871,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -926,10 +888,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_time.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byTime" - } - @distributed_trace def list_by_request( self, @@ -957,7 +915,6 @@ def list_by_request( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RequestReportRecordContract or the result of cls(response) :rtype: @@ -981,7 +938,7 @@ def list_by_request( def prepare_request(next_link=None): if not next_link: - request = build_list_by_request_request( + _request = build_list_by_request_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -989,12 +946,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_request.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1006,13 +962,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("RequestReportCollection", pipeline_response) @@ -1022,11 +978,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1038,7 +994,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_request.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byRequest" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_in_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_in_settings_operations.py index 9f4234580f00..31ed31241af4 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_in_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_in_settings_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -65,7 +66,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -84,21 +84,20 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -112,13 +111,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin" - } - @distributed_trace_async async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.PortalSigninSettings: """Get Sign In Settings for the Portal. @@ -128,7 +123,6 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSigninSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSigninSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -147,21 +141,20 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PortalSigninSettings] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -177,13 +170,9 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) deserialized = self._deserialize("PortalSigninSettings", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin" - } + return deserialized # type: ignore @overload async def update( # pylint: disable=inconsistent-return-statements @@ -211,7 +200,6 @@ async def update( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -223,7 +211,7 @@ async def update( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -239,11 +227,10 @@ async def update( # pylint: disable=inconsistent-return-statements response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update Sign-In settings. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -255,7 +242,7 @@ async def update( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, if_match: str, - parameters: Union[_models.PortalSigninSettings, IO], + parameters: Union[_models.PortalSigninSettings, IO[bytes]], **kwargs: Any ) -> None: """Update Sign-In settings. @@ -268,13 +255,9 @@ async def update( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update Sign-In settings. Is either a PortalSigninSettings type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalSigninSettings or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update Sign-In settings. Is either a PortalSigninSettings type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalSigninSettings or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -297,12 +280,12 @@ async def update( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalSigninSettings") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -311,16 +294,15 @@ async def update( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -331,11 +313,7 @@ async def update( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def create_or_update( @@ -363,7 +341,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSigninSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSigninSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -374,7 +351,7 @@ async def create_or_update( self, resource_group_name: str, service_name: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -388,14 +365,13 @@ async def create_or_update( :param service_name: The name of the API Management service. Required. :type service_name: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSigninSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSigninSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -406,7 +382,7 @@ async def create_or_update( self, resource_group_name: str, service_name: str, - parameters: Union[_models.PortalSigninSettings, IO], + parameters: Union[_models.PortalSigninSettings, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.PortalSigninSettings: @@ -417,16 +393,12 @@ async def create_or_update( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :param parameters: Create or update parameters. Is either a PortalSigninSettings type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalSigninSettings or IO + :param parameters: Create or update parameters. Is either a PortalSigninSettings type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalSigninSettings or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSigninSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSigninSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -449,12 +421,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalSigninSettings") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -463,16 +435,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -485,10 +456,6 @@ async def create_or_update( deserialized = self._deserialize("PortalSigninSettings", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_up_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_up_settings_operations.py index 88fd34409587..75ea36c46929 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_up_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_up_settings_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -65,7 +66,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -84,21 +84,20 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -112,13 +111,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup" - } - @distributed_trace_async async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.PortalSignupSettings: """Get Sign Up Settings for the Portal. @@ -128,7 +123,6 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSignupSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSignupSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -147,21 +141,20 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PortalSignupSettings] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -177,13 +170,9 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) deserialized = self._deserialize("PortalSignupSettings", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup" - } + return deserialized # type: ignore @overload async def update( # pylint: disable=inconsistent-return-statements @@ -211,7 +200,6 @@ async def update( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -223,7 +211,7 @@ async def update( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -239,11 +227,10 @@ async def update( # pylint: disable=inconsistent-return-statements response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update Sign-Up settings. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -255,7 +242,7 @@ async def update( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, if_match: str, - parameters: Union[_models.PortalSignupSettings, IO], + parameters: Union[_models.PortalSignupSettings, IO[bytes]], **kwargs: Any ) -> None: """Update Sign-Up settings. @@ -268,13 +255,9 @@ async def update( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update Sign-Up settings. Is either a PortalSignupSettings type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalSignupSettings or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update Sign-Up settings. Is either a PortalSignupSettings type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalSignupSettings or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -297,12 +280,12 @@ async def update( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalSignupSettings") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -311,16 +294,15 @@ async def update( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -331,11 +313,7 @@ async def update( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def create_or_update( @@ -363,7 +341,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSignupSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSignupSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -374,7 +351,7 @@ async def create_or_update( self, resource_group_name: str, service_name: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -388,14 +365,13 @@ async def create_or_update( :param service_name: The name of the API Management service. Required. :type service_name: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSignupSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSignupSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -406,7 +382,7 @@ async def create_or_update( self, resource_group_name: str, service_name: str, - parameters: Union[_models.PortalSignupSettings, IO], + parameters: Union[_models.PortalSignupSettings, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.PortalSignupSettings: @@ -417,16 +393,12 @@ async def create_or_update( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :param parameters: Create or update parameters. Is either a PortalSignupSettings type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalSignupSettings or IO + :param parameters: Create or update parameters. Is either a PortalSignupSettings type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalSignupSettings or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSignupSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSignupSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -449,12 +421,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalSignupSettings") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -463,16 +435,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -485,10 +456,6 @@ async def create_or_update( deserialized = self._deserialize("PortalSignupSettings", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_subscription_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_subscription_operations.py index a2cc0057e43e..c503b0260b7f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_subscription_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_subscription_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -97,7 +98,6 @@ def list( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SubscriptionContract or the result of cls(response) :rtype: @@ -121,7 +121,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -129,12 +129,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -146,13 +145,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("SubscriptionCollection", pipeline_response) @@ -162,11 +161,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -179,10 +178,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions" - } - @distributed_trace_async async def get_entity_tag(self, resource_group_name: str, service_name: str, sid: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the apimanagement subscription specified by its @@ -196,7 +191,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, sid: :param sid: Subscription entity Identifier. The entity represents the association between a user and a product in API Management. Required. :type sid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -215,22 +209,21 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, sid: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, sid=sid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -244,13 +237,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, sid: response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, sid: str, **kwargs: Any @@ -265,7 +254,6 @@ async def get( :param sid: Subscription entity Identifier. The entity represents the association between a user and a product in API Management. Required. :type sid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -284,22 +272,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SubscriptionContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, sid=sid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -315,13 +302,9 @@ async def get( deserialized = self._deserialize("SubscriptionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -365,7 +348,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -377,7 +359,7 @@ async def create_or_update( resource_group_name: str, service_name: str, sid: str, - parameters: IO, + parameters: IO[bytes], notify: Optional[bool] = None, if_match: Optional[str] = None, app_type: Optional[Union[str, _models.AppType]] = None, @@ -396,7 +378,7 @@ async def create_or_update( user and a product in API Management. Required. :type sid: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param notify: Notify change in Subscription State. @@ -413,7 +395,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -425,7 +406,7 @@ async def create_or_update( resource_group_name: str, service_name: str, sid: str, - parameters: Union[_models.SubscriptionCreateParameters, IO], + parameters: Union[_models.SubscriptionCreateParameters, IO[bytes]], notify: Optional[bool] = None, if_match: Optional[str] = None, app_type: Optional[Union[str, _models.AppType]] = None, @@ -441,9 +422,9 @@ async def create_or_update( :param sid: Subscription entity Identifier. The entity represents the association between a user and a product in API Management. Required. :type sid: str - :param parameters: Create parameters. Is either a SubscriptionCreateParameters type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionCreateParameters or IO + :param parameters: Create parameters. Is either a SubscriptionCreateParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionCreateParameters or IO[bytes] :param notify: Notify change in Subscription State. @@ -457,10 +438,6 @@ async def create_or_update( is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is None. :type app_type: str or ~azure.mgmt.apimanagement.models.AppType - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -483,12 +460,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SubscriptionCreateParameters") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, sid=sid, @@ -500,16 +477,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -535,10 +511,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" - } - @overload async def update( self, @@ -581,7 +553,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -594,7 +565,7 @@ async def update( service_name: str, sid: str, if_match: str, - parameters: IO, + parameters: IO[bytes], notify: Optional[bool] = None, app_type: Optional[Union[str, _models.AppType]] = None, *, @@ -615,7 +586,7 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param notify: Notify change in Subscription State. @@ -629,7 +600,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -642,7 +612,7 @@ async def update( service_name: str, sid: str, if_match: str, - parameters: Union[_models.SubscriptionUpdateParameters, IO], + parameters: Union[_models.SubscriptionUpdateParameters, IO[bytes]], notify: Optional[bool] = None, app_type: Optional[Union[str, _models.AppType]] = None, **kwargs: Any @@ -660,9 +630,9 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a SubscriptionUpdateParameters type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionUpdateParameters or IO + :param parameters: Update parameters. Is either a SubscriptionUpdateParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionUpdateParameters or IO[bytes] :param notify: Notify change in Subscription State. @@ -673,10 +643,6 @@ async def update( is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is None. :type app_type: str or ~azure.mgmt.apimanagement.models.AppType - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -699,12 +665,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SubscriptionUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, sid=sid, @@ -716,16 +682,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -741,13 +706,9 @@ async def update( deserialized = self._deserialize("SubscriptionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -766,7 +727,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -785,23 +745,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, sid=sid, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -812,11 +771,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def regenerate_primary_key( # pylint: disable=inconsistent-return-statements @@ -832,7 +787,6 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme :param sid: Subscription entity Identifier. The entity represents the association between a user and a product in API Management. Required. :type sid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -851,22 +805,21 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_regenerate_primary_key_request( + _request = build_regenerate_primary_key_request( resource_group_name=resource_group_name, service_name=service_name, sid=sid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.regenerate_primary_key.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -877,11 +830,7 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - regenerate_primary_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regeneratePrimaryKey" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements @@ -897,7 +846,6 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state :param sid: Subscription entity Identifier. The entity represents the association between a user and a product in API Management. Required. :type sid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -916,22 +864,21 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_regenerate_secondary_key_request( + _request = build_regenerate_secondary_key_request( resource_group_name=resource_group_name, service_name=service_name, sid=sid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.regenerate_secondary_key.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -942,11 +889,7 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - regenerate_secondary_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regenerateSecondaryKey" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def list_secrets( @@ -962,7 +905,6 @@ async def list_secrets( :param sid: Subscription entity Identifier. The entity represents the association between a user and a product in API Management. Required. :type sid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionKeysContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SubscriptionKeysContract :raises ~azure.core.exceptions.HttpResponseError: @@ -981,22 +923,21 @@ async def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SubscriptionKeysContract] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, service_name=service_name, sid=sid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1012,10 +953,6 @@ async def list_secrets( deserialized = self._deserialize("SubscriptionKeysContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_operations.py index e83c610d6026..0808b14c39ac 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -111,7 +112,6 @@ def list_by_operation( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TagContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -133,7 +133,7 @@ def list_by_operation( def prepare_request(next_link=None): if not next_link: - request = build_list_by_operation_request( + _request = build_list_by_operation_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -143,12 +143,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_operation.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -160,13 +159,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("TagCollection", pipeline_response) @@ -176,11 +175,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -193,10 +192,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_operation.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags" - } - @distributed_trace_async async def get_entity_state_by_operation( self, resource_group_name: str, service_name: str, api_id: str, operation_id: str, tag_id: str, **kwargs: Any @@ -217,7 +212,6 @@ async def get_entity_state_by_operation( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -236,7 +230,7 @@ async def get_entity_state_by_operation( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_state_by_operation_request( + _request = build_get_entity_state_by_operation_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -244,16 +238,15 @@ async def get_entity_state_by_operation( tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_state_by_operation.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -267,13 +260,9 @@ async def get_entity_state_by_operation( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_state_by_operation.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}" - } - @distributed_trace_async async def get_by_operation( self, resource_group_name: str, service_name: str, api_id: str, operation_id: str, tag_id: str, **kwargs: Any @@ -294,7 +283,6 @@ async def get_by_operation( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -313,7 +301,7 @@ async def get_by_operation( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TagContract] = kwargs.pop("cls", None) - request = build_get_by_operation_request( + _request = build_get_by_operation_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -321,16 +309,15 @@ async def get_by_operation( tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_operation.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -346,13 +333,9 @@ async def get_by_operation( deserialized = self._deserialize("TagContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get_by_operation.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}" - } + return deserialized # type: ignore @distributed_trace_async async def assign_to_operation( @@ -374,7 +357,6 @@ async def assign_to_operation( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -393,7 +375,7 @@ async def assign_to_operation( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TagContract] = kwargs.pop("cls", None) - request = build_assign_to_operation_request( + _request = build_assign_to_operation_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -401,16 +383,15 @@ async def assign_to_operation( tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.assign_to_operation.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -431,10 +412,6 @@ async def assign_to_operation( return deserialized # type: ignore - assign_to_operation.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}" - } - @distributed_trace_async async def detach_from_operation( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, api_id: str, operation_id: str, tag_id: str, **kwargs: Any @@ -455,7 +432,6 @@ async def detach_from_operation( # pylint: disable=inconsistent-return-statemen :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -474,7 +450,7 @@ async def detach_from_operation( # pylint: disable=inconsistent-return-statemen api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_detach_from_operation_request( + _request = build_detach_from_operation_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -482,16 +458,15 @@ async def detach_from_operation( # pylint: disable=inconsistent-return-statemen tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.detach_from_operation.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -502,11 +477,7 @@ async def detach_from_operation( # pylint: disable=inconsistent-return-statemen raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - detach_from_operation.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_by_api( @@ -539,7 +510,6 @@ def list_by_api( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TagContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -561,7 +531,7 @@ def list_by_api( def prepare_request(next_link=None): if not next_link: - request = build_list_by_api_request( + _request = build_list_by_api_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -570,12 +540,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -587,13 +556,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("TagCollection", pipeline_response) @@ -603,11 +572,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -620,10 +589,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags" - } - @distributed_trace_async async def get_entity_state_by_api( self, resource_group_name: str, service_name: str, api_id: str, tag_id: str, **kwargs: Any @@ -641,7 +606,6 @@ async def get_entity_state_by_api( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -660,23 +624,22 @@ async def get_entity_state_by_api( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_state_by_api_request( + _request = build_get_entity_state_by_api_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_state_by_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -690,13 +653,9 @@ async def get_entity_state_by_api( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_state_by_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}" - } - @distributed_trace_async async def get_by_api( self, resource_group_name: str, service_name: str, api_id: str, tag_id: str, **kwargs: Any @@ -714,7 +673,6 @@ async def get_by_api( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -733,23 +691,22 @@ async def get_by_api( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TagContract] = kwargs.pop("cls", None) - request = build_get_by_api_request( + _request = build_get_by_api_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -765,13 +722,9 @@ async def get_by_api( deserialized = self._deserialize("TagContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get_by_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}" - } + return deserialized # type: ignore @distributed_trace_async async def assign_to_api( @@ -790,7 +743,6 @@ async def assign_to_api( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -809,23 +761,22 @@ async def assign_to_api( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TagContract] = kwargs.pop("cls", None) - request = build_assign_to_api_request( + _request = build_assign_to_api_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.assign_to_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -851,10 +802,6 @@ async def assign_to_api( return deserialized # type: ignore - assign_to_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}" - } - @distributed_trace_async async def detach_from_api( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, api_id: str, tag_id: str, **kwargs: Any @@ -872,7 +819,6 @@ async def detach_from_api( # pylint: disable=inconsistent-return-statements :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -891,23 +837,22 @@ async def detach_from_api( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_detach_from_api_request( + _request = build_detach_from_api_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.detach_from_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -918,11 +863,7 @@ async def detach_from_api( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - detach_from_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_by_product( @@ -955,7 +896,6 @@ def list_by_product( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TagContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -977,7 +917,7 @@ def list_by_product( def prepare_request(next_link=None): if not next_link: - request = build_list_by_product_request( + _request = build_list_by_product_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -986,12 +926,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1003,13 +942,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("TagCollection", pipeline_response) @@ -1019,11 +958,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1036,10 +975,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags" - } - @distributed_trace_async async def get_entity_state_by_product( self, resource_group_name: str, service_name: str, product_id: str, tag_id: str, **kwargs: Any @@ -1057,7 +992,6 @@ async def get_entity_state_by_product( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -1076,23 +1010,22 @@ async def get_entity_state_by_product( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_state_by_product_request( + _request = build_get_entity_state_by_product_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_state_by_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1106,13 +1039,9 @@ async def get_entity_state_by_product( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_state_by_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}" - } - @distributed_trace_async async def get_by_product( self, resource_group_name: str, service_name: str, product_id: str, tag_id: str, **kwargs: Any @@ -1130,7 +1059,6 @@ async def get_by_product( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1149,23 +1077,22 @@ async def get_by_product( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TagContract] = kwargs.pop("cls", None) - request = build_get_by_product_request( + _request = build_get_by_product_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1181,13 +1108,9 @@ async def get_by_product( deserialized = self._deserialize("TagContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get_by_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}" - } + return deserialized # type: ignore @distributed_trace_async async def assign_to_product( @@ -1206,7 +1129,6 @@ async def assign_to_product( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1225,23 +1147,22 @@ async def assign_to_product( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TagContract] = kwargs.pop("cls", None) - request = build_assign_to_product_request( + _request = build_assign_to_product_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.assign_to_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1262,10 +1183,6 @@ async def assign_to_product( return deserialized # type: ignore - assign_to_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}" - } - @distributed_trace_async async def detach_from_product( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, product_id: str, tag_id: str, **kwargs: Any @@ -1283,7 +1200,6 @@ async def detach_from_product( # pylint: disable=inconsistent-return-statements :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1302,23 +1218,22 @@ async def detach_from_product( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_detach_from_product_request( + _request = build_detach_from_product_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.detach_from_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1329,11 +1244,7 @@ async def detach_from_product( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - detach_from_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_by_service( @@ -1365,7 +1276,6 @@ def list_by_service( :type skip: int :param scope: Scope like 'apis', 'products' or 'apis/{apiId}. Default value is None. :type scope: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TagContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -1387,7 +1297,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -1396,12 +1306,11 @@ def prepare_request(next_link=None): skip=skip, scope=scope, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1413,13 +1322,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("TagCollection", pipeline_response) @@ -1429,11 +1338,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1446,10 +1355,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags" - } - @distributed_trace_async async def get_entity_state(self, resource_group_name: str, service_name: str, tag_id: str, **kwargs: Any) -> bool: """Gets the entity state version of the tag specified by its identifier. @@ -1462,7 +1367,6 @@ async def get_entity_state(self, resource_group_name: str, service_name: str, ta :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -1481,22 +1385,21 @@ async def get_entity_state(self, resource_group_name: str, service_name: str, ta api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_state_request( + _request = build_get_entity_state_request( resource_group_name=resource_group_name, service_name=service_name, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_state.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1510,13 +1413,9 @@ async def get_entity_state(self, resource_group_name: str, service_name: str, ta response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_state.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}" - } - @distributed_trace_async async def get(self, resource_group_name: str, service_name: str, tag_id: str, **kwargs: Any) -> _models.TagContract: """Gets the details of the tag specified by its identifier. @@ -1529,7 +1428,6 @@ async def get(self, resource_group_name: str, service_name: str, tag_id: str, ** :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1548,22 +1446,21 @@ async def get(self, resource_group_name: str, service_name: str, tag_id: str, ** api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TagContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1579,13 +1476,9 @@ async def get(self, resource_group_name: str, service_name: str, tag_id: str, ** deserialized = self._deserialize("TagContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -1617,7 +1510,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1629,7 +1521,7 @@ async def create_or_update( resource_group_name: str, service_name: str, tag_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -1646,14 +1538,13 @@ async def create_or_update( Required. :type tag_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1665,7 +1556,7 @@ async def create_or_update( resource_group_name: str, service_name: str, tag_id: str, - parameters: Union[_models.TagCreateUpdateParameters, IO], + parameters: Union[_models.TagCreateUpdateParameters, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.TagContract: @@ -1679,16 +1570,12 @@ async def create_or_update( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :param parameters: Create parameters. Is either a TagCreateUpdateParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters or IO + :param parameters: Create parameters. Is either a TagCreateUpdateParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1711,12 +1598,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagCreateUpdateParameters") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, tag_id=tag_id, @@ -1726,16 +1613,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1761,10 +1647,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}" - } - @overload async def update( self, @@ -1795,7 +1677,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1808,7 +1689,7 @@ async def update( service_name: str, tag_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1827,11 +1708,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1844,7 +1724,7 @@ async def update( service_name: str, tag_id: str, if_match: str, - parameters: Union[_models.TagCreateUpdateParameters, IO], + parameters: Union[_models.TagCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.TagContract: """Updates the details of the tag specified by its identifier. @@ -1860,13 +1740,9 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a TagCreateUpdateParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a TagCreateUpdateParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters or IO[bytes] :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1889,12 +1765,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagCreateUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, tag_id=tag_id, @@ -1904,16 +1780,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1929,13 +1804,9 @@ async def update( deserialized = self._deserialize("TagContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -1954,7 +1825,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1973,23 +1843,22 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, tag_id=tag_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2000,8 +1869,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_resource_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_resource_operations.py index 0fa9c526753e..7ef5e240eb89 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_resource_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_resource_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -90,7 +90,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TagResourceContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagResourceContract] @@ -113,7 +112,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -121,12 +120,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -138,13 +136,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("TagResourceCollection", pipeline_response) @@ -154,11 +152,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -170,7 +168,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tagResources" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_git_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_git_operations.py index 286de8a226a2..22ae77fbcf25 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_git_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_git_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -68,7 +68,6 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme :param access_name: The identifier of the Access configuration. Known values are: "access" and "gitAccess". Required. :type access_name: str or ~azure.mgmt.apimanagement.models.AccessIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -87,22 +86,21 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_regenerate_primary_key_request( + _request = build_regenerate_primary_key_request( resource_group_name=resource_group_name, service_name=service_name, access_name=access_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.regenerate_primary_key.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -113,11 +111,7 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - regenerate_primary_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regeneratePrimaryKey" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements @@ -133,7 +127,6 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state :param access_name: The identifier of the Access configuration. Known values are: "access" and "gitAccess". Required. :type access_name: str or ~azure.mgmt.apimanagement.models.AccessIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -152,22 +145,21 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_regenerate_secondary_key_request( + _request = build_regenerate_secondary_key_request( resource_group_name=resource_group_name, service_name=service_name, access_name=access_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.regenerate_secondary_key.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -178,8 +170,4 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - regenerate_secondary_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regenerateSecondaryKey" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_operations.py index 1928a8a90621..e5ab1f9079cf 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -76,7 +77,6 @@ def list_by_service( :type service_name: str :param filter: Not used. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AccessInformationContract or the result of cls(response) :rtype: @@ -100,18 +100,17 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -123,13 +122,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("AccessInformationCollection", pipeline_response) @@ -139,11 +138,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -156,10 +155,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant" - } - @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, service_name: str, access_name: Union[str, _models.AccessIdName], **kwargs: Any @@ -174,7 +169,6 @@ async def get_entity_tag( :param access_name: The identifier of the Access configuration. Known values are: "access" and "gitAccess". Required. :type access_name: str or ~azure.mgmt.apimanagement.models.AccessIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -193,22 +187,21 @@ async def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, access_name=access_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -222,13 +215,9 @@ async def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, access_name: Union[str, _models.AccessIdName], **kwargs: Any @@ -243,7 +232,6 @@ async def get( :param access_name: The identifier of the Access configuration. Known values are: "access" and "gitAccess". Required. :type access_name: str or ~azure.mgmt.apimanagement.models.AccessIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessInformationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -262,22 +250,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccessInformationContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, access_name=access_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -293,13 +280,9 @@ async def get( deserialized = self._deserialize("AccessInformationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}" - } + return deserialized # type: ignore @overload async def create( @@ -331,7 +314,6 @@ async def create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessInformationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -344,7 +326,7 @@ async def create( service_name: str, access_name: Union[str, _models.AccessIdName], if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -363,11 +345,10 @@ async def create( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Parameters supplied to retrieve the Tenant Access Information. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessInformationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -380,7 +361,7 @@ async def create( service_name: str, access_name: Union[str, _models.AccessIdName], if_match: str, - parameters: Union[_models.AccessInformationCreateParameters, IO], + parameters: Union[_models.AccessInformationCreateParameters, IO[bytes]], **kwargs: Any ) -> _models.AccessInformationContract: """Update tenant access information details. @@ -397,12 +378,9 @@ async def create( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Parameters supplied to retrieve the Tenant Access Information. Is either a - AccessInformationCreateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.AccessInformationCreateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + AccessInformationCreateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AccessInformationCreateParameters or + IO[bytes] :return: AccessInformationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -425,12 +403,12 @@ async def create( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AccessInformationCreateParameters") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, service_name=service_name, access_name=access_name, @@ -440,16 +418,15 @@ async def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -465,13 +442,9 @@ async def create( deserialized = self._deserialize("AccessInformationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}" - } + return deserialized # type: ignore @overload async def update( @@ -503,7 +476,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessInformationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -516,7 +488,7 @@ async def update( service_name: str, access_name: Union[str, _models.AccessIdName], if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -535,11 +507,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Parameters supplied to retrieve the Tenant Access Information. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessInformationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -552,7 +523,7 @@ async def update( service_name: str, access_name: Union[str, _models.AccessIdName], if_match: str, - parameters: Union[_models.AccessInformationUpdateParameters, IO], + parameters: Union[_models.AccessInformationUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.AccessInformationContract: """Update tenant access information details. @@ -569,12 +540,9 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Parameters supplied to retrieve the Tenant Access Information. Is either a - AccessInformationUpdateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.AccessInformationUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + AccessInformationUpdateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AccessInformationUpdateParameters or + IO[bytes] :return: AccessInformationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -597,12 +565,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AccessInformationUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, access_name=access_name, @@ -612,16 +580,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -637,13 +604,9 @@ async def update( deserialized = self._deserialize("AccessInformationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}" - } + return deserialized # type: ignore @distributed_trace_async async def regenerate_primary_key( # pylint: disable=inconsistent-return-statements @@ -659,7 +622,6 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme :param access_name: The identifier of the Access configuration. Known values are: "access" and "gitAccess". Required. :type access_name: str or ~azure.mgmt.apimanagement.models.AccessIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -678,22 +640,21 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_regenerate_primary_key_request( + _request = build_regenerate_primary_key_request( resource_group_name=resource_group_name, service_name=service_name, access_name=access_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.regenerate_primary_key.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -704,11 +665,7 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - regenerate_primary_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regeneratePrimaryKey" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements @@ -724,7 +681,6 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state :param access_name: The identifier of the Access configuration. Known values are: "access" and "gitAccess". Required. :type access_name: str or ~azure.mgmt.apimanagement.models.AccessIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -743,22 +699,21 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_regenerate_secondary_key_request( + _request = build_regenerate_secondary_key_request( resource_group_name=resource_group_name, service_name=service_name, access_name=access_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.regenerate_secondary_key.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -769,11 +724,7 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - regenerate_secondary_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regenerateSecondaryKey" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def list_secrets( @@ -789,7 +740,6 @@ async def list_secrets( :param access_name: The identifier of the Access configuration. Known values are: "access" and "gitAccess". Required. :type access_name: str or ~azure.mgmt.apimanagement.models.AccessIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessInformationSecretsContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AccessInformationSecretsContract :raises ~azure.core.exceptions.HttpResponseError: @@ -808,22 +758,21 @@ async def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccessInformationSecretsContract] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, service_name=service_name, access_name=access_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -839,10 +788,6 @@ async def list_secrets( deserialized = self._deserialize("AccessInformationSecretsContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_configuration_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_configuration_operations.py index b0d43e415e6d..a58d583d0d43 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_configuration_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_configuration_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -63,7 +64,7 @@ async def _deploy_initial( resource_group_name: str, service_name: str, configuration_name: Union[str, _models.ConfigurationIdName], - parameters: Union[_models.DeployConfigurationParameters, IO], + parameters: Union[_models.DeployConfigurationParameters, IO[bytes]], **kwargs: Any ) -> Optional[_models.OperationResultContract]: error_map = { @@ -84,12 +85,12 @@ async def _deploy_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DeployConfigurationParameters") - request = build_deploy_request( + _request = build_deploy_request( resource_group_name=resource_group_name, service_name=service_name, configuration_name=configuration_name, @@ -98,16 +99,15 @@ async def _deploy_initial( content_type=content_type, json=_json, content=_content, - template_url=self._deploy_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -122,13 +122,9 @@ async def _deploy_initial( deserialized = self._deserialize("OperationResultContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _deploy_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy" - } + return deserialized # type: ignore @overload async def begin_deploy( @@ -161,14 +157,6 @@ async def begin_deploy( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either OperationResultContract or the result of cls(response) :rtype: @@ -182,7 +170,7 @@ async def begin_deploy( resource_group_name: str, service_name: str, configuration_name: Union[str, _models.ConfigurationIdName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -203,18 +191,10 @@ async def begin_deploy( Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName :param parameters: Deploy Configuration parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either OperationResultContract or the result of cls(response) :rtype: @@ -228,7 +208,7 @@ async def begin_deploy( resource_group_name: str, service_name: str, configuration_name: Union[str, _models.ConfigurationIdName], - parameters: Union[_models.DeployConfigurationParameters, IO], + parameters: Union[_models.DeployConfigurationParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.OperationResultContract]: """This operation applies changes from the specified Git branch to the configuration database. @@ -247,19 +227,8 @@ async def begin_deploy( Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName :param parameters: Deploy Configuration parameters. Is either a DeployConfigurationParameters - type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.DeployConfigurationParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.DeployConfigurationParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either OperationResultContract or the result of cls(response) :rtype: @@ -293,7 +262,7 @@ async def begin_deploy( def get_long_running_output(pipeline_response): deserialized = self._deserialize("OperationResultContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -305,24 +274,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.OperationResultContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_deploy.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy" - } + return AsyncLROPoller[_models.OperationResultContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _save_initial( self, resource_group_name: str, service_name: str, configuration_name: Union[str, _models.ConfigurationIdName], - parameters: Union[_models.SaveConfigurationParameter, IO], + parameters: Union[_models.SaveConfigurationParameter, IO[bytes]], **kwargs: Any ) -> Optional[_models.OperationResultContract]: error_map = { @@ -343,12 +310,12 @@ async def _save_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SaveConfigurationParameter") - request = build_save_request( + _request = build_save_request( resource_group_name=resource_group_name, service_name=service_name, configuration_name=configuration_name, @@ -357,16 +324,15 @@ async def _save_initial( content_type=content_type, json=_json, content=_content, - template_url=self._save_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -381,13 +347,9 @@ async def _save_initial( deserialized = self._deserialize("OperationResultContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _save_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save" - } + return deserialized # type: ignore @overload async def begin_save( @@ -420,14 +382,6 @@ async def begin_save( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either OperationResultContract or the result of cls(response) :rtype: @@ -441,7 +395,7 @@ async def begin_save( resource_group_name: str, service_name: str, configuration_name: Union[str, _models.ConfigurationIdName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -462,18 +416,10 @@ async def begin_save( Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName :param parameters: Save Configuration parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either OperationResultContract or the result of cls(response) :rtype: @@ -487,7 +433,7 @@ async def begin_save( resource_group_name: str, service_name: str, configuration_name: Union[str, _models.ConfigurationIdName], - parameters: Union[_models.SaveConfigurationParameter, IO], + parameters: Union[_models.SaveConfigurationParameter, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.OperationResultContract]: """This operation creates a commit with the current configuration snapshot to the specified branch @@ -506,19 +452,8 @@ async def begin_save( Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName :param parameters: Save Configuration parameters. Is either a SaveConfigurationParameter type - or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.SaveConfigurationParameter or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.SaveConfigurationParameter or IO[bytes] :return: An instance of AsyncLROPoller that returns either OperationResultContract or the result of cls(response) :rtype: @@ -552,7 +487,7 @@ async def begin_save( def get_long_running_output(pipeline_response): deserialized = self._deserialize("OperationResultContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -564,24 +499,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.OperationResultContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_save.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save" - } + return AsyncLROPoller[_models.OperationResultContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _validate_initial( self, resource_group_name: str, service_name: str, configuration_name: Union[str, _models.ConfigurationIdName], - parameters: Union[_models.DeployConfigurationParameters, IO], + parameters: Union[_models.DeployConfigurationParameters, IO[bytes]], **kwargs: Any ) -> Optional[_models.OperationResultContract]: error_map = { @@ -602,12 +535,12 @@ async def _validate_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DeployConfigurationParameters") - request = build_validate_request( + _request = build_validate_request( resource_group_name=resource_group_name, service_name=service_name, configuration_name=configuration_name, @@ -616,16 +549,15 @@ async def _validate_initial( content_type=content_type, json=_json, content=_content, - template_url=self._validate_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -640,13 +572,9 @@ async def _validate_initial( deserialized = self._deserialize("OperationResultContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _validate_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate" - } + return deserialized # type: ignore @overload async def begin_validate( @@ -675,14 +603,6 @@ async def begin_validate( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either OperationResultContract or the result of cls(response) :rtype: @@ -696,7 +616,7 @@ async def begin_validate( resource_group_name: str, service_name: str, configuration_name: Union[str, _models.ConfigurationIdName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -713,18 +633,10 @@ async def begin_validate( Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName :param parameters: Validate Configuration parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either OperationResultContract or the result of cls(response) :rtype: @@ -738,7 +650,7 @@ async def begin_validate( resource_group_name: str, service_name: str, configuration_name: Union[str, _models.ConfigurationIdName], - parameters: Union[_models.DeployConfigurationParameters, IO], + parameters: Union[_models.DeployConfigurationParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.OperationResultContract]: """This operation validates the changes in the specified Git branch. This is a long running @@ -753,19 +665,8 @@ async def begin_validate( Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName :param parameters: Validate Configuration parameters. Is either a DeployConfigurationParameters - type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.DeployConfigurationParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.DeployConfigurationParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either OperationResultContract or the result of cls(response) :rtype: @@ -799,7 +700,7 @@ async def begin_validate( def get_long_running_output(pipeline_response): deserialized = self._deserialize("OperationResultContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -811,17 +712,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.OperationResultContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_validate.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate" - } + return AsyncLROPoller[_models.OperationResultContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def get_sync_state( @@ -842,7 +741,6 @@ async def get_sync_state( :param configuration_name: The identifier of the Git Configuration Operation. "configuration" Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: TenantConfigurationSyncStateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TenantConfigurationSyncStateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -861,22 +759,21 @@ async def get_sync_state( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TenantConfigurationSyncStateContract] = kwargs.pop("cls", None) - request = build_get_sync_state_request( + _request = build_get_sync_state_request( resource_group_name=resource_group_name, service_name=service_name, configuration_name=configuration_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_sync_state.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -889,10 +786,6 @@ async def get_sync_state( deserialized = self._deserialize("TenantConfigurationSyncStateContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_sync_state.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/syncState" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_settings_operations.py index de89967d556d..51561c84c15f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_settings_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -67,7 +67,6 @@ def list_by_service( :type service_name: str :param filter: Not used. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TenantSettingsContract or the result of cls(response) :rtype: @@ -91,18 +90,17 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -114,13 +112,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("TenantSettingsCollection", pipeline_response) @@ -130,11 +128,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -147,10 +145,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings" - } - @distributed_trace_async async def get( self, @@ -168,7 +162,6 @@ async def get( :type service_name: str :param settings_type: The identifier of the settings. "public" Required. :type settings_type: str or ~azure.mgmt.apimanagement.models.SettingsTypeName - :keyword callable cls: A custom type or function that will be passed the direct response :return: TenantSettingsContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TenantSettingsContract :raises ~azure.core.exceptions.HttpResponseError: @@ -187,22 +180,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TenantSettingsContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, settings_type=settings_type, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -218,10 +210,6 @@ async def get( deserialized = self._deserialize("TenantSettingsContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings/{settingsType}" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_confirmation_password_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_confirmation_password_operations.py index 0efaf1bfe432..ad0c4bab9d48 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_confirmation_password_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_confirmation_password_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -74,7 +74,6 @@ async def send( # pylint: disable=inconsistent-return-statements is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is None. :type app_type: str or ~azure.mgmt.apimanagement.models.AppType - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -93,23 +92,22 @@ async def send( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_send_request( + _request = build_send_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, subscription_id=self._config.subscription_id, app_type=app_type, api_version=api_version, - template_url=self.send.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -120,8 +118,4 @@ async def send( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - send.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/confirmations/password/send" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_group_operations.py index 1f66a3e7a06a..281372237763 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_group_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_group_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -86,7 +86,6 @@ def list( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GroupContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GroupContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -108,7 +107,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, @@ -117,12 +116,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -134,13 +132,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("GroupCollection", pipeline_response) @@ -150,11 +148,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -166,7 +164,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/groups" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_identities_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_identities_operations.py index e06a94fc4f9e..c02e5c5602a3 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_identities_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_identities_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -67,7 +67,6 @@ def list( :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserIdentityContract or the result of cls(response) :rtype: @@ -91,18 +90,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -114,13 +112,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("UserIdentityCollection", pipeline_response) @@ -130,11 +128,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -146,7 +144,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/identities" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_operations.py index 570db6af5ad3..ea76c91cc15a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -97,7 +98,6 @@ def list_by_service( :type skip: int :param expand_groups: Detailed Group in response. Default value is None. :type expand_groups: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserContract or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.UserContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -119,7 +119,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -128,12 +128,11 @@ def prepare_request(next_link=None): skip=skip, expand_groups=expand_groups, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -145,13 +144,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("UserCollection", pipeline_response) @@ -161,11 +160,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -178,10 +177,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users" - } - @distributed_trace_async async def get_entity_tag(self, resource_group_name: str, service_name: str, user_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the user specified by its identifier. @@ -194,7 +189,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, user :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -213,22 +207,21 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, user api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,13 +235,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, user response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, user_id: str, **kwargs: Any @@ -263,7 +252,6 @@ async def get( :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserContract :raises ~azure.core.exceptions.HttpResponseError: @@ -282,22 +270,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UserContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,13 +300,9 @@ async def get( deserialized = self._deserialize("UserContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -354,7 +337,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserContract :raises ~azure.core.exceptions.HttpResponseError: @@ -366,7 +348,7 @@ async def create_or_update( resource_group_name: str, service_name: str, user_id: str, - parameters: IO, + parameters: IO[bytes], notify: Optional[bool] = None, if_match: Optional[str] = None, *, @@ -384,7 +366,7 @@ async def create_or_update( Required. :type user_id: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param notify: Send an Email notification to the User. Default value is None. :type notify: bool :param if_match: ETag of the Entity. Not required when creating an entity, but required when @@ -393,7 +375,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserContract :raises ~azure.core.exceptions.HttpResponseError: @@ -405,7 +386,7 @@ async def create_or_update( resource_group_name: str, service_name: str, user_id: str, - parameters: Union[_models.UserCreateParameters, IO], + parameters: Union[_models.UserCreateParameters, IO[bytes]], notify: Optional[bool] = None, if_match: Optional[str] = None, **kwargs: Any @@ -420,18 +401,14 @@ async def create_or_update( :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :param parameters: Create or update parameters. Is either a UserCreateParameters type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.UserCreateParameters or IO + :param parameters: Create or update parameters. Is either a UserCreateParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.UserCreateParameters or IO[bytes] :param notify: Send an Email notification to the User. Default value is None. :type notify: bool :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserContract :raises ~azure.core.exceptions.HttpResponseError: @@ -454,12 +431,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UserCreateParameters") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, @@ -470,16 +447,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -505,10 +481,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" - } - @overload async def update( self, @@ -539,7 +511,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserContract :raises ~azure.core.exceptions.HttpResponseError: @@ -552,7 +523,7 @@ async def update( service_name: str, user_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -571,11 +542,10 @@ async def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserContract :raises ~azure.core.exceptions.HttpResponseError: @@ -588,7 +558,7 @@ async def update( service_name: str, user_id: str, if_match: str, - parameters: Union[_models.UserUpdateParameters, IO], + parameters: Union[_models.UserUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.UserContract: """Updates the details of the user specified by its identifier. @@ -604,13 +574,9 @@ async def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a UserUpdateParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.UserUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a UserUpdateParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.UserUpdateParameters or IO[bytes] :return: UserContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserContract :raises ~azure.core.exceptions.HttpResponseError: @@ -633,12 +599,12 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UserUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, @@ -648,16 +614,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -673,13 +638,9 @@ async def update( deserialized = self._deserialize("UserContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -715,7 +676,6 @@ async def delete( # pylint: disable=inconsistent-return-statements is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is None. :type app_type: str or ~azure.mgmt.apimanagement.models.AppType - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -734,7 +694,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, @@ -744,16 +704,15 @@ async def delete( # pylint: disable=inconsistent-return-statements notify=notify, app_type=app_type, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -764,11 +723,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def generate_sso_url( @@ -785,7 +740,6 @@ async def generate_sso_url( :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GenerateSsoUrlResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GenerateSsoUrlResult :raises ~azure.core.exceptions.HttpResponseError: @@ -804,22 +758,21 @@ async def generate_sso_url( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GenerateSsoUrlResult] = kwargs.pop("cls", None) - request = build_generate_sso_url_request( + _request = build_generate_sso_url_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.generate_sso_url.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -832,13 +785,9 @@ async def generate_sso_url( deserialized = self._deserialize("GenerateSsoUrlResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - generate_sso_url.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/generateSsoUrl" - } + return deserialized # type: ignore @overload async def get_shared_access_token( @@ -866,7 +815,6 @@ async def get_shared_access_token( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserTokenResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserTokenResult :raises ~azure.core.exceptions.HttpResponseError: @@ -878,7 +826,7 @@ async def get_shared_access_token( resource_group_name: str, service_name: str, user_id: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -894,11 +842,10 @@ async def get_shared_access_token( Required. :type user_id: str :param parameters: Create Authorization Token parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserTokenResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserTokenResult :raises ~azure.core.exceptions.HttpResponseError: @@ -910,7 +857,7 @@ async def get_shared_access_token( resource_group_name: str, service_name: str, user_id: str, - parameters: Union[_models.UserTokenParameters, IO], + parameters: Union[_models.UserTokenParameters, IO[bytes]], **kwargs: Any ) -> _models.UserTokenResult: """Gets the Shared Access Authorization Token for the User. @@ -924,12 +871,8 @@ async def get_shared_access_token( Required. :type user_id: str :param parameters: Create Authorization Token parameters. Is either a UserTokenParameters type - or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.UserTokenParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.UserTokenParameters or IO[bytes] :return: UserTokenResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserTokenResult :raises ~azure.core.exceptions.HttpResponseError: @@ -952,12 +895,12 @@ async def get_shared_access_token( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UserTokenParameters") - request = build_get_shared_access_token_request( + _request = build_get_shared_access_token_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, @@ -966,16 +909,15 @@ async def get_shared_access_token( content_type=content_type, json=_json, content=_content, - template_url=self.get_shared_access_token.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -988,10 +930,6 @@ async def get_shared_access_token( deserialized = self._deserialize("UserTokenResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_shared_access_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/token" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_subscription_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_subscription_operations.py index d421a1a8ff33..65f8bf298d87 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_subscription_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_subscription_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -90,7 +90,6 @@ def list( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SubscriptionContract or the result of cls(response) :rtype: @@ -114,7 +113,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, @@ -123,12 +122,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -140,13 +138,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _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("SubscriptionCollection", pipeline_response) @@ -156,11 +154,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -173,10 +171,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions" - } - @distributed_trace_async async def get( self, resource_group_name: str, service_name: str, user_id: str, sid: str, **kwargs: Any @@ -194,7 +188,6 @@ async def get( :param sid: Subscription entity Identifier. The entity represents the association between a user and a product in API Management. Required. :type sid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -213,23 +206,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SubscriptionContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, sid=sid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -245,10 +237,6 @@ async def get( deserialized = self._deserialize("SubscriptionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions/{sid}" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_api_management_client_enums.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_api_management_client_enums.py index 85270529ff70..01c8f0ff131a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_api_management_client_enums.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_api_management_client_enums.py @@ -285,7 +285,7 @@ class ExportFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Export the Api Definition in OpenAPI 2.0 Specification as JSON document to the Storage Blob.""" WSDL = "wsdl-link" """Export the Api Definition in WSDL Schema to Storage Blob. This is only supported for APIs of - #: Type ``soap``""" + Type ``soap``""" WADL = "wadl-link" """Export the Api Definition in WADL Schema to Storage Blob.""" OPENAPI = "openapi-link" @@ -303,7 +303,7 @@ class ExportResultFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The API Definition is exported in OpenAPI Specification 2.0 format to the Storage Blob.""" WSDL = "wsdl-link+xml" """The API Definition is exported in WSDL Schema to Storage Blob. This is only supported for APIs - #: of Type ``soap``""" + of Type ``soap``""" WADL = "wadl-link-json" """Export the API Definition in WADL Schema to Storage Blob.""" OPEN_API = "openapi-link" @@ -319,7 +319,7 @@ class GrantType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Implicit Code Grant flow as described https://tools.ietf.org/html/rfc6749#section-4.2.""" RESOURCE_OWNER_PASSWORD = "resourceOwnerPassword" """Resource Owner Password Grant flow as described - #: https://tools.ietf.org/html/rfc6749#section-4.3.""" + https://tools.ietf.org/html/rfc6749#section-4.3.""" CLIENT_CREDENTIALS = "clientCredentials" """Client Credentials Grant flow as described https://tools.ietf.org/html/rfc6749#section-4.4.""" @@ -349,7 +349,7 @@ class HttpCorrelationProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Do not read and inject correlation headers.""" LEGACY = "Legacy" """Inject Request-Id and Request-Context headers with request correlation data. See - #: https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md.""" + https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md.""" W3_C = "W3C" """Inject Trace Context headers. See https://w3c.github.io/trace-context.""" @@ -435,24 +435,24 @@ class NotificationName(str, Enum, metaclass=CaseInsensitiveEnumMeta): REQUEST_PUBLISHER_NOTIFICATION_MESSAGE = "RequestPublisherNotificationMessage" """The following email recipients and users will receive email notifications about subscription - #: requests for API products requiring approval.""" + requests for API products requiring approval.""" PURCHASE_PUBLISHER_NOTIFICATION_MESSAGE = "PurchasePublisherNotificationMessage" """The following email recipients and users will receive email notifications about new API product - #: subscriptions.""" + subscriptions.""" NEW_APPLICATION_NOTIFICATION_MESSAGE = "NewApplicationNotificationMessage" """The following email recipients and users will receive email notifications when new applications - #: are submitted to the application gallery.""" + are submitted to the application gallery.""" BCC = "BCC" """The following recipients will receive blind carbon copies of all emails sent to developers.""" NEW_ISSUE_PUBLISHER_NOTIFICATION_MESSAGE = "NewIssuePublisherNotificationMessage" """The following email recipients and users will receive email notifications when a new issue or - #: comment is submitted on the developer portal.""" + comment is submitted on the developer portal.""" ACCOUNT_CLOSED_PUBLISHER = "AccountClosedPublisher" """The following email recipients and users will receive email notifications when developer closes - #: his account.""" + his account.""" QUOTA_LIMIT_APPROACHING_PUBLISHER_NOTIFICATION_MESSAGE = "QuotaLimitApproachingPublisherNotificationMessage" """The following email recipients and users will receive email notifications when subscription - #: usage gets close to usage quota.""" + usage gets close to usage quota.""" class OAuth2GrantType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -501,12 +501,12 @@ class PolicyContentFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The contents are inline and Content type is an XML document.""" XML_LINK = "xml-link" """The policy XML document is hosted on a HTTP endpoint accessible from the API Management - #: service.""" + service.""" RAWXML = "rawxml" """The contents are inline and Content type is a non XML encoded policy document.""" RAWXML_LINK = "rawxml-link" """The policy document is not XML encoded and is hosted on a HTTP endpoint accessible from the API - #: Management service.""" + Management service.""" class PolicyExportFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -778,13 +778,13 @@ class Verbosity(str, Enum, metaclass=CaseInsensitiveEnumMeta): VERBOSE = "verbose" """All the traces emitted by trace policies will be sent to the logger attached to this diagnostic - #: instance.""" + instance.""" INFORMATION = "information" """Traces with 'severity' set to 'information' and 'error' will be sent to the logger attached to - #: this diagnostic instance.""" + this diagnostic instance.""" ERROR = "error" """Only traces with 'severity' set to 'error' will be sent to the logger attached to this - #: diagnostic instance.""" + diagnostic instance.""" class VersioningScheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -812,4 +812,4 @@ class VirtualNetworkType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The service is part of Virtual Network and it is accessible from Internet.""" INTERNAL = "Internal" """The service is part of Virtual Network and it is only accessible from within the virtual - #: network.""" + network.""" diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_models_py3.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_models_py3.py index 6fc753739c3c..6c4770ae7729 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_models_py3.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_models_py3.py @@ -9,7 +9,7 @@ import datetime import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union from .. import _serialization @@ -17,10 +17,6 @@ from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -69,7 +65,7 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -105,7 +101,7 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -114,22 +110,6 @@ class ProxyResource(Resource): :vartype type: str """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - class AccessInformationContract(ProxyResource): """Tenant Settings. @@ -137,7 +117,7 @@ class AccessInformationContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -321,7 +301,7 @@ class AdditionalLocation(_serialization.Model): # pylint: disable=too-many-inst Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar location: The location name of the additional region among Azure Data center regions. Required. @@ -512,7 +492,7 @@ class ApiContract(ProxyResource): # pylint: disable=too-many-instance-attribute Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -865,7 +845,7 @@ class ApiContractProperties(ApiEntityBaseContract): # pylint: disable=too-many- Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar description: Description of the API. May include HTML formatting tags. :vartype description: str @@ -1504,7 +1484,7 @@ class ApiCreateOrUpdateProperties(ApiContractProperties): # pylint: disable=too Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar description: Description of the API. May include HTML formatting tags. :vartype description: str @@ -1878,7 +1858,7 @@ def __init__(self, *, name: Optional[str] = None, url: Optional[str] = None, **k self.url = url -class ApiManagementServiceApplyNetworkConfigurationParameters(_serialization.Model): +class ApiManagementServiceApplyNetworkConfigurationParameters(_serialization.Model): # pylint: disable=name-too-long """Parameter supplied to the Apply Network configuration operation. :ivar location: Location of the Api Management service to update for a multi-region service. @@ -1900,10 +1880,10 @@ def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: self.location = location -class ApiManagementServiceBackupRestoreParameters(_serialization.Model): +class ApiManagementServiceBackupRestoreParameters(_serialization.Model): # pylint: disable=name-too-long """Parameters supplied to the Backup/Restore of an API Management service operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar storage_account: The name of the Azure storage account (used to place/retrieve the backup). Required. @@ -2057,7 +2037,7 @@ class ApiManagementServiceBaseProperties(_serialization.Model): # pylint: disab `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ ``false``. The default value is ``true`` for them.
Note: The following ciphers can't be disabled since they are required by internal platform components: - TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. + TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. # pylint: disable=line-too-long :vartype custom_properties: dict[str, str] :ivar certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. @@ -2214,7 +2194,7 @@ def __init__( # pylint: disable=too-many-locals `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ ``false``. The default value is ``true`` for them.
Note: The following ciphers can't be disabled since they are required by internal platform components: - TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. + TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. # pylint: disable=line-too-long :paramtype custom_properties: dict[str, str] :keyword certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. @@ -2277,10 +2257,10 @@ def __init__( # pylint: disable=too-many-locals self.platform_version = None -class ApiManagementServiceCheckNameAvailabilityParameters(_serialization.Model): +class ApiManagementServiceCheckNameAvailabilityParameters(_serialization.Model): # pylint: disable=name-too-long """Parameters supplied to the CheckNameAvailability operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: The name to check for availability. Required. :vartype name: str @@ -2303,7 +2283,7 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name -class ApiManagementServiceGetDomainOwnershipIdentifierResult(_serialization.Model): +class ApiManagementServiceGetDomainOwnershipIdentifierResult(_serialization.Model): # pylint: disable=name-too-long """Response of the GetDomainOwnershipIdentifier operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -2351,7 +2331,7 @@ class ApiManagementServiceIdentity(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type @@ -2415,7 +2395,7 @@ def __init__( class ApiManagementServiceListResult(_serialization.Model): """The response of the List API Management services operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Result of the List API Management services operation. Required. :vartype value: list[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] @@ -2448,7 +2428,7 @@ def __init__( self.next_link = next_link -class ApiManagementServiceNameAvailabilityResult(_serialization.Model): +class ApiManagementServiceNameAvailabilityResult(_serialization.Model): # pylint: disable=name-too-long """Response of the CheckNameAvailability operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -2500,7 +2480,7 @@ class ApiManagementServiceProperties( Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar notification_sender_email: Email address from which the notification will be sent. :vartype notification_sender_email: str @@ -2576,7 +2556,7 @@ class ApiManagementServiceProperties( `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ ``false``. The default value is ``true`` for them.
Note: The following ciphers can't be disabled since they are required by internal platform components: - TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. + TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. # pylint: disable=line-too-long :vartype custom_properties: dict[str, str] :ivar certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. @@ -2743,7 +2723,7 @@ def __init__( # pylint: disable=too-many-locals `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ ``false``. The default value is ``true`` for them.
Note: The following ciphers can't be disabled since they are required by internal platform components: - TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. + TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. # pylint: disable=line-too-long :paramtype custom_properties: dict[str, str] :keyword certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. @@ -2846,7 +2826,7 @@ class ApiManagementServiceResource(ApimResource): # pylint: disable=too-many-in Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Resource ID. :vartype id: str @@ -2942,7 +2922,7 @@ class ApiManagementServiceResource(ApimResource): # pylint: disable=too-many-in `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ ``false``. The default value is ``true`` for them.
Note: The following ciphers can't be disabled since they are required by internal platform components: - TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. + TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. # pylint: disable=line-too-long :vartype custom_properties: dict[str, str] :ivar certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. @@ -3144,7 +3124,7 @@ def __init__( # pylint: disable=too-many-locals `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ ``false``. The default value is ``true`` for them.
Note: The following ciphers can't be disabled since they are required by internal platform components: - TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. + TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. # pylint: disable=line-too-long :paramtype custom_properties: dict[str, str] :keyword certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. @@ -3222,7 +3202,7 @@ def __init__( # pylint: disable=too-many-locals class ApiManagementServiceSkuProperties(_serialization.Model): """API Management service resource SKU properties. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: Name of the Sku. Required. Known values are: "Developer", "Standard", "Premium", "Basic", "Consumption", and "Isolated". @@ -3351,7 +3331,7 @@ class ApiManagementServiceUpdateParameters(ApimResource): # pylint: disable=too `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ ``false``. The default value is ``true`` for them.
Note: The following ciphers can't be disabled since they are required by internal platform components: - TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. + TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. # pylint: disable=line-too-long :vartype custom_properties: dict[str, str] :ivar certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. @@ -3545,7 +3525,7 @@ def __init__( # pylint: disable=too-many-locals `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ ``false``. The default value is ``true`` for them.
Note: The following ciphers can't be disabled since they are required by internal platform components: - TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. + TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. # pylint: disable=line-too-long :paramtype custom_properties: dict[str, str] :keyword certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. @@ -3699,7 +3679,7 @@ class ApiManagementServiceUpdateProperties( `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ ``false``. The default value is ``true`` for them.
Note: The following ciphers can't be disabled since they are required by internal platform components: - TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. + TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. # pylint: disable=line-too-long :vartype custom_properties: dict[str, str] :ivar certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. @@ -3866,7 +3846,7 @@ def __init__( # pylint: disable=too-many-locals `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ ``false``. The default value is ``true`` for them.
Note: The following ciphers can't be disabled since they are required by internal platform components: - TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. + TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. # pylint: disable=line-too-long :paramtype custom_properties: dict[str, str] :keyword certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. @@ -4218,7 +4198,7 @@ class ApiManagementSkusResult(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The list of skus available for the subscription. Required. :vartype value: list[~azure.mgmt.apimanagement.models.ApiManagementSku] @@ -4317,7 +4297,7 @@ class ApiReleaseContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -4947,7 +4927,7 @@ class ApiVersionSetContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -5140,7 +5120,7 @@ def __init__( class ApiVersionSetContractProperties(ApiVersionSetEntityBase): """Properties of an API Version Set. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar description: Description of API Version Set. :vartype description: str @@ -5368,7 +5348,7 @@ class AssociationContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -5506,7 +5486,7 @@ class AuthorizationAccessPolicyContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -5584,7 +5564,7 @@ def __init__( self.next_link = next_link -class AuthorizationConfirmConsentCodeRequestContract(_serialization.Model): +class AuthorizationConfirmConsentCodeRequestContract(_serialization.Model): # pylint: disable=name-too-long """Authorization confirm consent code request contract. :ivar consent_code: The consent code from the authorization server after authorizing and @@ -5612,7 +5592,7 @@ class AuthorizationContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -5784,7 +5764,7 @@ class AuthorizationProviderContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -5946,7 +5926,7 @@ class AuthorizationServerContract(ProxyResource): # pylint: disable=too-many-in Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -6156,7 +6136,7 @@ def __init__( self.client_secret = client_secret -class AuthorizationServerContractBaseProperties(_serialization.Model): +class AuthorizationServerContractBaseProperties(_serialization.Model): # pylint: disable=name-too-long """External OAuth authorization server Update settings contract. :ivar description: Description of the authorization server. Can contain HTML formatting tags. @@ -6285,7 +6265,7 @@ class AuthorizationServerContractProperties( ): # pylint: disable=too-many-instance-attributes """External OAuth authorization server settings Properties. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar description: Description of the authorization server. Can contain HTML formatting tags. :vartype description: str @@ -6539,7 +6519,7 @@ class AuthorizationServerUpdateContract(ProxyResource): # pylint: disable=too-m Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -6751,7 +6731,7 @@ def __init__( class AuthorizationServerUpdateContractProperties( AuthorizationServerContractBaseProperties -): # pylint: disable=too-many-instance-attributes +): # pylint: disable=too-many-instance-attributes,name-too-long """External OAuth authorization server Update settings contract. :ivar description: Description of the authorization server. Can contain HTML formatting tags. @@ -6956,7 +6936,7 @@ def __init__( class BackendAuthorizationHeaderCredentials(_serialization.Model): """Authorization header information. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar scheme: Authentication Scheme name. Required. :vartype scheme: str @@ -7106,7 +7086,7 @@ class BackendContract(ProxyResource): # pylint: disable=too-many-instance-attri Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -7209,7 +7189,7 @@ def __init__( class BackendContractProperties(BackendBaseParameters): """Parameters supplied to the Create Backend operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar title: Backend Title. :vartype title: str @@ -7390,7 +7370,7 @@ def __init__( class BackendProxyContract(_serialization.Model): """Details of the Backend WebProxy Server to use in the Request to Backend. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar url: WebProxy Server AbsoluteUri property which includes the entire URI stored in the Uri instance, including all fragments and query strings. Required. @@ -7435,7 +7415,7 @@ class BackendReconnectContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -7473,7 +7453,7 @@ def __init__(self, *, after: Optional[datetime.timedelta] = None, **kwargs: Any) class BackendServiceFabricClusterProperties(_serialization.Model): """Properties of the Service Fabric Type Backend. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar client_certificate_id: The client certificate id for the management endpoint. :vartype client_certificate_id: str @@ -7825,7 +7805,7 @@ class CacheContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -7987,7 +7967,7 @@ def __init__( class CertificateConfiguration(_serialization.Model): """Certificate configuration which consist of non-trusted intermediates and root certificates. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar encoded_certificate: Base64 Encoded certificate. :vartype encoded_certificate: str @@ -8047,7 +8027,7 @@ class CertificateContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -8150,7 +8130,7 @@ def __init__( class CertificateInformation(_serialization.Model): """SSL certificate information. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar expiry: Expiration date of the certificate. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. Required. @@ -8212,7 +8192,7 @@ def __init__(self, *, client_secret: Optional[str] = None, **kwargs: Any) -> Non class ConnectivityCheckRequest(_serialization.Model): """A request to perform the connectivity check operation on a API Management service. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar source: Definitions about the connectivity check origin. Required. :vartype source: ~azure.mgmt.apimanagement.models.ConnectivityCheckRequestSource @@ -8282,7 +8262,7 @@ def __init__( class ConnectivityCheckRequestDestination(_serialization.Model): """The connectivity check operation destination. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar address: Destination address. Can either be an IP address or a FQDN. Required. :vartype address: str @@ -8312,7 +8292,7 @@ def __init__(self, *, address: str, port: int, **kwargs: Any) -> None: self.port = port -class ConnectivityCheckRequestProtocolConfiguration(_serialization.Model): +class ConnectivityCheckRequestProtocolConfiguration(_serialization.Model): # pylint: disable=name-too-long """Protocol-specific configuration. :ivar http_configuration: Configuration for HTTP or HTTPS requests. @@ -8342,7 +8322,9 @@ def __init__( self.http_configuration = http_configuration -class ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration(_serialization.Model): +class ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration( + _serialization.Model +): # pylint: disable=name-too-long """Configuration for HTTP or HTTPS requests. :ivar method: The HTTP method to be used. Known values are: "GET" and "POST". @@ -8385,7 +8367,7 @@ def __init__( class ConnectivityCheckRequestSource(_serialization.Model): """Definitions about the connectivity check origin. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar region: The API Management service region from where to start the connectivity check operation. Required. @@ -8561,7 +8543,7 @@ def __init__(self, **kwargs: Any) -> None: class ConnectivityStatusContract(_serialization.Model): """Details about connectivity to a resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: The hostname of the resource which the service depends on. This can be the database, storage or any other azure resource on which the service depends upon. Required. @@ -8686,7 +8668,7 @@ class ContentItemContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -8753,7 +8735,7 @@ class ContentTypeContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -8889,7 +8871,7 @@ class DeletedServiceContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -9055,7 +9037,7 @@ class DiagnosticContract(ProxyResource): # pylint: disable=too-many-instance-at Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -9202,7 +9184,7 @@ class DocumentationContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -9312,7 +9294,7 @@ class EmailTemplateContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -9388,7 +9370,7 @@ def __init__( self.parameters = parameters -class EmailTemplateParametersContractProperties(_serialization.Model): +class EmailTemplateParametersContractProperties(_serialization.Model): # pylint: disable=name-too-long """Email Template Parameter contract. :ivar name: Template parameter name. @@ -9701,7 +9683,7 @@ class GatewayCertificateAuthorityContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -9775,7 +9757,7 @@ class GatewayContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -9855,7 +9837,7 @@ class GatewayHostnameConfigurationContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -9933,7 +9915,7 @@ def __init__( class GatewayKeyRegenerationRequestContract(_serialization.Model): """Gateway key regeneration request contract properties. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar key_type: The Key being regenerated. Required. Known values are: "primary" and "secondary". @@ -10007,7 +9989,7 @@ def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: class GatewayTokenRequestContract(_serialization.Model): """Gateway token request contract properties. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar key_type: The Key to be used to generate gateway token. Required. Known values are: "primary" and "secondary". @@ -10104,7 +10086,7 @@ class GlobalSchemaContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -10209,7 +10191,7 @@ class GroupContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -10286,7 +10268,7 @@ class GroupContractProperties(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar display_name: Group name. Required. :vartype display_name: str @@ -10457,7 +10439,7 @@ def __init__( class HostnameConfiguration(_serialization.Model): # pylint: disable=too-many-instance-attributes """Custom hostname configuration. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: Hostname type. Required. Known values are: "Proxy", "Portal", "Management", "Scm", and "DeveloperPortal". @@ -10583,7 +10565,7 @@ def __init__( class HTTPHeader(_serialization.Model): """HTTP header and it's value. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: Header name. Required. :vartype name: str @@ -10758,7 +10740,7 @@ class IdentityProviderContract(ProxyResource): # pylint: disable=too-many-insta Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -10899,7 +10881,7 @@ class IdentityProviderContractProperties( Directory which can be used to enable access to the API Management service developer portal for all users. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: Identity Provider Type identifier. Known values are: "facebook", "google", "microsoft", "twitter", "aad", and "aadB2C". @@ -11030,7 +11012,7 @@ class IdentityProviderCreateContract(ProxyResource): # pylint: disable=too-many Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -11171,7 +11153,7 @@ class IdentityProviderCreateContractProperties( Directory which can be used to enable access to the API Management service developer portal for all users. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: Identity Provider Type identifier. Known values are: "facebook", "google", "microsoft", "twitter", "aad", and "aadB2C". @@ -11622,7 +11604,7 @@ class IssueAttachmentContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -11752,7 +11734,7 @@ class IssueCommentContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -11810,7 +11792,7 @@ class IssueContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -11929,7 +11911,7 @@ def __init__( class IssueContractProperties(IssueContractBaseProperties): """Issue contract Properties. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar created_date: Date and time when the issue was created. :vartype created_date: ~datetime.datetime @@ -12193,7 +12175,7 @@ def __init__( self.last_status = last_status -class KeyVaultLastAccessStatusContractProperties(_serialization.Model): +class KeyVaultLastAccessStatusContractProperties(_serialization.Model): # pylint: disable=name-too-long """Issue contract Update Properties. :ivar code: Last status code for sync and refresh of secret from key vault. @@ -12279,7 +12261,7 @@ class LoggerContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -12451,7 +12433,7 @@ class NamedValueContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -12563,7 +12545,7 @@ def __init__(self, *, tags: Optional[List[str]] = None, secret: Optional[bool] = class NamedValueContractProperties(NamedValueEntityBaseParameters): """NamedValue Contract properties. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar tags: Optional tags that when provided can be used to filter the NamedValue list. :vartype tags: list[str] @@ -12633,7 +12615,7 @@ class NamedValueCreateContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -12713,7 +12695,7 @@ def __init__( class NamedValueCreateContractProperties(NamedValueEntityBaseParameters): """NamedValue Contract properties. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar tags: Optional tags that when provided can be used to filter the NamedValue list. :vartype tags: list[str] @@ -12928,7 +12910,7 @@ def __init__( class NetworkStatusContract(_serialization.Model): """Network Status details. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar dns_servers: Gets the list of DNS servers IPV4 addresses. Required. :vartype dns_servers: list[str] @@ -13044,7 +13026,7 @@ class NotificationContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -13204,7 +13186,7 @@ class OpenidConnectProviderContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -13451,7 +13433,7 @@ class OperationContract(ProxyResource): # pylint: disable=too-many-instance-att Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -13605,7 +13587,7 @@ def __init__( class OperationContractProperties(OperationEntityBaseContract): """Operation Contract Properties. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar template_parameters: Collection of URL template parameters. :vartype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] @@ -13773,7 +13755,7 @@ class OperationResultContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -14170,7 +14152,7 @@ class OutboundEnvironmentEndpointList(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.apimanagement.models.OutboundEnvironmentEndpoint] @@ -14201,7 +14183,7 @@ def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwar class ParameterContract(_serialization.Model): """Operation parameters details. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: Parameter name. Required. :vartype name: str @@ -14409,7 +14391,7 @@ class PolicyContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -14490,7 +14472,7 @@ class PolicyDescriptionContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -14571,7 +14553,7 @@ class PolicyFragmentContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -14660,7 +14642,7 @@ class PortalConfigContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -14920,7 +14902,7 @@ class PortalDelegationSettings(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -15019,7 +15001,7 @@ class PortalRevisionContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -15118,7 +15100,7 @@ class PortalSettingsContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -15223,7 +15205,7 @@ class PortalSigninSettings(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -15262,7 +15244,7 @@ class PortalSignupSettings(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -15336,7 +15318,7 @@ class PrivateEndpointConnection(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -15449,7 +15431,7 @@ def __init__( self.properties = properties -class PrivateEndpointConnectionRequestProperties(_serialization.Model): +class PrivateEndpointConnectionRequestProperties(_serialization.Model): # pylint: disable=name-too-long """The connection state of the private endpoint connection. :ivar private_link_service_connection_state: A collection of information about the state of the @@ -15487,7 +15469,7 @@ class PrivateLinkResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -15640,7 +15622,7 @@ class ProductContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -15845,7 +15827,7 @@ def __init__( class ProductContractProperties(ProductEntityBaseParameters): """Product profile. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar description: Product description. May include HTML formatting tags. :vartype description: str @@ -15949,7 +15931,7 @@ def __init__( class ProductTagResourceContractProperties(ProductEntityBaseParameters): """Product profile. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar description: Product description. May include HTML formatting tags. :vartype description: str @@ -16301,7 +16283,7 @@ def __init__( class QuotaCounterContract(_serialization.Model): """Quota counter details. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar counter_key: The Key value of the Counter. Must not be empty. Required. :vartype counter_key: str @@ -16495,7 +16477,7 @@ class RecipientEmailContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -16599,7 +16581,7 @@ class RecipientUserContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -17065,7 +17047,7 @@ def __init__( # pylint: disable=too-many-locals class RepresentationContract(_serialization.Model): """Operation request/response representation details. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar content_type: Specifies a registered or custom content type for this representation, e.g. application/xml. Required. @@ -17405,7 +17387,7 @@ class ResolverContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -17466,7 +17448,7 @@ class ResolverResultContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -17681,7 +17663,7 @@ class ResourceCollectionValueItem(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -17690,27 +17672,11 @@ class ResourceCollectionValueItem(ProxyResource): :vartype type: str """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - class ResourceLocationDataContract(_serialization.Model): """Resource location data properties. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: A canonical name for the geographic or physical location. Required. :vartype name: str @@ -17859,7 +17825,7 @@ def __init__(self, **kwargs: Any) -> None: class ResourceSkuResults(_serialization.Model): """The API Management service SKUs operation response. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The list of skus available for the service. Required. :vartype value: list[~azure.mgmt.apimanagement.models.ResourceSkuResult] @@ -17893,7 +17859,7 @@ def __init__( class ResponseContract(_serialization.Model): """Operation response details. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar status_code: Operation response HTTP status code. Required. :vartype status_code: int @@ -18048,7 +18014,7 @@ class SchemaContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -18167,7 +18133,7 @@ class SubscriptionContract(ProxyResource): # pylint: disable=too-many-instance- Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -18484,7 +18450,7 @@ def __init__( self.secondary_key = secondary_key -class SubscriptionsDelegationSettingsProperties(_serialization.Model): +class SubscriptionsDelegationSettingsProperties(_serialization.Model): # pylint: disable=name-too-long """Subscriptions delegation settings properties. :ivar enabled: Enable or disable delegation for subscriptions. @@ -18719,7 +18685,7 @@ class TagContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -18865,7 +18831,7 @@ class TagDescriptionContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -19078,7 +19044,7 @@ def __init__( class TagResourceContract(_serialization.Model): """TagResource contract properties. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar tag: Tag associated with the resource. Required. :vartype tag: ~azure.mgmt.apimanagement.models.TagResourceContractProperties @@ -19169,7 +19135,7 @@ class TenantConfigurationSyncStateContract(ProxyResource): # pylint: disable=to Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -19297,7 +19263,7 @@ class TenantSettingsContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -19372,7 +19338,7 @@ def __init__( class TokenBodyParameterContract(_serialization.Model): """OAuth acquire token request body parameter (www-url-form-encoded). - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: body parameter name. Required. :vartype name: str @@ -19447,7 +19413,7 @@ class UserContract(ProxyResource): # pylint: disable=too-many-instance-attribut Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -19664,7 +19630,7 @@ def __init__( class UserCreateParameterProperties(UserEntityBaseParameters): """Parameters supplied to the Create User operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar state: Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state @@ -20235,7 +20201,7 @@ class WikiContract(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_diagnostic_operations.py index ac3816847698..ecbaf566bebc 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_diagnostic_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_diagnostic_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +75,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -124,7 +125,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -168,7 +169,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -220,7 +221,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -276,7 +277,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -330,7 +331,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -391,7 +392,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiagnosticContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.DiagnosticContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -413,7 +413,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -422,12 +422,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -439,13 +438,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DiagnosticCollection", pipeline_response) @@ -455,11 +454,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -472,10 +471,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics" - } - @distributed_trace def get_entity_tag( self, resource_group_name: str, service_name: str, api_id: str, diagnostic_id: str, **kwargs: Any @@ -493,7 +488,6 @@ def get_entity_tag( :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management service instance. Required. :type diagnostic_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -512,23 +506,22 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, diagnostic_id=diagnostic_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -542,13 +535,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, api_id: str, diagnostic_id: str, **kwargs: Any @@ -566,7 +555,6 @@ def get( :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management service instance. Required. :type diagnostic_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -585,23 +573,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, diagnostic_id=diagnostic_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -617,13 +604,9 @@ def get( deserialized = self._deserialize("DiagnosticContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -659,7 +642,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -672,7 +654,7 @@ def create_or_update( service_name: str, api_id: str, diagnostic_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -692,14 +674,13 @@ def create_or_update( service instance. Required. :type diagnostic_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -712,7 +693,7 @@ def create_or_update( service_name: str, api_id: str, diagnostic_id: str, - parameters: Union[_models.DiagnosticContract, IO], + parameters: Union[_models.DiagnosticContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.DiagnosticContract: @@ -729,16 +710,12 @@ def create_or_update( :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management service instance. Required. :type diagnostic_id: str - :param parameters: Create parameters. Is either a DiagnosticContract type or a IO type. + :param parameters: Create parameters. Is either a DiagnosticContract type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO + :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -761,12 +738,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DiagnosticContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -777,16 +754,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -812,10 +788,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" - } - @overload def update( self, @@ -850,7 +822,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -864,7 +835,7 @@ def update( api_id: str, diagnostic_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -886,11 +857,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Diagnostic Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -904,7 +874,7 @@ def update( api_id: str, diagnostic_id: str, if_match: str, - parameters: Union[_models.DiagnosticContract, IO], + parameters: Union[_models.DiagnosticContract, IO[bytes]], **kwargs: Any ) -> _models.DiagnosticContract: """Updates the details of the Diagnostic for an API specified by its identifier. @@ -923,13 +893,9 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Diagnostic Update parameters. Is either a DiagnosticContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Diagnostic Update parameters. Is either a DiagnosticContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO[bytes] :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -952,12 +918,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DiagnosticContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -968,16 +934,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -993,13 +958,9 @@ def update( deserialized = self._deserialize("DiagnosticContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1021,7 +982,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1040,7 +1000,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -1048,16 +1008,15 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1068,8 +1027,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_export_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_export_operations.py index 4577d34f8ffc..16262ba68e82 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_export_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_export_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +71,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["format"] = _SERIALIZER.query("format", format, "str") @@ -130,7 +130,6 @@ def get( :type format: str or ~azure.mgmt.apimanagement.models.ExportFormat :param export: Query parameter required to export the API details. "true" Required. :type export: str or ~azure.mgmt.apimanagement.models.ExportApi - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiExportResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiExportResult :raises ~azure.core.exceptions.HttpResponseError: @@ -149,7 +148,7 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApiExportResult] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -157,16 +156,15 @@ def get( format=format, export=export, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -179,10 +177,6 @@ def get( deserialized = self._deserialize("ApiExportResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_attachment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_attachment_operations.py index e83aae5ef571..97bef2e9b2a2 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_attachment_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_attachment_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +79,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -137,7 +138,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -190,7 +191,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -246,7 +247,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,7 +306,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -371,7 +372,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IssueAttachmentContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.IssueAttachmentContract] @@ -394,7 +394,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -404,12 +404,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -421,13 +420,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("IssueAttachmentCollection", pipeline_response) @@ -437,11 +436,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -454,10 +453,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments" - } - @distributed_trace def get_entity_tag( self, resource_group_name: str, service_name: str, api_id: str, issue_id: str, attachment_id: str, **kwargs: Any @@ -479,7 +474,6 @@ def get_entity_tag( :param attachment_id: Attachment identifier within an Issue. Must be unique in the current Issue. Required. :type attachment_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -498,7 +492,7 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -506,16 +500,15 @@ def get_entity_tag( attachment_id=attachment_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -529,13 +522,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, api_id: str, issue_id: str, attachment_id: str, **kwargs: Any @@ -556,7 +545,6 @@ def get( :param attachment_id: Attachment identifier within an Issue. Must be unique in the current Issue. Required. :type attachment_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueAttachmentContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueAttachmentContract :raises ~azure.core.exceptions.HttpResponseError: @@ -575,7 +563,7 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IssueAttachmentContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -583,16 +571,15 @@ def get( attachment_id=attachment_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -608,13 +595,9 @@ def get( deserialized = self._deserialize("IssueAttachmentContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -654,7 +637,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueAttachmentContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueAttachmentContract :raises ~azure.core.exceptions.HttpResponseError: @@ -668,7 +650,7 @@ def create_or_update( api_id: str, issue_id: str, attachment_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -691,14 +673,13 @@ def create_or_update( Issue. Required. :type attachment_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueAttachmentContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueAttachmentContract :raises ~azure.core.exceptions.HttpResponseError: @@ -712,7 +693,7 @@ def create_or_update( api_id: str, issue_id: str, attachment_id: str, - parameters: Union[_models.IssueAttachmentContract, IO], + parameters: Union[_models.IssueAttachmentContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.IssueAttachmentContract: @@ -732,16 +713,12 @@ def create_or_update( :param attachment_id: Attachment identifier within an Issue. Must be unique in the current Issue. Required. :type attachment_id: str - :param parameters: Create parameters. Is either a IssueAttachmentContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.IssueAttachmentContract or IO + :param parameters: Create parameters. Is either a IssueAttachmentContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.IssueAttachmentContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueAttachmentContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueAttachmentContract :raises ~azure.core.exceptions.HttpResponseError: @@ -764,12 +741,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "IssueAttachmentContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -781,16 +758,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -816,10 +792,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, @@ -850,7 +822,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -869,7 +840,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -878,16 +849,15 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -898,8 +868,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_comment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_comment_operations.py index 82884bb9b349..b51496e88e4e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_comment_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_comment_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +79,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -137,7 +138,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -190,7 +191,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -246,7 +247,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,7 +306,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -371,7 +372,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IssueCommentContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.IssueCommentContract] @@ -394,7 +394,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -404,12 +404,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -421,13 +420,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("IssueCommentCollection", pipeline_response) @@ -437,11 +436,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -454,10 +453,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments" - } - @distributed_trace def get_entity_tag( self, resource_group_name: str, service_name: str, api_id: str, issue_id: str, comment_id: str, **kwargs: Any @@ -479,7 +474,6 @@ def get_entity_tag( :param comment_id: Comment identifier within an Issue. Must be unique in the current Issue. Required. :type comment_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -498,7 +492,7 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -506,16 +500,15 @@ def get_entity_tag( comment_id=comment_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -529,13 +522,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, api_id: str, issue_id: str, comment_id: str, **kwargs: Any @@ -556,7 +545,6 @@ def get( :param comment_id: Comment identifier within an Issue. Must be unique in the current Issue. Required. :type comment_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueCommentContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueCommentContract :raises ~azure.core.exceptions.HttpResponseError: @@ -575,7 +563,7 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IssueCommentContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -583,16 +571,15 @@ def get( comment_id=comment_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -608,13 +595,9 @@ def get( deserialized = self._deserialize("IssueCommentContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -654,7 +637,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueCommentContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueCommentContract :raises ~azure.core.exceptions.HttpResponseError: @@ -668,7 +650,7 @@ def create_or_update( api_id: str, issue_id: str, comment_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -691,14 +673,13 @@ def create_or_update( Required. :type comment_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueCommentContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueCommentContract :raises ~azure.core.exceptions.HttpResponseError: @@ -712,7 +693,7 @@ def create_or_update( api_id: str, issue_id: str, comment_id: str, - parameters: Union[_models.IssueCommentContract, IO], + parameters: Union[_models.IssueCommentContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.IssueCommentContract: @@ -732,16 +713,12 @@ def create_or_update( :param comment_id: Comment identifier within an Issue. Must be unique in the current Issue. Required. :type comment_id: str - :param parameters: Create parameters. Is either a IssueCommentContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.IssueCommentContract or IO + :param parameters: Create parameters. Is either a IssueCommentContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.IssueCommentContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueCommentContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueCommentContract :raises ~azure.core.exceptions.HttpResponseError: @@ -764,12 +741,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "IssueCommentContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -781,16 +758,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -816,10 +792,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, @@ -850,7 +822,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -869,7 +840,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -878,16 +849,15 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -898,8 +868,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_operations.py index d0516701505d..6a82c1c76e79 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +76,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -129,7 +130,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -180,7 +181,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand_comments_attachments is not None: @@ -236,7 +237,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -292,7 +293,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -346,7 +347,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -411,7 +412,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IssueContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.IssueContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -433,7 +433,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -443,12 +443,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -460,13 +459,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("IssueCollection", pipeline_response) @@ -476,11 +475,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -493,10 +492,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues" - } - @distributed_trace def get_entity_tag( self, resource_group_name: str, service_name: str, api_id: str, issue_id: str, **kwargs: Any @@ -514,7 +509,6 @@ def get_entity_tag( :param issue_id: Issue identifier. Must be unique in the current API Management service instance. Required. :type issue_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -533,23 +527,22 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, issue_id=issue_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -563,13 +556,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" - } - @distributed_trace def get( self, @@ -595,7 +584,6 @@ def get( :type issue_id: str :param expand_comments_attachments: Expand the comment attachments. Default value is None. :type expand_comments_attachments: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueContract :raises ~azure.core.exceptions.HttpResponseError: @@ -614,7 +602,7 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IssueContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -622,16 +610,15 @@ def get( subscription_id=self._config.subscription_id, expand_comments_attachments=expand_comments_attachments, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -647,13 +634,9 @@ def get( deserialized = self._deserialize("IssueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -689,7 +672,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueContract :raises ~azure.core.exceptions.HttpResponseError: @@ -702,7 +684,7 @@ def create_or_update( service_name: str, api_id: str, issue_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -722,14 +704,13 @@ def create_or_update( instance. Required. :type issue_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueContract :raises ~azure.core.exceptions.HttpResponseError: @@ -742,7 +723,7 @@ def create_or_update( service_name: str, api_id: str, issue_id: str, - parameters: Union[_models.IssueContract, IO], + parameters: Union[_models.IssueContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.IssueContract: @@ -759,15 +740,12 @@ def create_or_update( :param issue_id: Issue identifier. Must be unique in the current API Management service instance. Required. :type issue_id: str - :param parameters: Create parameters. Is either a IssueContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.IssueContract or IO + :param parameters: Create parameters. Is either a IssueContract type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.apimanagement.models.IssueContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueContract :raises ~azure.core.exceptions.HttpResponseError: @@ -790,12 +768,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "IssueContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -806,16 +784,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -841,10 +818,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" - } - @overload def update( self, @@ -879,7 +852,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueContract :raises ~azure.core.exceptions.HttpResponseError: @@ -893,7 +865,7 @@ def update( api_id: str, issue_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -915,11 +887,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueContract :raises ~azure.core.exceptions.HttpResponseError: @@ -933,7 +904,7 @@ def update( api_id: str, issue_id: str, if_match: str, - parameters: Union[_models.IssueUpdateContract, IO], + parameters: Union[_models.IssueUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.IssueContract: """Updates an existing issue for an API. @@ -952,13 +923,9 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a IssueUpdateContract type or a IO type. + :param parameters: Update parameters. Is either a IssueUpdateContract type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.IssueUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :type parameters: ~azure.mgmt.apimanagement.models.IssueUpdateContract or IO[bytes] :return: IssueContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueContract :raises ~azure.core.exceptions.HttpResponseError: @@ -981,12 +948,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "IssueUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -997,16 +964,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1022,13 +988,9 @@ def update( deserialized = self._deserialize("IssueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1050,7 +1012,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1069,7 +1030,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -1077,16 +1038,15 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1097,8 +1057,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_client_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_client_operations.py index d3497caf1643..d81a58ffebf8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_client_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_client_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -66,7 +67,7 @@ def build_perform_connectivity_check_async_request( # pylint: disable=name-too- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,7 +85,7 @@ def _perform_connectivity_check_async_initial( # pylint: disable=name-too-long self, resource_group_name: str, service_name: str, - connectivity_check_request_params: Union[_models.ConnectivityCheckRequest, IO], + connectivity_check_request_params: Union[_models.ConnectivityCheckRequest, IO[bytes]], **kwargs: Any ) -> Optional[_models.ConnectivityCheckResponse]: error_map = { @@ -105,12 +106,12 @@ def _perform_connectivity_check_async_initial( # pylint: disable=name-too-long content_type = content_type or "application/json" _json = None _content = None - if isinstance(connectivity_check_request_params, (IO, bytes)): + if isinstance(connectivity_check_request_params, (IOBase, bytes)): _content = connectivity_check_request_params else: _json = self._serialize.body(connectivity_check_request_params, "ConnectivityCheckRequest") - request = build_perform_connectivity_check_async_request( + _request = build_perform_connectivity_check_async_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -118,16 +119,15 @@ def _perform_connectivity_check_async_initial( # pylint: disable=name-too-long content_type=content_type, json=_json, content=_content, - template_url=self._perform_connectivity_check_async_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -142,13 +142,9 @@ def _perform_connectivity_check_async_initial( # pylint: disable=name-too-long deserialized = self._deserialize("ConnectivityCheckResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _perform_connectivity_check_async_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/connectivityCheck" - } + return deserialized # type: ignore @overload def begin_perform_connectivity_check_async( @@ -174,14 +170,6 @@ def begin_perform_connectivity_check_async( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ConnectivityCheckResponse or the result of cls(response) :rtype: @@ -194,7 +182,7 @@ def begin_perform_connectivity_check_async( self, resource_group_name: str, service_name: str, - connectivity_check_request_params: IO, + connectivity_check_request_params: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -208,18 +196,10 @@ def begin_perform_connectivity_check_async( :param service_name: The name of the API Management service. Required. :type service_name: str :param connectivity_check_request_params: Connectivity Check request parameters. Required. - :type connectivity_check_request_params: IO + :type connectivity_check_request_params: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ConnectivityCheckResponse or the result of cls(response) :rtype: @@ -232,7 +212,7 @@ def begin_perform_connectivity_check_async( self, resource_group_name: str, service_name: str, - connectivity_check_request_params: Union[_models.ConnectivityCheckRequest, IO], + connectivity_check_request_params: Union[_models.ConnectivityCheckRequest, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ConnectivityCheckResponse]: """Performs a connectivity check between the API Management service and a given destination, and @@ -244,20 +224,9 @@ def begin_perform_connectivity_check_async( :param service_name: The name of the API Management service. Required. :type service_name: str :param connectivity_check_request_params: Connectivity Check request parameters. Is either a - ConnectivityCheckRequest type or a IO type. Required. + ConnectivityCheckRequest type or a IO[bytes] type. Required. :type connectivity_check_request_params: - ~azure.mgmt.apimanagement.models.ConnectivityCheckRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ~azure.mgmt.apimanagement.models.ConnectivityCheckRequest or IO[bytes] :return: An instance of LROPoller that returns either ConnectivityCheckResponse or the result of cls(response) :rtype: @@ -290,7 +259,7 @@ def begin_perform_connectivity_check_async( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ConnectivityCheckResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -302,14 +271,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ConnectivityCheckResponse].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_perform_connectivity_check_async.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/connectivityCheck" - } + return LROPoller[_models.ConnectivityCheckResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_operations_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_operations_operations.py index 848cee0fc764..919ae35e4639 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_operations_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_operations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -78,7 +78,6 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """Lists all of the available REST API operations of the Microsoft.ApiManagement provider. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -100,14 +99,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +117,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -135,11 +133,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,5 +149,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ApiManagement/operations"} diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_service_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_service_operations.py index b877c4f56dd7..6aefc4c75dbe 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_service_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_service_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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 @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +69,7 @@ def build_restore_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,7 +112,7 @@ def build_backup_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -154,7 +155,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -197,7 +198,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,7 +238,7 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -277,7 +278,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -317,7 +318,7 @@ def build_migrate_to_stv2_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -347,7 +348,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -371,7 +372,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -411,7 +412,7 @@ def build_get_sso_token_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -438,7 +439,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -468,7 +469,7 @@ def build_get_domain_ownership_identifier_request( # pylint: disable=name-too-l "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -509,7 +510,7 @@ def build_apply_network_configuration_updates_request( # pylint: disable=name-t "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -545,7 +546,7 @@ def _restore_initial( self, resource_group_name: str, service_name: str, - parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO], + parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO[bytes]], **kwargs: Any ) -> Optional[_models.ApiManagementServiceResource]: error_map = { @@ -566,12 +567,12 @@ def _restore_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiManagementServiceBackupRestoreParameters") - request = build_restore_request( + _request = build_restore_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -579,16 +580,15 @@ def _restore_initial( content_type=content_type, json=_json, content=_content, - template_url=self._restore_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -607,13 +607,9 @@ def _restore_initial( response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _restore_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore" - } + return deserialized # type: ignore @overload def begin_restore( @@ -640,14 +636,6 @@ def begin_restore( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -660,7 +648,7 @@ def begin_restore( self, resource_group_name: str, service_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -676,18 +664,10 @@ def begin_restore( :type service_name: str :param parameters: Parameters supplied to the Restore API Management service from backup operation. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -700,7 +680,7 @@ def begin_restore( self, resource_group_name: str, service_name: str, - parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO], + parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ApiManagementServiceResource]: """Restores a backup of an API Management service created using the ApiManagementService_Backup @@ -713,20 +693,10 @@ def begin_restore( :param service_name: The name of the API Management service. Required. :type service_name: str :param parameters: Parameters supplied to the Restore API Management service from backup - operation. Is either a ApiManagementServiceBackupRestoreParameters type or a IO type. Required. + operation. Is either a ApiManagementServiceBackupRestoreParameters type or a IO[bytes] type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceBackupRestoreParameters - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or IO[bytes] :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -759,7 +729,7 @@ def begin_restore( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -771,23 +741,21 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ApiManagementServiceResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_restore.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore" - } + return LROPoller[_models.ApiManagementServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _backup_initial( self, resource_group_name: str, service_name: str, - parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO], + parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO[bytes]], **kwargs: Any ) -> Optional[_models.ApiManagementServiceResource]: error_map = { @@ -808,12 +776,12 @@ def _backup_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiManagementServiceBackupRestoreParameters") - request = build_backup_request( + _request = build_backup_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -821,16 +789,15 @@ def _backup_initial( content_type=content_type, json=_json, content=_content, - template_url=self._backup_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -849,13 +816,9 @@ def _backup_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _backup_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup" - } + return deserialized # type: ignore @overload def begin_backup( @@ -880,14 +843,6 @@ def begin_backup( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -900,7 +855,7 @@ def begin_backup( self, resource_group_name: str, service_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -914,18 +869,10 @@ def begin_backup( :param service_name: The name of the API Management service. Required. :type service_name: str :param parameters: Parameters supplied to the ApiManagementService_Backup operation. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -938,7 +885,7 @@ def begin_backup( self, resource_group_name: str, service_name: str, - parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO], + parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ApiManagementServiceResource]: """Creates a backup of the API Management service to the given Azure Storage Account. This is long @@ -950,20 +897,9 @@ def begin_backup( :param service_name: The name of the API Management service. Required. :type service_name: str :param parameters: Parameters supplied to the ApiManagementService_Backup operation. Is either - a ApiManagementServiceBackupRestoreParameters type or a IO type. Required. + a ApiManagementServiceBackupRestoreParameters type or a IO[bytes] type. Required. :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceBackupRestoreParameters - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or IO[bytes] :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -996,7 +932,7 @@ def begin_backup( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1008,23 +944,21 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ApiManagementServiceResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_backup.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup" - } + return LROPoller[_models.ApiManagementServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _create_or_update_initial( self, resource_group_name: str, service_name: str, - parameters: Union[_models.ApiManagementServiceResource, IO], + parameters: Union[_models.ApiManagementServiceResource, IO[bytes]], **kwargs: Any ) -> _models.ApiManagementServiceResource: error_map = { @@ -1045,12 +979,12 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiManagementServiceResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -1058,16 +992,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1088,10 +1021,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" - } - @overload def begin_create_or_update( self, @@ -1116,14 +1045,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -1136,7 +1057,7 @@ def begin_create_or_update( self, resource_group_name: str, service_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1151,18 +1072,10 @@ def begin_create_or_update( :type service_name: str :param parameters: Parameters supplied to the CreateOrUpdate API Management service operation. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -1175,7 +1088,7 @@ def begin_create_or_update( self, resource_group_name: str, service_name: str, - parameters: Union[_models.ApiManagementServiceResource, IO], + parameters: Union[_models.ApiManagementServiceResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ApiManagementServiceResource]: """Creates or updates an API Management service. This is long running operation and could take @@ -1187,19 +1100,8 @@ def begin_create_or_update( :param service_name: The name of the API Management service. Required. :type service_name: str :param parameters: Parameters supplied to the CreateOrUpdate API Management service operation. - Is either a ApiManagementServiceResource type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + Is either a ApiManagementServiceResource type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceResource or IO[bytes] :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -1232,7 +1134,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1242,23 +1144,21 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ApiManagementServiceResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" - } + return LROPoller[_models.ApiManagementServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, resource_group_name: str, service_name: str, - parameters: Union[_models.ApiManagementServiceUpdateParameters, IO], + parameters: Union[_models.ApiManagementServiceUpdateParameters, IO[bytes]], **kwargs: Any ) -> Optional[_models.ApiManagementServiceResource]: error_map = { @@ -1279,12 +1179,12 @@ def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiManagementServiceUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -1292,16 +1192,15 @@ def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1316,13 +1215,9 @@ def _update_initial( deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -1347,14 +1242,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -1367,7 +1254,7 @@ def begin_update( self, resource_group_name: str, service_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1381,18 +1268,10 @@ def begin_update( :type service_name: str :param parameters: Parameters supplied to the CreateOrUpdate API Management service operation. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -1405,7 +1284,7 @@ def begin_update( self, resource_group_name: str, service_name: str, - parameters: Union[_models.ApiManagementServiceUpdateParameters, IO], + parameters: Union[_models.ApiManagementServiceUpdateParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ApiManagementServiceResource]: """Updates an existing API Management service. @@ -1416,19 +1295,9 @@ def begin_update( :param service_name: The name of the API Management service. Required. :type service_name: str :param parameters: Parameters supplied to the CreateOrUpdate API Management service operation. - Is either a ApiManagementServiceUpdateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + Is either a ApiManagementServiceUpdateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceUpdateParameters or + IO[bytes] :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -1461,7 +1330,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1471,17 +1340,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ApiManagementServiceResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" - } + return LROPoller[_models.ApiManagementServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.ApiManagementServiceResource: @@ -1492,7 +1359,6 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiManagementServiceResource or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceResource :raises ~azure.core.exceptions.HttpResponseError: @@ -1511,21 +1377,20 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1538,13 +1403,9 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" - } + return deserialized # type: ignore def _delete_initial( self, resource_group_name: str, service_name: str, **kwargs: Any @@ -1563,21 +1424,20 @@ def _delete_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1592,13 +1452,9 @@ def _delete_initial( deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -1611,14 +1467,6 @@ def begin_delete( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -1648,7 +1496,7 @@ def begin_delete( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1658,17 +1506,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ApiManagementServiceResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" - } + return LROPoller[_models.ApiManagementServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _migrate_to_stv2_initial( self, resource_group_name: str, service_name: str, **kwargs: Any @@ -1687,21 +1533,20 @@ def _migrate_to_stv2_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None) - request = build_migrate_to_stv2_request( + _request = build_migrate_to_stv2_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._migrate_to_stv2_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1720,13 +1565,9 @@ def _migrate_to_stv2_initial( response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _migrate_to_stv2_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/migrateToStv2" - } + return deserialized # type: ignore @distributed_trace def begin_migrate_to_stv2( @@ -1741,14 +1582,6 @@ def begin_migrate_to_stv2( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -1778,7 +1611,7 @@ def begin_migrate_to_stv2( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1790,17 +1623,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ApiManagementServiceResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_migrate_to_stv2.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/migrateToStv2" - } + return LROPoller[_models.ApiManagementServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_by_resource_group( @@ -1811,7 +1642,6 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -1835,16 +1665,15 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1856,13 +1685,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ApiManagementServiceListResult", pipeline_response) @@ -1872,11 +1701,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1889,15 +1718,10 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service" - } - @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.ApiManagementServiceResource"]: """Lists all API Management services within an Azure subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -1921,15 +1745,14 @@ def list(self, **kwargs: Any) -> Iterable["_models.ApiManagementServiceResource" def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1941,13 +1764,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ApiManagementServiceListResult", pipeline_response) @@ -1957,11 +1780,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1974,8 +1797,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service"} - @distributed_trace def get_sso_token( self, resource_group_name: str, service_name: str, **kwargs: Any @@ -1987,7 +1808,6 @@ def get_sso_token( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiManagementServiceGetSsoTokenResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceGetSsoTokenResult :raises ~azure.core.exceptions.HttpResponseError: @@ -2006,21 +1826,20 @@ def get_sso_token( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApiManagementServiceGetSsoTokenResult] = kwargs.pop("cls", None) - request = build_get_sso_token_request( + _request = build_get_sso_token_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_sso_token.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2033,13 +1852,9 @@ def get_sso_token( deserialized = self._deserialize("ApiManagementServiceGetSsoTokenResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_sso_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/getssotoken" - } + return deserialized # type: ignore @overload def check_name_availability( @@ -2057,7 +1872,6 @@ def check_name_availability( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiManagementServiceNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: @@ -2065,16 +1879,15 @@ def check_name_availability( @overload def check_name_availability( - self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.ApiManagementServiceNameAvailabilityResult: """Checks availability and correctness of a name for an API Management service. :param parameters: Parameters supplied to the CheckNameAvailability operation. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiManagementServiceNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: @@ -2082,18 +1895,15 @@ def check_name_availability( @distributed_trace def check_name_availability( - self, parameters: Union[_models.ApiManagementServiceCheckNameAvailabilityParameters, IO], **kwargs: Any + self, parameters: Union[_models.ApiManagementServiceCheckNameAvailabilityParameters, IO[bytes]], **kwargs: Any ) -> _models.ApiManagementServiceNameAvailabilityResult: """Checks availability and correctness of a name for an API Management service. :param parameters: Parameters supplied to the CheckNameAvailability operation. Is either a - ApiManagementServiceCheckNameAvailabilityParameters type or a IO type. Required. + ApiManagementServiceCheckNameAvailabilityParameters type or a IO[bytes] type. Required. :type parameters: - ~azure.mgmt.apimanagement.models.ApiManagementServiceCheckNameAvailabilityParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.apimanagement.models.ApiManagementServiceCheckNameAvailabilityParameters or + IO[bytes] :return: ApiManagementServiceNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: @@ -2116,27 +1926,26 @@ def check_name_availability( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiManagementServiceCheckNameAvailabilityParameters") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2149,13 +1958,9 @@ def check_name_availability( deserialized = self._deserialize("ApiManagementServiceNameAvailabilityResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability" - } + return deserialized # type: ignore @distributed_trace def get_domain_ownership_identifier( @@ -2163,7 +1968,6 @@ def get_domain_ownership_identifier( ) -> _models.ApiManagementServiceGetDomainOwnershipIdentifierResult: """Get the custom domain ownership identifier for an API Management service. - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiManagementServiceGetDomainOwnershipIdentifierResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceGetDomainOwnershipIdentifierResult :raises ~azure.core.exceptions.HttpResponseError: @@ -2182,19 +1986,18 @@ def get_domain_ownership_identifier( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApiManagementServiceGetDomainOwnershipIdentifierResult] = kwargs.pop("cls", None) - request = build_get_domain_ownership_identifier_request( + _request = build_get_domain_ownership_identifier_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_domain_ownership_identifier.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2207,19 +2010,15 @@ def get_domain_ownership_identifier( deserialized = self._deserialize("ApiManagementServiceGetDomainOwnershipIdentifierResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_domain_ownership_identifier.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier" - } + return deserialized # type: ignore def _apply_network_configuration_updates_initial( # pylint: disable=name-too-long self, resource_group_name: str, service_name: str, - parameters: Optional[Union[_models.ApiManagementServiceApplyNetworkConfigurationParameters, IO]] = None, + parameters: Optional[Union[_models.ApiManagementServiceApplyNetworkConfigurationParameters, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.ApiManagementServiceResource]: error_map = { @@ -2240,7 +2039,7 @@ def _apply_network_configuration_updates_initial( # pylint: disable=name-too-lo content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: if parameters is not None: @@ -2248,7 +2047,7 @@ def _apply_network_configuration_updates_initial( # pylint: disable=name-too-lo else: _json = None - request = build_apply_network_configuration_updates_request( + _request = build_apply_network_configuration_updates_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -2256,16 +2055,15 @@ def _apply_network_configuration_updates_initial( # pylint: disable=name-too-lo content_type=content_type, json=_json, content=_content, - template_url=self._apply_network_configuration_updates_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2284,13 +2082,9 @@ def _apply_network_configuration_updates_initial( # pylint: disable=name-too-lo response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _apply_network_configuration_updates_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates" - } + return deserialized # type: ignore @overload def begin_apply_network_configuration_updates( # pylint: disable=name-too-long @@ -2318,14 +2112,6 @@ def begin_apply_network_configuration_updates( # pylint: disable=name-too-long :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -2338,7 +2124,7 @@ def begin_apply_network_configuration_updates( # pylint: disable=name-too-long self, resource_group_name: str, service_name: str, - parameters: Optional[IO] = None, + parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -2354,18 +2140,10 @@ def begin_apply_network_configuration_updates( # pylint: disable=name-too-long :param parameters: Parameters supplied to the Apply Network Configuration operation. If the parameters are empty, all the regions in which the Api Management service is deployed will be updated sequentially without incurring downtime in the region. Default value is None. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -2378,7 +2156,7 @@ def begin_apply_network_configuration_updates( # pylint: disable=name-too-long self, resource_group_name: str, service_name: str, - parameters: Optional[Union[_models.ApiManagementServiceApplyNetworkConfigurationParameters, IO]] = None, + parameters: Optional[Union[_models.ApiManagementServiceApplyNetworkConfigurationParameters, IO[bytes]]] = None, **kwargs: Any ) -> LROPoller[_models.ApiManagementServiceResource]: """Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated @@ -2392,21 +2170,11 @@ def begin_apply_network_configuration_updates( # pylint: disable=name-too-long :param parameters: Parameters supplied to the Apply Network Configuration operation. If the parameters are empty, all the regions in which the Api Management service is deployed will be updated sequentially without incurring downtime in the region. Is either a - ApiManagementServiceApplyNetworkConfigurationParameters type or a IO type. Default value is - None. + ApiManagementServiceApplyNetworkConfigurationParameters type or a IO[bytes] type. Default value + is None. :type parameters: - ~azure.mgmt.apimanagement.models.ApiManagementServiceApplyNetworkConfigurationParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ~azure.mgmt.apimanagement.models.ApiManagementServiceApplyNetworkConfigurationParameters or + IO[bytes] :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) :rtype: @@ -2439,7 +2207,7 @@ def begin_apply_network_configuration_updates( # pylint: disable=name-too-long def get_long_running_output(pipeline_response): deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -2451,14 +2219,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ApiManagementServiceResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_apply_network_configuration_updates.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates" - } + return LROPoller[_models.ApiManagementServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_service_skus_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_service_skus_operations.py index f7664828c143..7f078f145606 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_service_skus_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_service_skus_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +65,7 @@ def build_list_available_service_skus_request( # pylint: disable=name-too-long "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,7 +108,6 @@ def list_available_service_skus( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceSkuResult or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ResourceSkuResult] :raises ~azure.core.exceptions.HttpResponseError: @@ -130,17 +129,16 @@ def list_available_service_skus( def prepare_request(next_link=None): if not next_link: - request = build_list_available_service_skus_request( + _request = build_list_available_service_skus_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_available_service_skus.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -152,13 +150,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ResourceSkuResults", pipeline_response) @@ -168,11 +166,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -184,7 +182,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_available_service_skus.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/skus" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_skus_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_skus_operations.py index 03a09b61a5bc..7135f407127f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_skus_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_skus_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +83,6 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.ApiManagementSku"]: """Gets the list of Microsoft.ApiManagement SKUs available for your Subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiManagementSku or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiManagementSku] :raises ~azure.core.exceptions.HttpResponseError: @@ -105,15 +104,14 @@ def list(self, **kwargs: Any) -> Iterable["_models.ApiManagementSku"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -125,13 +123,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ApiManagementSkusResult", pipeline_response) @@ -141,11 +139,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -157,5 +155,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/skus"} diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operation_operations.py index 5605a6f1ebfc..5e83bbee5da7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operation_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operation_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +76,7 @@ def build_list_by_api_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -125,7 +126,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -167,7 +168,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -217,7 +218,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -271,7 +272,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -323,7 +324,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -391,7 +392,6 @@ def list_by_api( :type skip: int :param tags: Include tags in the response. Default value is None. :type tags: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.OperationContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -413,7 +413,7 @@ def list_by_api( def prepare_request(next_link=None): if not next_link: - request = build_list_by_api_request( + _request = build_list_by_api_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -423,12 +423,11 @@ def prepare_request(next_link=None): skip=skip, tags=tags, api_version=api_version, - template_url=self.list_by_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -440,13 +439,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("OperationCollection", pipeline_response) @@ -456,11 +455,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -473,10 +472,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations" - } - @distributed_trace def get_entity_tag( self, resource_group_name: str, service_name: str, api_id: str, operation_id: str, **kwargs: Any @@ -494,7 +489,6 @@ def get_entity_tag( :param operation_id: Operation identifier within an API. Must be unique in the current API Management service instance. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -513,23 +507,22 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -543,13 +536,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, api_id: str, operation_id: str, **kwargs: Any @@ -567,7 +556,6 @@ def get( :param operation_id: Operation identifier within an API. Must be unique in the current API Management service instance. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OperationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -586,23 +574,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -618,13 +605,9 @@ def get( deserialized = self._deserialize("OperationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -660,7 +643,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OperationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -673,7 +655,7 @@ def create_or_update( service_name: str, api_id: str, operation_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -693,14 +675,13 @@ def create_or_update( Management service instance. Required. :type operation_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OperationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -713,7 +694,7 @@ def create_or_update( service_name: str, api_id: str, operation_id: str, - parameters: Union[_models.OperationContract, IO], + parameters: Union[_models.OperationContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.OperationContract: @@ -730,16 +711,12 @@ def create_or_update( :param operation_id: Operation identifier within an API. Must be unique in the current API Management service instance. Required. :type operation_id: str - :param parameters: Create parameters. Is either a OperationContract type or a IO type. + :param parameters: Create parameters. Is either a OperationContract type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.OperationContract or IO + :type parameters: ~azure.mgmt.apimanagement.models.OperationContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OperationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -762,12 +739,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "OperationContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -778,16 +755,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -813,10 +789,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" - } - @overload def update( self, @@ -851,7 +823,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OperationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -865,7 +836,7 @@ def update( api_id: str, operation_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -887,11 +858,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: API Operation Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OperationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -905,7 +875,7 @@ def update( api_id: str, operation_id: str, if_match: str, - parameters: Union[_models.OperationUpdateContract, IO], + parameters: Union[_models.OperationUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.OperationContract: """Updates the details of the operation in the API specified by its identifier. @@ -925,12 +895,8 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: API Operation Update parameters. Is either a OperationUpdateContract type or - a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.OperationUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.OperationUpdateContract or IO[bytes] :return: OperationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OperationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -953,12 +919,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "OperationUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -969,16 +935,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -994,13 +959,9 @@ def update( deserialized = self._deserialize("OperationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1022,7 +983,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1041,7 +1001,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -1049,16 +1009,15 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1069,8 +1028,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operation_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operation_policy_operations.py index 6e55c32f30cf..44a0df196c4a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operation_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operation_policy_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +66,7 @@ def build_list_by_operation_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +115,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,7 +166,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if format is not None: @@ -219,7 +220,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -274,7 +275,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -322,7 +323,6 @@ def list_by_operation( :param operation_id: Operation identifier within an API. Must be unique in the current API Management service instance. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -341,23 +341,22 @@ def list_by_operation( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None) - request = build_list_by_operation_request( + _request = build_list_by_operation_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_operation.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -370,13 +369,9 @@ def list_by_operation( deserialized = self._deserialize("PolicyCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_operation.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies" - } + return deserialized # type: ignore @distributed_trace def get_entity_tag( @@ -403,7 +398,6 @@ def get_entity_tag( :type operation_id: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -422,7 +416,7 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -430,16 +424,15 @@ def get_entity_tag( policy_id=policy_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -453,13 +446,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}" - } - @distributed_trace def get( self, @@ -489,7 +478,6 @@ def get( :param format: Policy Export Format. Known values are: "xml" and "rawxml". Default value is "xml". :type format: str or ~azure.mgmt.apimanagement.models.PolicyExportFormat - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -508,7 +496,7 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -517,16 +505,15 @@ def get( subscription_id=self._config.subscription_id, format=format, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -542,13 +529,9 @@ def get( deserialized = self._deserialize("PolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -587,7 +570,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -601,7 +583,7 @@ def create_or_update( api_id: str, operation_id: str, policy_id: Union[str, _models.PolicyIdName], - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -623,14 +605,13 @@ def create_or_update( :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName :param parameters: The policy contents to apply. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -644,7 +625,7 @@ def create_or_update( api_id: str, operation_id: str, policy_id: Union[str, _models.PolicyIdName], - parameters: Union[_models.PolicyContract, IO], + parameters: Union[_models.PolicyContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.PolicyContract: @@ -663,16 +644,12 @@ def create_or_update( :type operation_id: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO + :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -695,12 +672,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PolicyContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -712,16 +689,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -747,10 +723,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, @@ -780,7 +752,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -799,7 +770,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -808,16 +779,15 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -828,8 +798,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operations.py index e9331ff4cf3c..476aa94e9030 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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 @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +77,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -127,7 +128,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -168,7 +169,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -216,7 +217,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -262,7 +263,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -313,7 +314,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if delete_revisions is not None: @@ -364,7 +365,7 @@ def build_list_by_tags_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -442,7 +443,6 @@ def list_by_service( :param expand_api_version_set: Include full ApiVersionSet resource in response. Default value is None. :type expand_api_version_set: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -464,7 +464,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -474,12 +474,11 @@ def prepare_request(next_link=None): tags=tags, expand_api_version_set=expand_api_version_set, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -491,13 +490,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ApiCollection", pipeline_response) @@ -507,11 +506,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -524,10 +523,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis" - } - @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, api_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the API specified by its identifier. @@ -540,7 +535,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, api_id: st :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -559,22 +553,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, api_id: st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -588,13 +581,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, api_id: st response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" - } - @distributed_trace def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs: Any) -> _models.ApiContract: """Gets the details of the API specified by its identifier. @@ -607,7 +596,6 @@ def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -626,22 +614,21 @@ def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApiContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -657,20 +644,16 @@ def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs deserialized = self._deserialize("ApiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, service_name: str, api_id: str, - parameters: Union[_models.ApiCreateOrUpdateParameter, IO], + parameters: Union[_models.ApiCreateOrUpdateParameter, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> Optional[_models.ApiContract]: @@ -692,12 +675,12 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiCreateOrUpdateParameter") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -707,16 +690,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -739,13 +721,9 @@ def _create_or_update_initial( deserialized = self._deserialize("ApiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -777,14 +755,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ApiContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiContract] @@ -797,7 +767,7 @@ def begin_create_or_update( resource_group_name: str, service_name: str, api_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -814,21 +784,13 @@ def begin_create_or_update( instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required. :type api_id: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ApiContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiContract] @@ -841,7 +803,7 @@ def begin_create_or_update( resource_group_name: str, service_name: str, api_id: str, - parameters: Union[_models.ApiCreateOrUpdateParameter, IO], + parameters: Union[_models.ApiCreateOrUpdateParameter, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> LROPoller[_models.ApiContract]: @@ -856,22 +818,11 @@ def begin_create_or_update( instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required. :type api_id: str :param parameters: Create or update parameters. Is either a ApiCreateOrUpdateParameter type or - a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ApiCreateOrUpdateParameter or IO + a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ApiCreateOrUpdateParameter or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ApiContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiContract] @@ -909,7 +860,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("ApiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -921,17 +872,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ApiContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" - } + return LROPoller[_models.ApiContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update( @@ -963,7 +912,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -976,7 +924,7 @@ def update( service_name: str, api_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -995,11 +943,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: API Update Contract parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1012,7 +959,7 @@ def update( service_name: str, api_id: str, if_match: str, - parameters: Union[_models.ApiUpdateContract, IO], + parameters: Union[_models.ApiUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.ApiContract: """Updates the specified API of the API Management service instance. @@ -1028,13 +975,9 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: API Update Contract parameters. Is either a ApiUpdateContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ApiUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: API Update Contract parameters. Is either a ApiUpdateContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ApiUpdateContract or IO[bytes] :return: ApiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1057,12 +1000,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -1072,16 +1015,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1097,13 +1039,9 @@ def update( deserialized = self._deserialize("ApiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1130,7 +1068,6 @@ def delete( # pylint: disable=inconsistent-return-statements :type if_match: str :param delete_revisions: Delete all revisions of the Api. Default value is None. :type delete_revisions: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1149,7 +1086,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -1157,16 +1094,15 @@ def delete( # pylint: disable=inconsistent-return-statements if_match=if_match, delete_revisions=delete_revisions, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1177,11 +1113,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_by_tags( @@ -1218,7 +1150,6 @@ def list_by_tags( :type skip: int :param include_not_tagged_apis: Include not tagged APIs. Default value is None. :type include_not_tagged_apis: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TagResourceContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagResourceContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -1240,7 +1171,7 @@ def list_by_tags( def prepare_request(next_link=None): if not next_link: - request = build_list_by_tags_request( + _request = build_list_by_tags_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -1249,12 +1180,11 @@ def prepare_request(next_link=None): skip=skip, include_not_tagged_apis=include_not_tagged_apis, api_version=api_version, - template_url=self.list_by_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1266,13 +1196,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("TagResourceCollection", pipeline_response) @@ -1282,11 +1212,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1298,7 +1228,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apisByTags" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_policy_operations.py index 4bf7acd3ae85..79942f86e7a9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_policy_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +65,7 @@ def build_list_by_api_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,7 +112,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -163,7 +164,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if format is not None: @@ -215,7 +216,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -268,7 +269,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -313,7 +314,6 @@ def list_by_api( :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -332,22 +332,21 @@ def list_by_api( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None) - request = build_list_by_api_request( + _request = build_list_by_api_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -360,13 +359,9 @@ def list_by_api( deserialized = self._deserialize("PolicyCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies" - } + return deserialized # type: ignore @distributed_trace def get_entity_tag( @@ -389,7 +384,6 @@ def get_entity_tag( :type api_id: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -408,23 +402,22 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, policy_id=policy_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -438,13 +431,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}" - } - @distributed_trace def get( self, @@ -470,7 +459,6 @@ def get( :param format: Policy Export Format. Known values are: "xml" and "rawxml". Default value is "xml". :type format: str or ~azure.mgmt.apimanagement.models.PolicyExportFormat - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -489,7 +477,7 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -497,16 +485,15 @@ def get( subscription_id=self._config.subscription_id, format=format, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -532,10 +519,6 @@ def get( return deserialized # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}" - } - @overload def create_or_update( self, @@ -569,7 +552,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -582,7 +564,7 @@ def create_or_update( service_name: str, api_id: str, policy_id: Union[str, _models.PolicyIdName], - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -601,14 +583,13 @@ def create_or_update( :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName :param parameters: The policy contents to apply. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -621,7 +602,7 @@ def create_or_update( service_name: str, api_id: str, policy_id: Union[str, _models.PolicyIdName], - parameters: Union[_models.PolicyContract, IO], + parameters: Union[_models.PolicyContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.PolicyContract: @@ -637,16 +618,12 @@ def create_or_update( :type api_id: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO + :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -669,12 +646,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PolicyContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -685,16 +662,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -720,10 +696,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, @@ -749,7 +721,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -768,7 +739,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -776,16 +747,15 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -796,8 +766,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_product_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_product_operations.py index fd4c86eb0428..ce925bce9e22 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_product_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_product_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +74,7 @@ def build_list_by_apis_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -140,7 +140,6 @@ def list_by_apis( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProductContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ProductContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -162,7 +161,7 @@ def list_by_apis( def prepare_request(next_link=None): if not next_link: - request = build_list_by_apis_request( + _request = build_list_by_apis_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -171,12 +170,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_apis.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -188,13 +186,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ProductCollection", pipeline_response) @@ -204,11 +202,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -220,7 +218,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_apis.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/products" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_release_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_release_operations.py index 9942c64de602..26da086fdbee 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_release_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_release_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +75,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -124,7 +125,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -168,7 +169,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -220,7 +221,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -276,7 +277,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -330,7 +331,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -393,7 +394,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiReleaseContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiReleaseContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -415,7 +415,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -424,12 +424,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -441,13 +440,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ApiReleaseCollection", pipeline_response) @@ -457,11 +456,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -474,10 +473,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases" - } - @distributed_trace def get_entity_tag( self, resource_group_name: str, service_name: str, api_id: str, release_id: str, **kwargs: Any @@ -495,7 +490,6 @@ def get_entity_tag( :param release_id: Release identifier within an API. Must be unique in the current API Management service instance. Required. :type release_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -514,23 +508,22 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, release_id=release_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -544,13 +537,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, api_id: str, release_id: str, **kwargs: Any @@ -568,7 +557,6 @@ def get( :param release_id: Release identifier within an API. Must be unique in the current API Management service instance. Required. :type release_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiReleaseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -587,23 +575,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApiReleaseContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, release_id=release_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -619,13 +606,9 @@ def get( deserialized = self._deserialize("ApiReleaseContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -661,7 +644,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiReleaseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -674,7 +656,7 @@ def create_or_update( service_name: str, api_id: str, release_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -694,14 +676,13 @@ def create_or_update( Management service instance. Required. :type release_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiReleaseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -714,7 +695,7 @@ def create_or_update( service_name: str, api_id: str, release_id: str, - parameters: Union[_models.ApiReleaseContract, IO], + parameters: Union[_models.ApiReleaseContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.ApiReleaseContract: @@ -731,16 +712,12 @@ def create_or_update( :param release_id: Release identifier within an API. Must be unique in the current API Management service instance. Required. :type release_id: str - :param parameters: Create parameters. Is either a ApiReleaseContract type or a IO type. + :param parameters: Create parameters. Is either a ApiReleaseContract type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract or IO + :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiReleaseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -763,12 +740,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiReleaseContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -779,16 +756,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -814,10 +790,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" - } - @overload def update( self, @@ -852,7 +824,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiReleaseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -866,7 +837,7 @@ def update( api_id: str, release_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -888,11 +859,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: API Release Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiReleaseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -906,7 +876,7 @@ def update( api_id: str, release_id: str, if_match: str, - parameters: Union[_models.ApiReleaseContract, IO], + parameters: Union[_models.ApiReleaseContract, IO[bytes]], **kwargs: Any ) -> _models.ApiReleaseContract: """Updates the details of the release of the API specified by its identifier. @@ -925,13 +895,9 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: API Release Update parameters. Is either a ApiReleaseContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: API Release Update parameters. Is either a ApiReleaseContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract or IO[bytes] :return: ApiReleaseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -954,12 +920,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiReleaseContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -970,16 +936,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -995,13 +960,9 @@ def update( deserialized = self._deserialize("ApiReleaseContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1023,7 +984,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1042,7 +1002,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -1050,16 +1010,15 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1070,8 +1029,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_revision_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_revision_operations.py index b6c5dfb95f24..fdd05e6576ab 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_revision_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_revision_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +74,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -140,7 +140,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiRevisionContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiRevisionContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -162,7 +161,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -171,12 +170,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -188,13 +186,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ApiRevisionCollection", pipeline_response) @@ -204,11 +202,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -220,7 +218,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/revisions" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_schema_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_schema_operations.py index e473da408753..ddef9209f792 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_schema_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_schema_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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 @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +77,7 @@ def build_list_by_api_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -124,7 +125,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -166,7 +167,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -216,7 +217,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -270,7 +271,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if force is not None: @@ -333,7 +334,6 @@ def list_by_api( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SchemaContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.SchemaContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -355,7 +355,7 @@ def list_by_api( def prepare_request(next_link=None): if not next_link: - request = build_list_by_api_request( + _request = build_list_by_api_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -364,12 +364,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -381,13 +380,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("SchemaCollection", pipeline_response) @@ -397,11 +396,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -414,10 +413,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas" - } - @distributed_trace def get_entity_tag( self, resource_group_name: str, service_name: str, api_id: str, schema_id: str, **kwargs: Any @@ -435,7 +430,6 @@ def get_entity_tag( :param schema_id: Schema id identifier. Must be unique in the current API Management service instance. Required. :type schema_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -454,23 +448,22 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, schema_id=schema_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -484,13 +477,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, api_id: str, schema_id: str, **kwargs: Any @@ -508,7 +497,6 @@ def get( :param schema_id: Schema id identifier. Must be unique in the current API Management service instance. Required. :type schema_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SchemaContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SchemaContract :raises ~azure.core.exceptions.HttpResponseError: @@ -527,23 +515,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SchemaContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, schema_id=schema_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -559,13 +546,9 @@ def get( deserialized = self._deserialize("SchemaContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" - } + return deserialized # type: ignore def _create_or_update_initial( self, @@ -573,7 +556,7 @@ def _create_or_update_initial( service_name: str, api_id: str, schema_id: str, - parameters: Union[_models.SchemaContract, IO], + parameters: Union[_models.SchemaContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> Optional[_models.SchemaContract]: @@ -595,12 +578,12 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SchemaContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -611,16 +594,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -643,13 +625,9 @@ def _create_or_update_initial( deserialized = self._deserialize("SchemaContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -685,14 +663,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either SchemaContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.SchemaContract] @@ -706,7 +676,7 @@ def begin_create_or_update( service_name: str, api_id: str, schema_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -726,21 +696,13 @@ def begin_create_or_update( instance. Required. :type schema_id: str :param parameters: The schema contents to apply. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either SchemaContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.SchemaContract] @@ -754,7 +716,7 @@ def begin_create_or_update( service_name: str, api_id: str, schema_id: str, - parameters: Union[_models.SchemaContract, IO], + parameters: Union[_models.SchemaContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> LROPoller[_models.SchemaContract]: @@ -771,23 +733,12 @@ def begin_create_or_update( :param schema_id: Schema id identifier. Must be unique in the current API Management service instance. Required. :type schema_id: str - :param parameters: The schema contents to apply. Is either a SchemaContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.SchemaContract or IO + :param parameters: The schema contents to apply. Is either a SchemaContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.SchemaContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either SchemaContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.SchemaContract] @@ -826,7 +777,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("SchemaContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -838,17 +789,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.SchemaContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" - } + return LROPoller[_models.SchemaContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -880,7 +829,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param force: If true removes all references to the schema before deleting it. Default value is None. :type force: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -899,7 +847,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -908,16 +856,15 @@ def delete( # pylint: disable=inconsistent-return-statements if_match=if_match, force=force, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -928,8 +875,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_tag_description_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_tag_description_operations.py index f6f78afa2c75..4bc90e1d8cbb 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_tag_description_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_tag_description_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +75,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -129,7 +130,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -178,7 +179,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -230,7 +231,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -285,7 +286,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -348,7 +349,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TagDescriptionContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagDescriptionContract] @@ -371,7 +371,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -380,12 +380,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -397,13 +396,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("TagDescriptionCollection", pipeline_response) @@ -413,11 +412,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -430,10 +429,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions" - } - @distributed_trace def get_entity_tag( self, resource_group_name: str, service_name: str, api_id: str, tag_description_id: str, **kwargs: Any @@ -451,7 +446,6 @@ def get_entity_tag( :param tag_description_id: Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. Required. :type tag_description_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -470,23 +464,22 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, tag_description_id=tag_description_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -500,13 +493,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, api_id: str, tag_description_id: str, **kwargs: Any @@ -524,7 +513,6 @@ def get( :param tag_description_id: Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. Required. :type tag_description_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagDescriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagDescriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -543,23 +531,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TagDescriptionContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, tag_description_id=tag_description_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -575,13 +562,9 @@ def get( deserialized = self._deserialize("TagDescriptionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -617,7 +600,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagDescriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagDescriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -630,7 +612,7 @@ def create_or_update( service_name: str, api_id: str, tag_description_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -650,14 +632,13 @@ def create_or_update( API/Tag association. Based on API and Tag names. Required. :type tag_description_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagDescriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagDescriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -670,7 +651,7 @@ def create_or_update( service_name: str, api_id: str, tag_description_id: str, - parameters: Union[_models.TagDescriptionCreateParameters, IO], + parameters: Union[_models.TagDescriptionCreateParameters, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.TagDescriptionContract: @@ -687,16 +668,12 @@ def create_or_update( :param tag_description_id: Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. Required. :type tag_description_id: str - :param parameters: Create parameters. Is either a TagDescriptionCreateParameters type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.TagDescriptionCreateParameters or IO + :param parameters: Create parameters. Is either a TagDescriptionCreateParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.TagDescriptionCreateParameters or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagDescriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagDescriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -719,12 +696,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagDescriptionCreateParameters") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -735,16 +712,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -770,10 +746,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, @@ -800,7 +772,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -819,7 +790,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -827,16 +798,15 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -847,8 +817,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_version_set_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_version_set_operations.py index dae7fab81f48..670236e3bc86 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_version_set_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_version_set_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +73,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -121,7 +122,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,7 +165,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -214,7 +215,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -268,7 +269,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -320,7 +321,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -376,7 +377,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiVersionSetContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiVersionSetContract] @@ -399,7 +399,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -407,12 +407,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -424,13 +423,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ApiVersionSetCollection", pipeline_response) @@ -440,11 +439,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -457,10 +456,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets" - } - @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, version_set_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the Api Version Set specified by its identifier. @@ -473,7 +468,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, version_se :param version_set_id: Api Version Set identifier. Must be unique in the current API Management service instance. Required. :type version_set_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -492,22 +486,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, version_se api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, version_set_id=version_set_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -521,13 +514,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, version_se response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, version_set_id: str, **kwargs: Any @@ -542,7 +531,6 @@ def get( :param version_set_id: Api Version Set identifier. Must be unique in the current API Management service instance. Required. :type version_set_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiVersionSetContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract :raises ~azure.core.exceptions.HttpResponseError: @@ -561,22 +549,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApiVersionSetContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, version_set_id=version_set_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -592,13 +579,9 @@ def get( deserialized = self._deserialize("ApiVersionSetContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -630,7 +613,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiVersionSetContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract :raises ~azure.core.exceptions.HttpResponseError: @@ -642,7 +624,7 @@ def create_or_update( resource_group_name: str, service_name: str, version_set_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -659,14 +641,13 @@ def create_or_update( service instance. Required. :type version_set_id: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiVersionSetContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract :raises ~azure.core.exceptions.HttpResponseError: @@ -678,7 +659,7 @@ def create_or_update( resource_group_name: str, service_name: str, version_set_id: str, - parameters: Union[_models.ApiVersionSetContract, IO], + parameters: Union[_models.ApiVersionSetContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.ApiVersionSetContract: @@ -692,16 +673,12 @@ def create_or_update( :param version_set_id: Api Version Set identifier. Must be unique in the current API Management service instance. Required. :type version_set_id: str - :param parameters: Create or update parameters. Is either a ApiVersionSetContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetContract or IO + :param parameters: Create or update parameters. Is either a ApiVersionSetContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiVersionSetContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract :raises ~azure.core.exceptions.HttpResponseError: @@ -724,12 +701,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiVersionSetContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, version_set_id=version_set_id, @@ -739,16 +716,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -774,10 +750,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" - } - @overload def update( self, @@ -808,7 +780,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiVersionSetContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract :raises ~azure.core.exceptions.HttpResponseError: @@ -821,7 +792,7 @@ def update( service_name: str, version_set_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -840,11 +811,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiVersionSetContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract :raises ~azure.core.exceptions.HttpResponseError: @@ -857,7 +827,7 @@ def update( service_name: str, version_set_id: str, if_match: str, - parameters: Union[_models.ApiVersionSetUpdateParameters, IO], + parameters: Union[_models.ApiVersionSetUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.ApiVersionSetContract: """Updates the details of the Api VersionSet specified by its identifier. @@ -873,13 +843,9 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a ApiVersionSetUpdateParameters type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a ApiVersionSetUpdateParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetUpdateParameters or IO[bytes] :return: ApiVersionSetContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract :raises ~azure.core.exceptions.HttpResponseError: @@ -902,12 +868,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApiVersionSetUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, version_set_id=version_set_id, @@ -917,16 +883,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -942,13 +907,9 @@ def update( deserialized = self._deserialize("ApiVersionSetContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -967,7 +928,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -986,23 +946,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, version_set_id=version_set_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1013,8 +972,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wiki_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wiki_operations.py index f46e90fe19d3..e0564c75b516 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wiki_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wiki_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +65,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,7 +106,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -153,7 +154,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,7 +200,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -243,7 +244,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -286,7 +287,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, api_id: st :param api_id: API identifier. Must be unique in the current API Management service instance. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -305,22 +305,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, api_id: st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -334,13 +333,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, api_id: st response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" - } - @distributed_trace def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs: Any) -> _models.WikiContract: """Gets the details of the Wiki for an API specified by its identifier. @@ -353,7 +348,6 @@ def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs :param api_id: API identifier. Must be unique in the current API Management service instance. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -372,22 +366,21 @@ def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WikiContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -403,13 +396,9 @@ def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs deserialized = self._deserialize("WikiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" - } + return deserialized # type: ignore @overload def create_or_update( @@ -441,7 +430,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -453,7 +441,7 @@ def create_or_update( resource_group_name: str, service_name: str, api_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -470,14 +458,13 @@ def create_or_update( Required. :type api_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -489,7 +476,7 @@ def create_or_update( resource_group_name: str, service_name: str, api_id: str, - parameters: Union[_models.WikiContract, IO], + parameters: Union[_models.WikiContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.WikiContract: @@ -503,15 +490,12 @@ def create_or_update( :param api_id: API identifier. Must be unique in the current API Management service instance. Required. :type api_id: str - :param parameters: Create parameters. Is either a WikiContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.WikiContract or IO + :param parameters: Create parameters. Is either a WikiContract type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.apimanagement.models.WikiContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -534,12 +518,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WikiContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -549,16 +533,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -584,10 +567,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" - } - @overload def update( self, @@ -618,7 +597,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -631,7 +609,7 @@ def update( service_name: str, api_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -650,11 +628,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Wiki Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -667,7 +644,7 @@ def update( service_name: str, api_id: str, if_match: str, - parameters: Union[_models.WikiUpdateContract, IO], + parameters: Union[_models.WikiUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.WikiContract: """Updates the details of the Wiki for an API specified by its identifier. @@ -683,13 +660,9 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Wiki Update parameters. Is either a WikiUpdateContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.WikiUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Wiki Update parameters. Is either a WikiUpdateContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.WikiUpdateContract or IO[bytes] :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -712,12 +685,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WikiUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -727,16 +700,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -752,13 +724,9 @@ def update( deserialized = self._deserialize("WikiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -777,7 +745,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -796,23 +763,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -823,8 +789,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wikis_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wikis_operations.py index 88256450d32d..952e477d27d2 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wikis_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wikis_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +74,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -139,7 +139,6 @@ def list( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WikiContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.WikiContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -161,7 +160,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -170,12 +169,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -187,13 +185,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("WikiCollection", pipeline_response) @@ -203,11 +201,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -219,7 +217,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_access_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_access_policy_operations.py index 94fe11ba5c21..95cf64cd362c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_access_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_access_policy_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +86,7 @@ def build_list_by_authorization_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -156,7 +157,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -224,7 +225,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -295,7 +296,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -359,7 +360,6 @@ def list_by_authorization( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AuthorizationAccessPolicyContract or the result of cls(response) :rtype: @@ -383,7 +383,7 @@ def list_by_authorization( def prepare_request(next_link=None): if not next_link: - request = build_list_by_authorization_request( + _request = build_list_by_authorization_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -393,12 +393,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_authorization.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -410,13 +409,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("AuthorizationAccessPolicyCollection", pipeline_response) @@ -426,11 +425,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -443,10 +442,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_authorization.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies" - } - @distributed_trace def get( self, @@ -470,7 +465,6 @@ def get( :type authorization_id: str :param authorization_access_policy_id: Identifier of the authorization access policy. Required. :type authorization_access_policy_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationAccessPolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -489,7 +483,7 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AuthorizationAccessPolicyContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -497,16 +491,15 @@ def get( authorization_access_policy_id=authorization_access_policy_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -522,13 +515,9 @@ def get( deserialized = self._deserialize("AuthorizationAccessPolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -565,7 +554,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationAccessPolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -579,7 +567,7 @@ def create_or_update( authorization_provider_id: str, authorization_id: str, authorization_access_policy_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -599,14 +587,13 @@ def create_or_update( :param authorization_access_policy_id: Identifier of the authorization access policy. Required. :type authorization_access_policy_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationAccessPolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -620,7 +607,7 @@ def create_or_update( authorization_provider_id: str, authorization_id: str, authorization_access_policy_id: str, - parameters: Union[_models.AuthorizationAccessPolicyContract, IO], + parameters: Union[_models.AuthorizationAccessPolicyContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.AuthorizationAccessPolicyContract: @@ -638,15 +625,12 @@ def create_or_update( :param authorization_access_policy_id: Identifier of the authorization access policy. Required. :type authorization_access_policy_id: str :param parameters: Create parameters. Is either a AuthorizationAccessPolicyContract type or a - IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract or IO + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract or + IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationAccessPolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -669,12 +653,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AuthorizationAccessPolicyContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -686,16 +670,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -721,10 +704,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, @@ -752,7 +731,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -771,7 +749,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -780,16 +758,15 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -800,8 +777,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_login_links_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_login_links_operations.py index c1c1b39cf0a1..8458e416f305 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_login_links_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_login_links_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +81,7 @@ def build_post_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,7 +141,6 @@ def post( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationLoginResponseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationLoginResponseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -153,7 +153,7 @@ def post( service_name: str, authorization_provider_id: str, authorization_id: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -170,11 +170,10 @@ def post( :param authorization_id: Identifier of the authorization. Required. :type authorization_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationLoginResponseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationLoginResponseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -187,7 +186,7 @@ def post( service_name: str, authorization_provider_id: str, authorization_id: str, - parameters: Union[_models.AuthorizationLoginRequestContract, IO], + parameters: Union[_models.AuthorizationLoginRequestContract, IO[bytes]], **kwargs: Any ) -> _models.AuthorizationLoginResponseContract: """Gets authorization login links. @@ -202,12 +201,9 @@ def post( :param authorization_id: Identifier of the authorization. Required. :type authorization_id: str :param parameters: Create parameters. Is either a AuthorizationLoginRequestContract type or a - IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationLoginRequestContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationLoginRequestContract or + IO[bytes] :return: AuthorizationLoginResponseContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationLoginResponseContract :raises ~azure.core.exceptions.HttpResponseError: @@ -230,12 +226,12 @@ def post( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AuthorizationLoginRequestContract") - request = build_post_request( + _request = build_post_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -245,16 +241,15 @@ def post( content_type=content_type, json=_json, content=_content, - template_url=self.post.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -270,10 +265,6 @@ def post( deserialized = self._deserialize("AuthorizationLoginResponseContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - post.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/getLoginLinks" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_operations.py index 5d66ea640444..c6dee0f2b56d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +82,7 @@ def build_list_by_authorization_provider_request( # pylint: disable=name-too-lo "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -143,7 +144,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -202,7 +203,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -264,7 +265,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -322,7 +323,7 @@ def build_confirm_consent_code_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -384,7 +385,6 @@ def list_by_authorization_provider( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AuthorizationContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.AuthorizationContract] @@ -407,7 +407,7 @@ def list_by_authorization_provider( def prepare_request(next_link=None): if not next_link: - request = build_list_by_authorization_provider_request( + _request = build_list_by_authorization_provider_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -416,12 +416,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_authorization_provider.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -433,13 +432,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("AuthorizationCollection", pipeline_response) @@ -449,11 +448,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -466,10 +465,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_authorization_provider.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations" - } - @distributed_trace def get( self, @@ -490,7 +485,6 @@ def get( :type authorization_provider_id: str :param authorization_id: Identifier of the authorization. Required. :type authorization_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -509,23 +503,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AuthorizationContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, authorization_id=authorization_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -541,13 +534,9 @@ def get( deserialized = self._deserialize("AuthorizationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -581,7 +570,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -594,7 +582,7 @@ def create_or_update( service_name: str, authorization_provider_id: str, authorization_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -612,14 +600,13 @@ def create_or_update( :param authorization_id: Identifier of the authorization. Required. :type authorization_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -632,7 +619,7 @@ def create_or_update( service_name: str, authorization_provider_id: str, authorization_id: str, - parameters: Union[_models.AuthorizationContract, IO], + parameters: Union[_models.AuthorizationContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.AuthorizationContract: @@ -647,16 +634,12 @@ def create_or_update( :type authorization_provider_id: str :param authorization_id: Identifier of the authorization. Required. :type authorization_id: str - :param parameters: Create parameters. Is either a AuthorizationContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationContract or IO + :param parameters: Create parameters. Is either a AuthorizationContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -679,12 +662,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AuthorizationContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -695,16 +678,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -730,10 +712,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, @@ -758,7 +736,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -777,7 +754,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -785,16 +762,15 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -805,11 +781,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def confirm_consent_code( # pylint: disable=inconsistent-return-statements @@ -840,7 +812,6 @@ def confirm_consent_code( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -853,7 +824,7 @@ def confirm_consent_code( # pylint: disable=inconsistent-return-statements service_name: str, authorization_provider_id: str, authorization_id: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -870,11 +841,10 @@ def confirm_consent_code( # pylint: disable=inconsistent-return-statements :param authorization_id: Identifier of the authorization. Required. :type authorization_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -887,7 +857,7 @@ def confirm_consent_code( # pylint: disable=inconsistent-return-statements service_name: str, authorization_provider_id: str, authorization_id: str, - parameters: Union[_models.AuthorizationConfirmConsentCodeRequestContract, IO], + parameters: Union[_models.AuthorizationConfirmConsentCodeRequestContract, IO[bytes]], **kwargs: Any ) -> None: """Confirm valid consent code to suppress Authorizations anti-phishing page. @@ -902,13 +872,9 @@ def confirm_consent_code( # pylint: disable=inconsistent-return-statements :param authorization_id: Identifier of the authorization. Required. :type authorization_id: str :param parameters: Create parameters. Is either a - AuthorizationConfirmConsentCodeRequestContract type or a IO type. Required. + AuthorizationConfirmConsentCodeRequestContract type or a IO[bytes] type. Required. :type parameters: - ~azure.mgmt.apimanagement.models.AuthorizationConfirmConsentCodeRequestContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.apimanagement.models.AuthorizationConfirmConsentCodeRequestContract or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -931,12 +897,12 @@ def confirm_consent_code( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AuthorizationConfirmConsentCodeRequestContract") - request = build_confirm_consent_code_request( + _request = build_confirm_consent_code_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -946,16 +912,15 @@ def confirm_consent_code( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.confirm_consent_code.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -969,8 +934,4 @@ def confirm_consent_code( # pylint: disable=inconsistent-return-statements response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) - - confirm_consent_code.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/confirmConsentCode" - } + return cls(pipeline_response, None, response_headers) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_provider_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_provider_operations.py index d30a99286adb..6d2cb523a323 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_provider_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_provider_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +73,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -126,7 +127,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -181,7 +182,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -239,7 +240,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -297,7 +298,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AuthorizationProviderContract or the result of cls(response) :rtype: @@ -321,7 +321,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -329,12 +329,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -346,13 +345,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("AuthorizationProviderCollection", pipeline_response) @@ -362,11 +361,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -379,10 +378,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, authorization_provider_id: str, **kwargs: Any @@ -396,7 +391,6 @@ def get( :type service_name: str :param authorization_provider_id: Identifier of the authorization provider. Required. :type authorization_provider_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -415,22 +409,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AuthorizationProviderContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -446,13 +439,9 @@ def get( deserialized = self._deserialize("AuthorizationProviderContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -483,7 +472,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -495,7 +483,7 @@ def create_or_update( resource_group_name: str, service_name: str, authorization_provider_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -511,14 +499,13 @@ def create_or_update( :param authorization_provider_id: Identifier of the authorization provider. Required. :type authorization_provider_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -530,7 +517,7 @@ def create_or_update( resource_group_name: str, service_name: str, authorization_provider_id: str, - parameters: Union[_models.AuthorizationProviderContract, IO], + parameters: Union[_models.AuthorizationProviderContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.AuthorizationProviderContract: @@ -543,16 +530,12 @@ def create_or_update( :type service_name: str :param authorization_provider_id: Identifier of the authorization provider. Required. :type authorization_provider_id: str - :param parameters: Create parameters. Is either a AuthorizationProviderContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationProviderContract or IO + :param parameters: Create parameters. Is either a AuthorizationProviderContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationProviderContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -575,12 +558,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AuthorizationProviderContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, @@ -590,16 +573,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -625,10 +607,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, authorization_provider_id: str, if_match: str, **kwargs: Any @@ -645,7 +623,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -664,23 +641,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, authorization_provider_id=authorization_provider_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -691,8 +667,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_server_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_server_operations.py index 10cf9385f01c..540201ef5749 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_server_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_server_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +73,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -119,7 +120,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +161,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -208,7 +209,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -254,7 +255,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -298,7 +299,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -340,7 +341,7 @@ def build_list_secrets_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -397,7 +398,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AuthorizationServerContract or the result of cls(response) :rtype: @@ -421,7 +421,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -429,12 +429,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -446,13 +445,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("AuthorizationServerCollection", pipeline_response) @@ -462,11 +461,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -479,10 +478,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers" - } - @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, authsid: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the authorizationServer specified by its identifier. @@ -494,7 +489,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, authsid: s :type service_name: str :param authsid: Identifier of the authorization server. Required. :type authsid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -513,22 +507,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, authsid: s api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, authsid=authsid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -542,13 +535,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, authsid: s response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, authsid: str, **kwargs: Any @@ -562,7 +551,6 @@ def get( :type service_name: str :param authsid: Identifier of the authorization server. Required. :type authsid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationServerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -581,22 +569,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AuthorizationServerContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, authsid=authsid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -612,13 +599,9 @@ def get( deserialized = self._deserialize("AuthorizationServerContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -649,7 +632,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationServerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -661,7 +643,7 @@ def create_or_update( resource_group_name: str, service_name: str, authsid: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -677,14 +659,13 @@ def create_or_update( :param authsid: Identifier of the authorization server. Required. :type authsid: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationServerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -696,7 +677,7 @@ def create_or_update( resource_group_name: str, service_name: str, authsid: str, - parameters: Union[_models.AuthorizationServerContract, IO], + parameters: Union[_models.AuthorizationServerContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.AuthorizationServerContract: @@ -710,15 +691,11 @@ def create_or_update( :param authsid: Identifier of the authorization server. Required. :type authsid: str :param parameters: Create or update parameters. Is either a AuthorizationServerContract type or - a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationServerContract or IO + a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationServerContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationServerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -741,12 +718,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AuthorizationServerContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, authsid=authsid, @@ -756,16 +733,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -791,10 +767,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" - } - @overload def update( self, @@ -824,7 +796,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationServerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -837,7 +808,7 @@ def update( service_name: str, authsid: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -855,11 +826,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: OAuth2 Server settings Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationServerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -872,7 +842,7 @@ def update( service_name: str, authsid: str, if_match: str, - parameters: Union[_models.AuthorizationServerUpdateContract, IO], + parameters: Union[_models.AuthorizationServerUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.AuthorizationServerContract: """Updates the details of the authorization server specified by its identifier. @@ -888,12 +858,9 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: OAuth2 Server settings Update parameters. Is either a - AuthorizationServerUpdateContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationServerUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + AuthorizationServerUpdateContract type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationServerUpdateContract or + IO[bytes] :return: AuthorizationServerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -916,12 +883,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AuthorizationServerUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, authsid=authsid, @@ -931,16 +898,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -956,13 +922,9 @@ def update( deserialized = self._deserialize("AuthorizationServerContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -980,7 +942,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -999,23 +960,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, authsid=authsid, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1026,11 +986,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_secrets( @@ -1045,7 +1001,6 @@ def list_secrets( :type service_name: str :param authsid: Identifier of the authorization server. Required. :type authsid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthorizationServerSecretsContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerSecretsContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1064,22 +1019,21 @@ def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AuthorizationServerSecretsContract] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, service_name=service_name, authsid=authsid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1095,10 +1049,6 @@ def list_secrets( deserialized = self._deserialize("AuthorizationServerSecretsContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_backend_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_backend_operations.py index 72c1a14843fc..077c1a99daad 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_backend_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_backend_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +73,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -119,7 +120,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +161,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -208,7 +209,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -254,7 +255,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -298,7 +299,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -341,7 +342,7 @@ def build_reconnect_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -401,7 +402,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BackendContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.BackendContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -423,7 +423,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -431,12 +431,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -448,13 +447,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("BackendCollection", pipeline_response) @@ -464,11 +463,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -481,10 +480,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends" - } - @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, backend_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the backend specified by its identifier. @@ -497,7 +492,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, backend_id :param backend_id: Identifier of the Backend entity. Must be unique in the current API Management service instance. Required. :type backend_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -516,22 +510,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, backend_id api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, backend_id=backend_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -545,13 +538,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, backend_id response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, backend_id: str, **kwargs: Any @@ -566,7 +555,6 @@ def get( :param backend_id: Identifier of the Backend entity. Must be unique in the current API Management service instance. Required. :type backend_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BackendContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.BackendContract :raises ~azure.core.exceptions.HttpResponseError: @@ -585,22 +573,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackendContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, backend_id=backend_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -616,13 +603,9 @@ def get( deserialized = self._deserialize("BackendContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -654,7 +637,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BackendContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.BackendContract :raises ~azure.core.exceptions.HttpResponseError: @@ -666,7 +648,7 @@ def create_or_update( resource_group_name: str, service_name: str, backend_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -683,14 +665,13 @@ def create_or_update( Management service instance. Required. :type backend_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BackendContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.BackendContract :raises ~azure.core.exceptions.HttpResponseError: @@ -702,7 +683,7 @@ def create_or_update( resource_group_name: str, service_name: str, backend_id: str, - parameters: Union[_models.BackendContract, IO], + parameters: Union[_models.BackendContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.BackendContract: @@ -716,15 +697,12 @@ def create_or_update( :param backend_id: Identifier of the Backend entity. Must be unique in the current API Management service instance. Required. :type backend_id: str - :param parameters: Create parameters. Is either a BackendContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.BackendContract or IO + :param parameters: Create parameters. Is either a BackendContract type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.apimanagement.models.BackendContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BackendContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.BackendContract :raises ~azure.core.exceptions.HttpResponseError: @@ -747,12 +725,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BackendContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, backend_id=backend_id, @@ -762,16 +740,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -797,10 +774,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" - } - @overload def update( self, @@ -831,7 +804,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BackendContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.BackendContract :raises ~azure.core.exceptions.HttpResponseError: @@ -844,7 +816,7 @@ def update( service_name: str, backend_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -863,11 +835,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: BackendContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.BackendContract :raises ~azure.core.exceptions.HttpResponseError: @@ -880,7 +851,7 @@ def update( service_name: str, backend_id: str, if_match: str, - parameters: Union[_models.BackendUpdateParameters, IO], + parameters: Union[_models.BackendUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.BackendContract: """Updates an existing backend. @@ -896,13 +867,9 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a BackendUpdateParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.BackendUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a BackendUpdateParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.BackendUpdateParameters or IO[bytes] :return: BackendContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.BackendContract :raises ~azure.core.exceptions.HttpResponseError: @@ -925,12 +892,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BackendUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, backend_id=backend_id, @@ -940,16 +907,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -965,13 +931,9 @@ def update( deserialized = self._deserialize("BackendContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -990,7 +952,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1009,23 +970,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, backend_id=backend_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1036,11 +996,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def reconnect( # pylint: disable=inconsistent-return-statements @@ -1069,7 +1025,6 @@ def reconnect( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1081,7 +1036,7 @@ def reconnect( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, backend_id: str, - parameters: Optional[IO] = None, + parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -1098,11 +1053,10 @@ def reconnect( # pylint: disable=inconsistent-return-statements Management service instance. Required. :type backend_id: str :param parameters: Reconnect request parameters. Default value is None. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1114,7 +1068,7 @@ def reconnect( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, backend_id: str, - parameters: Optional[Union[_models.BackendReconnectContract, IO]] = None, + parameters: Optional[Union[_models.BackendReconnectContract, IO[bytes]]] = None, **kwargs: Any ) -> None: """Notifies the API Management gateway to create a new connection to the backend after the @@ -1129,12 +1083,8 @@ def reconnect( # pylint: disable=inconsistent-return-statements Management service instance. Required. :type backend_id: str :param parameters: Reconnect request parameters. Is either a BackendReconnectContract type or a - IO type. Default value is None. - :type parameters: ~azure.mgmt.apimanagement.models.BackendReconnectContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.apimanagement.models.BackendReconnectContract or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1157,7 +1107,7 @@ def reconnect( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: if parameters is not None: @@ -1165,7 +1115,7 @@ def reconnect( # pylint: disable=inconsistent-return-statements else: _json = None - request = build_reconnect_request( + _request = build_reconnect_request( resource_group_name=resource_group_name, service_name=service_name, backend_id=backend_id, @@ -1174,16 +1124,15 @@ def reconnect( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.reconnect.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1194,8 +1143,4 @@ def reconnect( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - reconnect.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}/reconnect" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_cache_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_cache_operations.py index 7852c4175aa7..9fb0b089c747 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_cache_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_cache_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +72,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if top is not None: @@ -116,7 +117,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,7 +158,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -205,7 +206,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -251,7 +252,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -295,7 +296,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -346,7 +347,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CacheContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.CacheContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -368,19 +368,18 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -392,13 +391,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("CacheCollection", pipeline_response) @@ -408,11 +407,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -425,10 +424,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches" - } - @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, cache_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the Cache specified by its identifier. @@ -441,7 +436,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, cache_id: :param cache_id: Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). Required. :type cache_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -460,22 +454,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, cache_id: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, cache_id=cache_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -489,13 +482,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, cache_id: response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" - } - @distributed_trace def get(self, resource_group_name: str, service_name: str, cache_id: str, **kwargs: Any) -> _models.CacheContract: """Gets the details of the Cache specified by its identifier. @@ -508,7 +497,6 @@ def get(self, resource_group_name: str, service_name: str, cache_id: str, **kwar :param cache_id: Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). Required. :type cache_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CacheContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CacheContract :raises ~azure.core.exceptions.HttpResponseError: @@ -527,22 +515,21 @@ def get(self, resource_group_name: str, service_name: str, cache_id: str, **kwar api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CacheContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, cache_id=cache_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -558,13 +545,9 @@ def get(self, resource_group_name: str, service_name: str, cache_id: str, **kwar deserialized = self._deserialize("CacheContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -599,7 +582,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CacheContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CacheContract :raises ~azure.core.exceptions.HttpResponseError: @@ -611,7 +593,7 @@ def create_or_update( resource_group_name: str, service_name: str, cache_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -631,14 +613,13 @@ def create_or_update( or valid Azure region identifier). Required. :type cache_id: str :param parameters: Create or Update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CacheContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CacheContract :raises ~azure.core.exceptions.HttpResponseError: @@ -650,7 +631,7 @@ def create_or_update( resource_group_name: str, service_name: str, cache_id: str, - parameters: Union[_models.CacheContract, IO], + parameters: Union[_models.CacheContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.CacheContract: @@ -667,16 +648,12 @@ def create_or_update( :param cache_id: Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). Required. :type cache_id: str - :param parameters: Create or Update parameters. Is either a CacheContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.CacheContract or IO + :param parameters: Create or Update parameters. Is either a CacheContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.CacheContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CacheContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CacheContract :raises ~azure.core.exceptions.HttpResponseError: @@ -699,12 +676,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CacheContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, cache_id=cache_id, @@ -714,16 +691,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -749,10 +725,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" - } - @overload def update( self, @@ -783,7 +755,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CacheContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CacheContract :raises ~azure.core.exceptions.HttpResponseError: @@ -796,7 +767,7 @@ def update( service_name: str, cache_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -815,11 +786,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: CacheContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CacheContract :raises ~azure.core.exceptions.HttpResponseError: @@ -832,7 +802,7 @@ def update( service_name: str, cache_id: str, if_match: str, - parameters: Union[_models.CacheUpdateParameters, IO], + parameters: Union[_models.CacheUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.CacheContract: """Updates the details of the cache specified by its identifier. @@ -848,13 +818,9 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a CacheUpdateParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.CacheUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a CacheUpdateParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.CacheUpdateParameters or IO[bytes] :return: CacheContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CacheContract :raises ~azure.core.exceptions.HttpResponseError: @@ -877,12 +843,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CacheUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, cache_id=cache_id, @@ -892,16 +858,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -917,13 +882,9 @@ def update( deserialized = self._deserialize("CacheContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -942,7 +903,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -961,23 +921,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, cache_id=cache_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -988,8 +947,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_certificate_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_certificate_operations.py index f934454b73d6..951dd6574581 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_certificate_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_certificate_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +74,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -126,7 +127,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -169,7 +170,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,7 +220,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -272,7 +273,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -316,7 +317,7 @@ def build_refresh_secret_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -378,7 +379,6 @@ def list_by_service( :param is_key_vault_refresh_failed: When set to true, the response contains only certificates entities which failed refresh. Default value is None. :type is_key_vault_refresh_failed: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CertificateContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.CertificateContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -400,7 +400,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -409,12 +409,11 @@ def prepare_request(next_link=None): skip=skip, is_key_vault_refresh_failed=is_key_vault_refresh_failed, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -426,13 +425,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("CertificateCollection", pipeline_response) @@ -442,11 +441,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -459,10 +458,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates" - } - @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, certificate_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the certificate specified by its identifier. @@ -475,7 +470,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, certificat :param certificate_id: Identifier of the certificate entity. Must be unique in the current API Management service instance. Required. :type certificate_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -494,22 +488,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, certificat api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, certificate_id=certificate_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -523,13 +516,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, certificat response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, certificate_id: str, **kwargs: Any @@ -544,7 +533,6 @@ def get( :param certificate_id: Identifier of the certificate entity. Must be unique in the current API Management service instance. Required. :type certificate_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CertificateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -563,22 +551,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, certificate_id=certificate_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -594,13 +581,9 @@ def get( deserialized = self._deserialize("CertificateContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -636,7 +619,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CertificateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -648,7 +630,7 @@ def create_or_update( resource_group_name: str, service_name: str, certificate_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -669,14 +651,13 @@ def create_or_update( Management service instance. Required. :type certificate_id: str :param parameters: Create or Update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CertificateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -688,7 +669,7 @@ def create_or_update( resource_group_name: str, service_name: str, certificate_id: str, - parameters: Union[_models.CertificateCreateOrUpdateParameters, IO], + parameters: Union[_models.CertificateCreateOrUpdateParameters, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.CertificateContract: @@ -707,15 +688,12 @@ def create_or_update( Management service instance. Required. :type certificate_id: str :param parameters: Create or Update parameters. Is either a CertificateCreateOrUpdateParameters - type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.CertificateCreateOrUpdateParameters or IO + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.CertificateCreateOrUpdateParameters or + IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CertificateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -738,12 +716,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, certificate_id=certificate_id, @@ -753,16 +731,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -788,10 +765,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, certificate_id: str, if_match: str, **kwargs: Any @@ -809,7 +782,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -828,23 +800,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, certificate_id=certificate_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -855,11 +826,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def refresh_secret( @@ -879,7 +846,6 @@ def refresh_secret( :param certificate_id: Identifier of the certificate entity. Must be unique in the current API Management service instance. Required. :type certificate_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.CertificateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -898,22 +864,21 @@ def refresh_secret( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateContract] = kwargs.pop("cls", None) - request = build_refresh_secret_request( + _request = build_refresh_secret_request( resource_group_name=resource_group_name, service_name=service_name, certificate_id=certificate_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.refresh_secret.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -929,10 +894,6 @@ def refresh_secret( deserialized = self._deserialize("CertificateContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - refresh_secret.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}/refreshSecret" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_item_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_item_operations.py index 40379b3a296a..61993a3adead 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_item_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_item_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -66,7 +67,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -113,7 +114,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +161,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -210,7 +211,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -263,7 +264,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -307,7 +308,6 @@ def list_by_service( :type service_name: str :param content_type_id: Content type identifier. Required. :type content_type_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContentItemContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ContentItemContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -329,18 +329,17 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, content_type_id=content_type_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -352,13 +351,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ContentItemCollection", pipeline_response) @@ -368,11 +367,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -385,10 +384,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems" - } - @distributed_trace def get_entity_tag( self, resource_group_name: str, service_name: str, content_type_id: str, content_item_id: str, **kwargs: Any @@ -405,7 +400,6 @@ def get_entity_tag( :type content_type_id: str :param content_item_id: Content item identifier. Required. :type content_item_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -424,23 +418,22 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, content_type_id=content_type_id, content_item_id=content_item_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -454,13 +447,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, content_type_id: str, content_item_id: str, **kwargs: Any @@ -476,7 +465,6 @@ def get( :type content_type_id: str :param content_item_id: Content item identifier. Required. :type content_item_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContentItemContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ContentItemContract :raises ~azure.core.exceptions.HttpResponseError: @@ -495,23 +483,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContentItemContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, content_type_id=content_type_id, content_item_id=content_item_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -527,13 +514,9 @@ def get( deserialized = self._deserialize("ContentItemContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -567,7 +550,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContentItemContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ContentItemContract :raises ~azure.core.exceptions.HttpResponseError: @@ -580,7 +562,7 @@ def create_or_update( service_name: str, content_type_id: str, content_item_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -598,14 +580,13 @@ def create_or_update( :param content_item_id: Content item identifier. Required. :type content_item_id: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContentItemContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ContentItemContract :raises ~azure.core.exceptions.HttpResponseError: @@ -618,7 +599,7 @@ def create_or_update( service_name: str, content_type_id: str, content_item_id: str, - parameters: Union[_models.ContentItemContract, IO], + parameters: Union[_models.ContentItemContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.ContentItemContract: @@ -633,16 +614,12 @@ def create_or_update( :type content_type_id: str :param content_item_id: Content item identifier. Required. :type content_item_id: str - :param parameters: Create or update parameters. Is either a ContentItemContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ContentItemContract or IO + :param parameters: Create or update parameters. Is either a ContentItemContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ContentItemContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContentItemContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ContentItemContract :raises ~azure.core.exceptions.HttpResponseError: @@ -665,12 +642,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ContentItemContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, content_type_id=content_type_id, @@ -681,16 +658,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -716,10 +692,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, @@ -744,7 +716,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -763,7 +734,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, content_type_id=content_type_id, @@ -771,16 +742,15 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -791,8 +761,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_type_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_type_operations.py index 0f784cd8fe37..d8f9d7e5aceb 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_type_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_type_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +66,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -106,7 +107,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -154,7 +155,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -205,7 +206,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -248,7 +249,6 @@ def list_by_service( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContentTypeContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ContentTypeContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -270,17 +270,16 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -292,13 +291,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ContentTypeCollection", pipeline_response) @@ -308,11 +307,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -325,10 +324,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, content_type_id: str, **kwargs: Any @@ -343,7 +338,6 @@ def get( :type service_name: str :param content_type_id: Content type identifier. Required. :type content_type_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContentTypeContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ContentTypeContract :raises ~azure.core.exceptions.HttpResponseError: @@ -362,22 +356,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContentTypeContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, content_type_id=content_type_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -393,13 +386,9 @@ def get( deserialized = self._deserialize("ContentTypeContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -432,7 +421,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContentTypeContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ContentTypeContract :raises ~azure.core.exceptions.HttpResponseError: @@ -444,7 +432,7 @@ def create_or_update( resource_group_name: str, service_name: str, content_type_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -462,14 +450,13 @@ def create_or_update( :param content_type_id: Content type identifier. Required. :type content_type_id: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContentTypeContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ContentTypeContract :raises ~azure.core.exceptions.HttpResponseError: @@ -481,7 +468,7 @@ def create_or_update( resource_group_name: str, service_name: str, content_type_id: str, - parameters: Union[_models.ContentTypeContract, IO], + parameters: Union[_models.ContentTypeContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.ContentTypeContract: @@ -496,16 +483,12 @@ def create_or_update( :type service_name: str :param content_type_id: Content type identifier. Required. :type content_type_id: str - :param parameters: Create or update parameters. Is either a ContentTypeContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ContentTypeContract or IO + :param parameters: Create or update parameters. Is either a ContentTypeContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ContentTypeContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContentTypeContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ContentTypeContract :raises ~azure.core.exceptions.HttpResponseError: @@ -528,12 +511,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ContentTypeContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, content_type_id=content_type_id, @@ -543,16 +526,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -578,10 +560,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, content_type_id: str, if_match: str, **kwargs: Any @@ -600,7 +578,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -619,23 +596,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, content_type_id=content_type_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -646,8 +622,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_delegation_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_delegation_settings_operations.py index 13ad5d3897ae..ab37ece18239 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_delegation_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_delegation_settings_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +64,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,7 +102,7 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +143,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,7 +187,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -230,7 +231,7 @@ def build_list_secrets_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -269,7 +270,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -288,21 +288,20 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -316,13 +315,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation" - } - @distributed_trace def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.PortalDelegationSettings: """Get Delegation Settings for the Portal. @@ -332,7 +327,6 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalDelegationSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalDelegationSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -351,21 +345,20 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PortalDelegationSettings] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -381,13 +374,9 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo deserialized = self._deserialize("PortalDelegationSettings", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation" - } + return deserialized # type: ignore @overload def update( # pylint: disable=inconsistent-return-statements @@ -415,7 +404,6 @@ def update( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -427,7 +415,7 @@ def update( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -443,11 +431,10 @@ def update( # pylint: disable=inconsistent-return-statements response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update Delegation settings. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -459,7 +446,7 @@ def update( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, if_match: str, - parameters: Union[_models.PortalDelegationSettings, IO], + parameters: Union[_models.PortalDelegationSettings, IO[bytes]], **kwargs: Any ) -> None: """Update Delegation settings. @@ -473,12 +460,8 @@ def update( # pylint: disable=inconsistent-return-statements response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update Delegation settings. Is either a PortalDelegationSettings type or a - IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalDelegationSettings or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalDelegationSettings or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -501,12 +484,12 @@ def update( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalDelegationSettings") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -515,16 +498,15 @@ def update( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -535,11 +517,7 @@ def update( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def create_or_update( @@ -567,7 +545,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalDelegationSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalDelegationSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -578,7 +555,7 @@ def create_or_update( self, resource_group_name: str, service_name: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -592,14 +569,13 @@ def create_or_update( :param service_name: The name of the API Management service. Required. :type service_name: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalDelegationSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalDelegationSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -610,7 +586,7 @@ def create_or_update( self, resource_group_name: str, service_name: str, - parameters: Union[_models.PortalDelegationSettings, IO], + parameters: Union[_models.PortalDelegationSettings, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.PortalDelegationSettings: @@ -622,15 +598,11 @@ def create_or_update( :param service_name: The name of the API Management service. Required. :type service_name: str :param parameters: Create or update parameters. Is either a PortalDelegationSettings type or a - IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalDelegationSettings or IO + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalDelegationSettings or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalDelegationSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalDelegationSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -653,12 +625,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalDelegationSettings") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -667,16 +639,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -689,13 +660,9 @@ def create_or_update( deserialized = self._deserialize("PortalDelegationSettings", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation" - } + return deserialized # type: ignore @distributed_trace def list_secrets( @@ -708,7 +675,6 @@ def list_secrets( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSettingValidationKeyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSettingValidationKeyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -727,21 +693,20 @@ def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PortalSettingValidationKeyContract] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -754,10 +719,6 @@ def list_secrets( deserialized = self._deserialize("PortalSettingValidationKeyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_deleted_services_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_deleted_services_operations.py index 6529c57d6089..d2ca5479aa3c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_deleted_services_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_deleted_services_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -29,7 +29,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,7 +89,7 @@ def build_get_by_name_request(service_name: str, location: str, subscription_id: "location": _SERIALIZER.url("location", location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -125,7 +125,7 @@ def build_purge_request(service_name: str, location: str, subscription_id: str, "location": _SERIALIZER.url("location", location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,7 +159,6 @@ def __init__(self, *args, **kwargs): def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.DeletedServiceContract"]: """Lists all soft-deleted services available for undelete for the given subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeletedServiceContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.DeletedServiceContract] @@ -182,15 +181,14 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.DeletedServic def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -202,13 +200,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DeletedServicesCollection", pipeline_response) @@ -218,11 +216,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -235,10 +233,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/deletedservices" - } - @distributed_trace def get_by_name(self, service_name: str, location: str, **kwargs: Any) -> _models.DeletedServiceContract: """Get soft-deleted Api Management Service by name. @@ -247,7 +241,6 @@ def get_by_name(self, service_name: str, location: str, **kwargs: Any) -> _model :type service_name: str :param location: The location of the deleted API Management service. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DeletedServiceContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DeletedServiceContract :raises ~azure.core.exceptions.HttpResponseError: @@ -266,21 +259,20 @@ def get_by_name(self, service_name: str, location: str, **kwargs: Any) -> _model api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeletedServiceContract] = kwargs.pop("cls", None) - request = build_get_by_name_request( + _request = build_get_by_name_request( service_name=service_name, location=location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_name.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -293,13 +285,9 @@ def get_by_name(self, service_name: str, location: str, **kwargs: Any) -> _model deserialized = self._deserialize("DeletedServiceContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_by_name.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}" - } + return deserialized # type: ignore def _purge_initial( self, service_name: str, location: str, **kwargs: Any @@ -318,21 +306,20 @@ def _purge_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.DeletedServiceContract]] = kwargs.pop("cls", None) - request = build_purge_request( + _request = build_purge_request( service_name=service_name, location=location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._purge_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -350,13 +337,9 @@ def _purge_initial( deserialized = self._deserialize("DeletedServiceContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _purge_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}" - } + return deserialized # type: ignore @distributed_trace def begin_purge(self, service_name: str, location: str, **kwargs: Any) -> LROPoller[_models.DeletedServiceContract]: @@ -366,14 +349,6 @@ def begin_purge(self, service_name: str, location: str, **kwargs: Any) -> LROPol :type service_name: str :param location: The location of the deleted API Management service. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either DeletedServiceContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.DeletedServiceContract] @@ -406,7 +381,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("DeletedServiceContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -418,14 +393,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.DeletedServiceContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_purge.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}" - } + return LROPoller[_models.DeletedServiceContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_diagnostic_operations.py index 43836334bb96..ca50590197ed 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_diagnostic_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_diagnostic_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +73,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -121,7 +122,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,7 +165,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -214,7 +215,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -268,7 +269,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -320,7 +321,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -377,7 +378,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiagnosticContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.DiagnosticContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -399,7 +399,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -407,12 +407,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -424,13 +423,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DiagnosticCollection", pipeline_response) @@ -440,11 +439,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -457,10 +456,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics" - } - @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, diagnostic_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the Diagnostic specified by its identifier. @@ -473,7 +468,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, diagnostic :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management service instance. Required. :type diagnostic_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -492,22 +486,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, diagnostic api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, diagnostic_id=diagnostic_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -521,13 +514,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, diagnostic response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, diagnostic_id: str, **kwargs: Any @@ -542,7 +531,6 @@ def get( :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management service instance. Required. :type diagnostic_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -561,22 +549,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, diagnostic_id=diagnostic_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -592,13 +579,9 @@ def get( deserialized = self._deserialize("DiagnosticContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -630,7 +613,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -642,7 +624,7 @@ def create_or_update( resource_group_name: str, service_name: str, diagnostic_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -659,14 +641,13 @@ def create_or_update( service instance. Required. :type diagnostic_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -678,7 +659,7 @@ def create_or_update( resource_group_name: str, service_name: str, diagnostic_id: str, - parameters: Union[_models.DiagnosticContract, IO], + parameters: Union[_models.DiagnosticContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.DiagnosticContract: @@ -692,16 +673,12 @@ def create_or_update( :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management service instance. Required. :type diagnostic_id: str - :param parameters: Create parameters. Is either a DiagnosticContract type or a IO type. + :param parameters: Create parameters. Is either a DiagnosticContract type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO + :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -724,12 +701,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DiagnosticContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, diagnostic_id=diagnostic_id, @@ -739,16 +716,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -774,10 +750,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" - } - @overload def update( self, @@ -808,7 +780,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -821,7 +792,7 @@ def update( service_name: str, diagnostic_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -840,11 +811,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Diagnostic Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -857,7 +827,7 @@ def update( service_name: str, diagnostic_id: str, if_match: str, - parameters: Union[_models.DiagnosticContract, IO], + parameters: Union[_models.DiagnosticContract, IO[bytes]], **kwargs: Any ) -> _models.DiagnosticContract: """Updates the details of the Diagnostic specified by its identifier. @@ -873,13 +843,9 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Diagnostic Update parameters. Is either a DiagnosticContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Diagnostic Update parameters. Is either a DiagnosticContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO[bytes] :return: DiagnosticContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract :raises ~azure.core.exceptions.HttpResponseError: @@ -902,12 +868,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DiagnosticContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, diagnostic_id=diagnostic_id, @@ -917,16 +883,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -942,13 +907,9 @@ def update( deserialized = self._deserialize("DiagnosticContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -967,7 +928,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -986,23 +946,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, diagnostic_id=diagnostic_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1013,8 +972,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_documentation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_documentation_operations.py index 095fdf554303..a3f8fa923115 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_documentation_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_documentation_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +73,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -121,7 +122,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,7 +165,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -214,7 +215,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -268,7 +269,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -320,7 +321,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -376,7 +377,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DocumentationContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.DocumentationContract] @@ -399,7 +399,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -407,12 +407,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -424,13 +423,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DocumentationCollection", pipeline_response) @@ -440,11 +439,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -457,10 +456,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations" - } - @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, documentation_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the Documentation by its identifier. @@ -473,7 +468,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, documentat :param documentation_id: Documentation identifier. Must be unique in the current API Management service instance. Required. :type documentation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -492,22 +486,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, documentat api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, documentation_id=documentation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -521,13 +514,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, documentat response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, documentation_id: str, **kwargs: Any @@ -542,7 +531,6 @@ def get( :param documentation_id: Documentation identifier. Must be unique in the current API Management service instance. Required. :type documentation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DocumentationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DocumentationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -561,22 +549,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DocumentationContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, documentation_id=documentation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -592,13 +579,9 @@ def get( deserialized = self._deserialize("DocumentationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -630,7 +613,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DocumentationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DocumentationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -642,7 +624,7 @@ def create_or_update( resource_group_name: str, service_name: str, documentation_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -659,14 +641,13 @@ def create_or_update( service instance. Required. :type documentation_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DocumentationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DocumentationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -678,7 +659,7 @@ def create_or_update( resource_group_name: str, service_name: str, documentation_id: str, - parameters: Union[_models.DocumentationContract, IO], + parameters: Union[_models.DocumentationContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.DocumentationContract: @@ -692,16 +673,12 @@ def create_or_update( :param documentation_id: Documentation identifier. Must be unique in the current API Management service instance. Required. :type documentation_id: str - :param parameters: Create parameters. Is either a DocumentationContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.DocumentationContract or IO + :param parameters: Create parameters. Is either a DocumentationContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.DocumentationContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DocumentationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DocumentationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -724,12 +701,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DocumentationContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, documentation_id=documentation_id, @@ -739,16 +716,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -774,10 +750,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" - } - @overload def update( self, @@ -808,7 +780,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DocumentationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DocumentationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -821,7 +792,7 @@ def update( service_name: str, documentation_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -840,11 +811,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Documentation Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: DocumentationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DocumentationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -857,7 +827,7 @@ def update( service_name: str, documentation_id: str, if_match: str, - parameters: Union[_models.DocumentationUpdateContract, IO], + parameters: Union[_models.DocumentationUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.DocumentationContract: """Updates the details of the Documentation for an API specified by its identifier. @@ -874,12 +844,8 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Documentation Update parameters. Is either a DocumentationUpdateContract - type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.DocumentationUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.DocumentationUpdateContract or IO[bytes] :return: DocumentationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.DocumentationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -902,12 +868,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DocumentationUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, documentation_id=documentation_id, @@ -917,16 +883,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -942,13 +907,9 @@ def update( deserialized = self._deserialize("DocumentationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -967,7 +928,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -986,23 +946,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, documentation_id=documentation_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1013,8 +972,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_email_template_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_email_template_operations.py index 66b7d1020e85..6329a5cb4fe8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_email_template_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_email_template_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +73,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -123,7 +124,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -168,7 +169,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -216,7 +217,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -268,7 +269,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -318,7 +319,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -375,7 +376,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EmailTemplateContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.EmailTemplateContract] @@ -398,7 +398,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -406,12 +406,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -423,13 +422,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("EmailTemplateCollection", pipeline_response) @@ -439,11 +438,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -456,10 +455,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates" - } - @distributed_trace def get_entity_tag( self, @@ -484,7 +479,6 @@ def get_entity_tag( "passwordResetByAdminNotificationMessage", "rejectDeveloperNotificationMessage", and "requestDeveloperNotificationMessage". Required. :type template_name: str or ~azure.mgmt.apimanagement.models.TemplateName - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -503,22 +497,21 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, template_name=template_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -532,13 +525,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" - } - @distributed_trace def get( self, @@ -563,7 +552,6 @@ def get( "passwordResetByAdminNotificationMessage", "rejectDeveloperNotificationMessage", and "requestDeveloperNotificationMessage". Required. :type template_name: str or ~azure.mgmt.apimanagement.models.TemplateName - :keyword callable cls: A custom type or function that will be passed the direct response :return: EmailTemplateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -582,22 +570,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EmailTemplateContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, template_name=template_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -613,13 +600,9 @@ def get( deserialized = self._deserialize("EmailTemplateContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -657,7 +640,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EmailTemplateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -669,7 +651,7 @@ def create_or_update( resource_group_name: str, service_name: str, template_name: Union[str, _models.TemplateName], - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -692,14 +674,13 @@ def create_or_update( "requestDeveloperNotificationMessage". Required. :type template_name: str or ~azure.mgmt.apimanagement.models.TemplateName :param parameters: Email Template update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EmailTemplateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -711,7 +692,7 @@ def create_or_update( resource_group_name: str, service_name: str, template_name: Union[str, _models.TemplateName], - parameters: Union[_models.EmailTemplateUpdateParameters, IO], + parameters: Union[_models.EmailTemplateUpdateParameters, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.EmailTemplateContract: @@ -732,15 +713,11 @@ def create_or_update( "requestDeveloperNotificationMessage". Required. :type template_name: str or ~azure.mgmt.apimanagement.models.TemplateName :param parameters: Email Template update parameters. Is either a EmailTemplateUpdateParameters - type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.EmailTemplateUpdateParameters or IO + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.EmailTemplateUpdateParameters or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EmailTemplateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -763,12 +740,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "EmailTemplateUpdateParameters") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, template_name=template_name, @@ -778,16 +755,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -808,10 +784,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" - } - @overload def update( self, @@ -848,7 +820,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EmailTemplateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -861,7 +832,7 @@ def update( service_name: str, template_name: Union[str, _models.TemplateName], if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -886,11 +857,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: EmailTemplateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -903,7 +873,7 @@ def update( service_name: str, template_name: Union[str, _models.TemplateName], if_match: str, - parameters: Union[_models.EmailTemplateUpdateParameters, IO], + parameters: Union[_models.EmailTemplateUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.EmailTemplateContract: """Updates API Management email template. @@ -925,13 +895,9 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a EmailTemplateUpdateParameters type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.EmailTemplateUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a EmailTemplateUpdateParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.EmailTemplateUpdateParameters or IO[bytes] :return: EmailTemplateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -954,12 +920,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "EmailTemplateUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, template_name=template_name, @@ -969,16 +935,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -994,13 +959,9 @@ def update( deserialized = self._deserialize("EmailTemplateContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1030,7 +991,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1049,23 +1009,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, template_name=template_name, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1076,8 +1035,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_api_operations.py index 60e7cb8fd4cd..28885b7ab3fa 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_api_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_api_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +75,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -122,7 +123,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,7 +166,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,7 +210,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -269,7 +270,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -291,7 +291,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -300,12 +300,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -317,13 +316,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ApiCollection", pipeline_response) @@ -333,11 +332,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -350,10 +349,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis" - } - @distributed_trace def get_entity_tag( self, resource_group_name: str, service_name: str, gateway_id: str, api_id: str, **kwargs: Any @@ -371,7 +366,6 @@ def get_entity_tag( :param api_id: API identifier. Must be unique in the current API Management service instance. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -390,23 +384,22 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -420,13 +413,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}" - } - @overload def create_or_update( self, @@ -457,7 +446,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -470,7 +458,7 @@ def create_or_update( service_name: str, gateway_id: str, api_id: str, - parameters: Optional[IO] = None, + parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -489,11 +477,10 @@ def create_or_update( Required. :type api_id: str :param parameters: Default value is None. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -506,7 +493,7 @@ def create_or_update( service_name: str, gateway_id: str, api_id: str, - parameters: Optional[Union[_models.AssociationContract, IO]] = None, + parameters: Optional[Union[_models.AssociationContract, IO[bytes]]] = None, **kwargs: Any ) -> _models.ApiContract: """Adds an API to the specified Gateway. @@ -522,12 +509,9 @@ def create_or_update( :param api_id: API identifier. Must be unique in the current API Management service instance. Required. :type api_id: str - :param parameters: Is either a AssociationContract type or a IO type. Default value is None. - :type parameters: ~azure.mgmt.apimanagement.models.AssociationContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Is either a AssociationContract type or a IO[bytes] type. Default value is + None. + :type parameters: ~azure.mgmt.apimanagement.models.AssociationContract or IO[bytes] :return: ApiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -550,7 +534,7 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: if parameters is not None: @@ -558,7 +542,7 @@ def create_or_update( else: _json = None - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -568,16 +552,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -598,10 +581,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, gateway_id: str, api_id: str, **kwargs: Any @@ -619,7 +598,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param api_id: API identifier. Must be unique in the current API Management service instance. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -638,23 +616,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -665,8 +642,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_certificate_authority_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_certificate_authority_operations.py index 1fd1cabaaa7e..5433df4c9733 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_certificate_authority_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_certificate_authority_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +75,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -129,7 +130,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -178,7 +179,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -230,7 +231,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -285,7 +286,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -345,7 +346,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GatewayCertificateAuthorityContract or the result of cls(response) :rtype: @@ -369,7 +369,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -378,12 +378,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -395,13 +394,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("GatewayCertificateAuthorityCollection", pipeline_response) @@ -411,11 +410,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -428,10 +427,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities" - } - @distributed_trace def get_entity_tag( self, resource_group_name: str, service_name: str, gateway_id: str, certificate_id: str, **kwargs: Any @@ -449,7 +444,6 @@ def get_entity_tag( :param certificate_id: Identifier of the certificate entity. Must be unique in the current API Management service instance. Required. :type certificate_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -468,23 +462,22 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, certificate_id=certificate_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -498,13 +491,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, gateway_id: str, certificate_id: str, **kwargs: Any @@ -522,7 +511,6 @@ def get( :param certificate_id: Identifier of the certificate entity. Must be unique in the current API Management service instance. Required. :type certificate_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayCertificateAuthorityContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityContract :raises ~azure.core.exceptions.HttpResponseError: @@ -541,23 +529,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GatewayCertificateAuthorityContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, certificate_id=certificate_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -573,13 +560,9 @@ def get( deserialized = self._deserialize("GatewayCertificateAuthorityContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -615,7 +598,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayCertificateAuthorityContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityContract :raises ~azure.core.exceptions.HttpResponseError: @@ -628,7 +610,7 @@ def create_or_update( service_name: str, gateway_id: str, certificate_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -648,14 +630,13 @@ def create_or_update( Management service instance. Required. :type certificate_id: str :param parameters: Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayCertificateAuthorityContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityContract :raises ~azure.core.exceptions.HttpResponseError: @@ -668,7 +649,7 @@ def create_or_update( service_name: str, gateway_id: str, certificate_id: str, - parameters: Union[_models.GatewayCertificateAuthorityContract, IO], + parameters: Union[_models.GatewayCertificateAuthorityContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.GatewayCertificateAuthorityContract: @@ -685,15 +666,13 @@ def create_or_update( :param certificate_id: Identifier of the certificate entity. Must be unique in the current API Management service instance. Required. :type certificate_id: str - :param parameters: Is either a GatewayCertificateAuthorityContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityContract or IO + :param parameters: Is either a GatewayCertificateAuthorityContract type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityContract or + IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayCertificateAuthorityContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityContract :raises ~azure.core.exceptions.HttpResponseError: @@ -716,12 +695,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GatewayCertificateAuthorityContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -732,16 +711,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -767,10 +745,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, @@ -797,7 +771,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -816,7 +789,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -824,16 +797,15 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -844,8 +816,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_hostname_configuration_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_hostname_configuration_operations.py index 025217ce6e92..f8cb8c8d17ce 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_hostname_configuration_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_hostname_configuration_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +75,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -122,7 +123,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,7 +165,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -214,7 +215,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -267,7 +268,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -329,7 +330,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GatewayHostnameConfigurationContract or the result of cls(response) :rtype: @@ -353,7 +353,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -362,12 +362,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -379,13 +378,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("GatewayHostnameConfigurationCollection", pipeline_response) @@ -395,11 +394,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -412,10 +411,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations" - } - @distributed_trace def get_entity_tag( self, resource_group_name: str, service_name: str, gateway_id: str, hc_id: str, **kwargs: Any @@ -434,7 +429,6 @@ def get_entity_tag( :param hc_id: Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. Required. :type hc_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -453,23 +447,22 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, hc_id=hc_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -483,13 +476,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, gateway_id: str, hc_id: str, **kwargs: Any @@ -507,7 +496,6 @@ def get( :param hc_id: Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. Required. :type hc_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayHostnameConfigurationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -526,23 +514,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GatewayHostnameConfigurationContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, hc_id=hc_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -558,13 +545,9 @@ def get( deserialized = self._deserialize("GatewayHostnameConfigurationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -600,7 +583,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayHostnameConfigurationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -613,7 +595,7 @@ def create_or_update( service_name: str, gateway_id: str, hc_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -633,14 +615,13 @@ def create_or_update( Gateway entity. Required. :type hc_id: str :param parameters: Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayHostnameConfigurationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -653,7 +634,7 @@ def create_or_update( service_name: str, gateway_id: str, hc_id: str, - parameters: Union[_models.GatewayHostnameConfigurationContract, IO], + parameters: Union[_models.GatewayHostnameConfigurationContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.GatewayHostnameConfigurationContract: @@ -670,16 +651,13 @@ def create_or_update( :param hc_id: Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. Required. :type hc_id: str - :param parameters: Is either a GatewayHostnameConfigurationContract type or a IO type. + :param parameters: Is either a GatewayHostnameConfigurationContract type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationContract or IO + :type parameters: ~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationContract or + IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayHostnameConfigurationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -702,12 +680,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GatewayHostnameConfigurationContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -718,16 +696,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -753,10 +730,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, gateway_id: str, hc_id: str, if_match: str, **kwargs: Any @@ -777,7 +750,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -796,7 +768,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -804,16 +776,15 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -824,8 +795,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_operations.py index 94ec902d0db3..c2f420414748 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +73,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -119,7 +120,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +161,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -208,7 +209,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -254,7 +255,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -298,7 +299,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -340,7 +341,7 @@ def build_list_keys_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -382,7 +383,7 @@ def build_regenerate_key_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -426,7 +427,7 @@ def build_generate_token_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -486,7 +487,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GatewayContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.GatewayContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -508,7 +508,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -516,12 +516,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -533,13 +532,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("GatewayCollection", pipeline_response) @@ -549,11 +548,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -566,10 +565,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways" - } - @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, gateway_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the Gateway specified by its identifier. @@ -582,7 +577,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, gateway_id :param gateway_id: Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. Required. :type gateway_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -601,22 +595,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, gateway_id api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -630,13 +623,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, gateway_id response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, gateway_id: str, **kwargs: Any @@ -651,7 +640,6 @@ def get( :param gateway_id: Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. Required. :type gateway_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayContract :raises ~azure.core.exceptions.HttpResponseError: @@ -670,22 +658,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GatewayContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -701,13 +688,9 @@ def get( deserialized = self._deserialize("GatewayContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -739,7 +722,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayContract :raises ~azure.core.exceptions.HttpResponseError: @@ -751,7 +733,7 @@ def create_or_update( resource_group_name: str, service_name: str, gateway_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -768,14 +750,13 @@ def create_or_update( service instance. Must not have value 'managed'. Required. :type gateway_id: str :param parameters: Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayContract :raises ~azure.core.exceptions.HttpResponseError: @@ -787,7 +768,7 @@ def create_or_update( resource_group_name: str, service_name: str, gateway_id: str, - parameters: Union[_models.GatewayContract, IO], + parameters: Union[_models.GatewayContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.GatewayContract: @@ -801,15 +782,11 @@ def create_or_update( :param gateway_id: Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. Required. :type gateway_id: str - :param parameters: Is either a GatewayContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.GatewayContract or IO + :param parameters: Is either a GatewayContract type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.GatewayContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayContract :raises ~azure.core.exceptions.HttpResponseError: @@ -832,12 +809,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GatewayContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -847,16 +824,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -882,10 +858,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" - } - @overload def update( self, @@ -916,7 +888,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayContract :raises ~azure.core.exceptions.HttpResponseError: @@ -929,7 +900,7 @@ def update( service_name: str, gateway_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -948,11 +919,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayContract :raises ~azure.core.exceptions.HttpResponseError: @@ -965,7 +935,7 @@ def update( service_name: str, gateway_id: str, if_match: str, - parameters: Union[_models.GatewayContract, IO], + parameters: Union[_models.GatewayContract, IO[bytes]], **kwargs: Any ) -> _models.GatewayContract: """Updates the details of the gateway specified by its identifier. @@ -981,12 +951,8 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Is either a GatewayContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.GatewayContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Is either a GatewayContract type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.GatewayContract or IO[bytes] :return: GatewayContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1009,12 +975,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GatewayContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -1024,16 +990,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1049,13 +1014,9 @@ def update( deserialized = self._deserialize("GatewayContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1074,7 +1035,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1093,23 +1053,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1120,11 +1079,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_keys( @@ -1140,7 +1095,6 @@ def list_keys( :param gateway_id: Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. Required. :type gateway_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayKeysContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayKeysContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1159,22 +1113,21 @@ def list_keys( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GatewayKeysContract] = kwargs.pop("cls", None) - request = build_list_keys_request( + _request = build_list_keys_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1190,13 +1143,9 @@ def list_keys( deserialized = self._deserialize("GatewayKeysContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - list_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listKeys" - } + return deserialized # type: ignore @overload def regenerate_key( # pylint: disable=inconsistent-return-statements @@ -1224,7 +1173,6 @@ def regenerate_key( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1236,7 +1184,7 @@ def regenerate_key( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, gateway_id: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1252,11 +1200,10 @@ def regenerate_key( # pylint: disable=inconsistent-return-statements service instance. Must not have value 'managed'. Required. :type gateway_id: str :param parameters: Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1268,7 +1215,7 @@ def regenerate_key( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, gateway_id: str, - parameters: Union[_models.GatewayKeyRegenerationRequestContract, IO], + parameters: Union[_models.GatewayKeyRegenerationRequestContract, IO[bytes]], **kwargs: Any ) -> None: """Regenerates specified gateway key invalidating any tokens created with it. @@ -1281,13 +1228,10 @@ def regenerate_key( # pylint: disable=inconsistent-return-statements :param gateway_id: Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. Required. :type gateway_id: str - :param parameters: Is either a GatewayKeyRegenerationRequestContract type or a IO type. + :param parameters: Is either a GatewayKeyRegenerationRequestContract type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.GatewayKeyRegenerationRequestContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :type parameters: ~azure.mgmt.apimanagement.models.GatewayKeyRegenerationRequestContract or + IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1310,12 +1254,12 @@ def regenerate_key( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GatewayKeyRegenerationRequestContract") - request = build_regenerate_key_request( + _request = build_regenerate_key_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -1324,16 +1268,15 @@ def regenerate_key( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.regenerate_key.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1344,11 +1287,7 @@ def regenerate_key( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - regenerate_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/regenerateKey" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def generate_token( @@ -1376,7 +1315,6 @@ def generate_token( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayTokenContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayTokenContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1388,7 +1326,7 @@ def generate_token( resource_group_name: str, service_name: str, gateway_id: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1404,11 +1342,10 @@ def generate_token( service instance. Must not have value 'managed'. Required. :type gateway_id: str :param parameters: Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewayTokenContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayTokenContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1420,7 +1357,7 @@ def generate_token( resource_group_name: str, service_name: str, gateway_id: str, - parameters: Union[_models.GatewayTokenRequestContract, IO], + parameters: Union[_models.GatewayTokenRequestContract, IO[bytes]], **kwargs: Any ) -> _models.GatewayTokenContract: """Gets the Shared Access Authorization Token for the gateway. @@ -1433,12 +1370,8 @@ def generate_token( :param gateway_id: Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. Required. :type gateway_id: str - :param parameters: Is either a GatewayTokenRequestContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.GatewayTokenRequestContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Is either a GatewayTokenRequestContract type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.GatewayTokenRequestContract or IO[bytes] :return: GatewayTokenContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GatewayTokenContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1461,12 +1394,12 @@ def generate_token( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GatewayTokenRequestContract") - request = build_generate_token_request( + _request = build_generate_token_request( resource_group_name=resource_group_name, service_name=service_name, gateway_id=gateway_id, @@ -1475,16 +1408,15 @@ def generate_token( content_type=content_type, json=_json, content=_content, - template_url=self.generate_token.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1497,10 +1429,6 @@ def generate_token( deserialized = self._deserialize("GatewayTokenContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - generate_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/generateToken" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_global_schema_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_global_schema_operations.py index 88e3e2dfe1c3..c98d4a466ec2 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_global_schema_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_global_schema_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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 @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +75,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -121,7 +122,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -162,7 +163,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -210,7 +211,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -255,7 +256,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -312,7 +313,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GlobalSchemaContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.GlobalSchemaContract] @@ -335,7 +335,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -343,12 +343,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -360,13 +359,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("GlobalSchemaCollection", pipeline_response) @@ -376,11 +375,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -393,10 +392,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas" - } - @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, schema_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the Schema specified by its identifier. @@ -409,7 +404,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, schema_id: :param schema_id: Schema id identifier. Must be unique in the current API Management service instance. Required. :type schema_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -428,22 +422,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, schema_id: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, schema_id=schema_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -457,13 +450,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, schema_id: response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, schema_id: str, **kwargs: Any @@ -478,7 +467,6 @@ def get( :param schema_id: Schema id identifier. Must be unique in the current API Management service instance. Required. :type schema_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalSchemaContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GlobalSchemaContract :raises ~azure.core.exceptions.HttpResponseError: @@ -497,22 +485,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalSchemaContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, schema_id=schema_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -528,20 +515,16 @@ def get( deserialized = self._deserialize("GlobalSchemaContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, service_name: str, schema_id: str, - parameters: Union[_models.GlobalSchemaContract, IO], + parameters: Union[_models.GlobalSchemaContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> Optional[_models.GlobalSchemaContract]: @@ -563,12 +546,12 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GlobalSchemaContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, schema_id=schema_id, @@ -578,16 +561,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -610,13 +592,9 @@ def _create_or_update_initial( deserialized = self._deserialize("GlobalSchemaContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -648,14 +626,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either GlobalSchemaContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.GlobalSchemaContract] @@ -668,7 +638,7 @@ def begin_create_or_update( resource_group_name: str, service_name: str, schema_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -685,21 +655,13 @@ def begin_create_or_update( instance. Required. :type schema_id: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either GlobalSchemaContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.GlobalSchemaContract] @@ -712,7 +674,7 @@ def begin_create_or_update( resource_group_name: str, service_name: str, schema_id: str, - parameters: Union[_models.GlobalSchemaContract, IO], + parameters: Union[_models.GlobalSchemaContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> LROPoller[_models.GlobalSchemaContract]: @@ -726,23 +688,12 @@ def begin_create_or_update( :param schema_id: Schema id identifier. Must be unique in the current API Management service instance. Required. :type schema_id: str - :param parameters: Create or update parameters. Is either a GlobalSchemaContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.GlobalSchemaContract or IO + :param parameters: Create or update parameters. Is either a GlobalSchemaContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.GlobalSchemaContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either GlobalSchemaContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.GlobalSchemaContract] @@ -780,7 +731,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("GlobalSchemaContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -792,17 +743,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.GlobalSchemaContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" - } + return LROPoller[_models.GlobalSchemaContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -821,7 +770,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -840,23 +788,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, schema_id=schema_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -867,8 +814,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_operations.py index ce2deecca4ef..65c1d2606de9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +75,7 @@ def build_list_by_api_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -122,7 +123,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,7 +165,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -214,7 +215,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -268,7 +269,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -320,7 +321,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -384,7 +385,6 @@ def list_by_api( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResolverContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ResolverContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -406,7 +406,7 @@ def list_by_api( def prepare_request(next_link=None): if not next_link: - request = build_list_by_api_request( + _request = build_list_by_api_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -415,12 +415,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -432,13 +431,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ResolverCollection", pipeline_response) @@ -448,11 +447,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -465,10 +464,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers" - } - @distributed_trace def get_entity_tag( self, resource_group_name: str, service_name: str, api_id: str, resolver_id: str, **kwargs: Any @@ -486,7 +481,6 @@ def get_entity_tag( :param resolver_id: Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. Required. :type resolver_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -505,23 +499,22 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, resolver_id=resolver_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -535,13 +528,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, api_id: str, resolver_id: str, **kwargs: Any @@ -559,7 +548,6 @@ def get( :param resolver_id: Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. Required. :type resolver_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ResolverContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ResolverContract :raises ~azure.core.exceptions.HttpResponseError: @@ -578,23 +566,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResolverContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, resolver_id=resolver_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -610,13 +597,9 @@ def get( deserialized = self._deserialize("ResolverContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -652,7 +635,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ResolverContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ResolverContract :raises ~azure.core.exceptions.HttpResponseError: @@ -665,7 +647,7 @@ def create_or_update( service_name: str, api_id: str, resolver_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -685,14 +667,13 @@ def create_or_update( Management service instance. Required. :type resolver_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ResolverContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ResolverContract :raises ~azure.core.exceptions.HttpResponseError: @@ -705,7 +686,7 @@ def create_or_update( service_name: str, api_id: str, resolver_id: str, - parameters: Union[_models.ResolverContract, IO], + parameters: Union[_models.ResolverContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.ResolverContract: @@ -722,15 +703,12 @@ def create_or_update( :param resolver_id: Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. Required. :type resolver_id: str - :param parameters: Create parameters. Is either a ResolverContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ResolverContract or IO + :param parameters: Create parameters. Is either a ResolverContract type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.apimanagement.models.ResolverContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ResolverContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ResolverContract :raises ~azure.core.exceptions.HttpResponseError: @@ -753,12 +731,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ResolverContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -769,16 +747,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -804,10 +781,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" - } - @overload def update( self, @@ -842,7 +815,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ResolverContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ResolverContract :raises ~azure.core.exceptions.HttpResponseError: @@ -856,7 +828,7 @@ def update( api_id: str, resolver_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -878,11 +850,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: GraphQL API Resolver Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: ResolverContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ResolverContract :raises ~azure.core.exceptions.HttpResponseError: @@ -896,7 +867,7 @@ def update( api_id: str, resolver_id: str, if_match: str, - parameters: Union[_models.ResolverUpdateContract, IO], + parameters: Union[_models.ResolverUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.ResolverContract: """Updates the details of the resolver in the GraphQL API specified by its identifier. @@ -916,12 +887,8 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: GraphQL API Resolver Update parameters. Is either a ResolverUpdateContract - type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.ResolverUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ResolverUpdateContract or IO[bytes] :return: ResolverContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ResolverContract :raises ~azure.core.exceptions.HttpResponseError: @@ -944,12 +911,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ResolverUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -960,16 +927,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -985,13 +951,9 @@ def update( deserialized = self._deserialize("ResolverContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1013,7 +975,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1032,7 +993,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -1040,16 +1001,15 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1060,8 +1020,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_policy_operations.py index 38e54b6b1cfa..3c057a54e7da 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_policy_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -67,7 +68,7 @@ def build_list_by_resolver_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,7 +117,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -167,7 +168,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if format is not None: @@ -221,7 +222,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -276,7 +277,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -324,7 +325,6 @@ def list_by_resolver( :param resolver_id: Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. Required. :type resolver_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PolicyContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.PolicyContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -346,19 +346,18 @@ def list_by_resolver( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resolver_request( + _request = build_list_by_resolver_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, resolver_id=resolver_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resolver.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -370,13 +369,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PolicyCollection", pipeline_response) @@ -386,11 +385,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -403,10 +402,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resolver.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies" - } - @distributed_trace def get_entity_tag( self, @@ -433,7 +428,6 @@ def get_entity_tag( :type resolver_id: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -452,7 +446,7 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -460,16 +454,15 @@ def get_entity_tag( policy_id=policy_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -483,13 +476,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}" - } - @distributed_trace def get( self, @@ -519,7 +508,6 @@ def get( :param format: Policy Export Format. Known values are: "xml" and "rawxml". Default value is "xml". :type format: str or ~azure.mgmt.apimanagement.models.PolicyExportFormat - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -538,7 +526,7 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -547,16 +535,15 @@ def get( subscription_id=self._config.subscription_id, format=format, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -572,13 +559,9 @@ def get( deserialized = self._deserialize("PolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -617,7 +600,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -631,7 +613,7 @@ def create_or_update( api_id: str, resolver_id: str, policy_id: Union[str, _models.PolicyIdName], - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -653,14 +635,13 @@ def create_or_update( :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName :param parameters: The policy contents to apply. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -674,7 +655,7 @@ def create_or_update( api_id: str, resolver_id: str, policy_id: Union[str, _models.PolicyIdName], - parameters: Union[_models.PolicyContract, IO], + parameters: Union[_models.PolicyContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.PolicyContract: @@ -693,16 +674,12 @@ def create_or_update( :type resolver_id: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO + :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -725,12 +702,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PolicyContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -742,16 +719,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -777,10 +753,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, @@ -810,7 +782,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -829,7 +800,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -838,16 +809,15 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -858,8 +828,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_group_operations.py index dd1c91211075..98474003b482 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_group_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_group_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +73,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -119,7 +120,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +161,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -208,7 +209,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -254,7 +255,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -298,7 +299,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -360,7 +361,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GroupContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.GroupContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -382,7 +382,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -390,12 +390,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -407,13 +406,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("GroupCollection", pipeline_response) @@ -423,11 +422,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -440,10 +439,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups" - } - @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, group_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the group specified by its identifier. @@ -456,7 +451,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, group_id: :param group_id: Group identifier. Must be unique in the current API Management service instance. Required. :type group_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -475,22 +469,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, group_id: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, group_id=group_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -504,13 +497,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, group_id: response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" - } - @distributed_trace def get(self, resource_group_name: str, service_name: str, group_id: str, **kwargs: Any) -> _models.GroupContract: """Gets the details of the group specified by its identifier. @@ -523,7 +512,6 @@ def get(self, resource_group_name: str, service_name: str, group_id: str, **kwar :param group_id: Group identifier. Must be unique in the current API Management service instance. Required. :type group_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GroupContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GroupContract :raises ~azure.core.exceptions.HttpResponseError: @@ -542,22 +530,21 @@ def get(self, resource_group_name: str, service_name: str, group_id: str, **kwar api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GroupContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, group_id=group_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -573,13 +560,9 @@ def get(self, resource_group_name: str, service_name: str, group_id: str, **kwar deserialized = self._deserialize("GroupContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -611,7 +594,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GroupContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GroupContract :raises ~azure.core.exceptions.HttpResponseError: @@ -623,7 +605,7 @@ def create_or_update( resource_group_name: str, service_name: str, group_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -640,14 +622,13 @@ def create_or_update( instance. Required. :type group_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GroupContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GroupContract :raises ~azure.core.exceptions.HttpResponseError: @@ -659,7 +640,7 @@ def create_or_update( resource_group_name: str, service_name: str, group_id: str, - parameters: Union[_models.GroupCreateParameters, IO], + parameters: Union[_models.GroupCreateParameters, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.GroupContract: @@ -673,16 +654,12 @@ def create_or_update( :param group_id: Group identifier. Must be unique in the current API Management service instance. Required. :type group_id: str - :param parameters: Create parameters. Is either a GroupCreateParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.GroupCreateParameters or IO + :param parameters: Create parameters. Is either a GroupCreateParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.GroupCreateParameters or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GroupContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GroupContract :raises ~azure.core.exceptions.HttpResponseError: @@ -705,12 +682,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GroupCreateParameters") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, group_id=group_id, @@ -720,16 +697,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -755,10 +731,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" - } - @overload def update( self, @@ -789,7 +761,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GroupContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GroupContract :raises ~azure.core.exceptions.HttpResponseError: @@ -802,7 +773,7 @@ def update( service_name: str, group_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -821,11 +792,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: GroupContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GroupContract :raises ~azure.core.exceptions.HttpResponseError: @@ -838,7 +808,7 @@ def update( service_name: str, group_id: str, if_match: str, - parameters: Union[_models.GroupUpdateParameters, IO], + parameters: Union[_models.GroupUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.GroupContract: """Updates the details of the group specified by its identifier. @@ -854,13 +824,9 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a GroupUpdateParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.GroupUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a GroupUpdateParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.GroupUpdateParameters or IO[bytes] :return: GroupContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GroupContract :raises ~azure.core.exceptions.HttpResponseError: @@ -883,12 +849,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GroupUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, group_id=group_id, @@ -898,16 +864,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -923,13 +888,9 @@ def update( deserialized = self._deserialize("GroupContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -948,7 +909,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -967,23 +927,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, group_id=group_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -994,8 +953,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_group_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_group_user_operations.py index 4862d8546ab8..dfd484e2f246 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_group_user_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_group_user_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +74,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -122,7 +122,7 @@ def build_check_entity_exists_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,7 +164,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -206,7 +206,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -270,7 +270,6 @@ def list( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.UserContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -292,7 +291,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, service_name=service_name, group_id=group_id, @@ -301,12 +300,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -318,13 +316,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("UserCollection", pipeline_response) @@ -334,11 +332,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -351,10 +349,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users" - } - @distributed_trace def check_entity_exists( self, resource_group_name: str, service_name: str, group_id: str, user_id: str, **kwargs: Any @@ -372,7 +366,6 @@ def check_entity_exists( :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -391,23 +384,22 @@ def check_entity_exists( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_check_entity_exists_request( + _request = build_check_entity_exists_request( resource_group_name=resource_group_name, service_name=service_name, group_id=group_id, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.check_entity_exists.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,13 +410,9 @@ def check_entity_exists( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 - check_entity_exists.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}" - } - @distributed_trace def create( self, resource_group_name: str, service_name: str, group_id: str, user_id: str, **kwargs: Any @@ -442,7 +430,6 @@ def create( :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserContract :raises ~azure.core.exceptions.HttpResponseError: @@ -461,23 +448,22 @@ def create( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UserContract] = kwargs.pop("cls", None) - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, service_name=service_name, group_id=group_id, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -498,10 +484,6 @@ def create( return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, group_id: str, user_id: str, **kwargs: Any @@ -519,7 +501,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -538,23 +519,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, group_id=group_id, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -565,8 +545,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_identity_provider_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_identity_provider_operations.py index 3757d032619a..d2911956e421 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_identity_provider_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_identity_provider_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +66,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,7 +111,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +156,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,7 +204,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -255,7 +256,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,7 +306,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -351,7 +352,7 @@ def build_list_secrets_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -396,7 +397,6 @@ def list_by_service( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IdentityProviderContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.IdentityProviderContract] @@ -419,17 +419,16 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -441,13 +440,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("IdentityProviderList", pipeline_response) @@ -457,11 +456,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -474,10 +473,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders" - } - @distributed_trace def get_entity_tag( self, @@ -496,7 +491,6 @@ def get_entity_tag( :param identity_provider_name: Identity Provider Type identifier. Known values are: "facebook", "google", "microsoft", "twitter", "aad", and "aadB2C". Required. :type identity_provider_name: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -515,22 +509,21 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, identity_provider_name=identity_provider_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -544,13 +537,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" - } - @distributed_trace def get( self, @@ -570,7 +559,6 @@ def get( :param identity_provider_name: Identity Provider Type identifier. Known values are: "facebook", "google", "microsoft", "twitter", "aad", and "aadB2C". Required. :type identity_provider_name: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :keyword callable cls: A custom type or function that will be passed the direct response :return: IdentityProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -589,22 +577,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IdentityProviderContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, identity_provider_name=identity_provider_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -620,13 +607,9 @@ def get( deserialized = self._deserialize("IdentityProviderContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -658,7 +641,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IdentityProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -670,7 +652,7 @@ def create_or_update( resource_group_name: str, service_name: str, identity_provider_name: Union[str, _models.IdentityProviderType], - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -687,14 +669,13 @@ def create_or_update( "google", "microsoft", "twitter", "aad", and "aadB2C". Required. :type identity_provider_name: str or ~azure.mgmt.apimanagement.models.IdentityProviderType :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IdentityProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -706,7 +687,7 @@ def create_or_update( resource_group_name: str, service_name: str, identity_provider_name: Union[str, _models.IdentityProviderType], - parameters: Union[_models.IdentityProviderCreateContract, IO], + parameters: Union[_models.IdentityProviderCreateContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.IdentityProviderContract: @@ -720,16 +701,12 @@ def create_or_update( :param identity_provider_name: Identity Provider Type identifier. Known values are: "facebook", "google", "microsoft", "twitter", "aad", and "aadB2C". Required. :type identity_provider_name: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :param parameters: Create parameters. Is either a IdentityProviderCreateContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.IdentityProviderCreateContract or IO + :param parameters: Create parameters. Is either a IdentityProviderCreateContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.IdentityProviderCreateContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IdentityProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -752,12 +729,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "IdentityProviderCreateContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, identity_provider_name=identity_provider_name, @@ -767,16 +744,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -802,10 +778,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" - } - @overload def update( self, @@ -836,7 +808,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IdentityProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -849,7 +820,7 @@ def update( service_name: str, identity_provider_name: Union[str, _models.IdentityProviderType], if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -868,11 +839,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: IdentityProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -885,7 +855,7 @@ def update( service_name: str, identity_provider_name: Union[str, _models.IdentityProviderType], if_match: str, - parameters: Union[_models.IdentityProviderUpdateParameters, IO], + parameters: Union[_models.IdentityProviderUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.IdentityProviderContract: """Updates an existing IdentityProvider configuration. @@ -901,13 +871,10 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a IdentityProviderUpdateParameters type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.IdentityProviderUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a IdentityProviderUpdateParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.IdentityProviderUpdateParameters or + IO[bytes] :return: IdentityProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -930,12 +897,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "IdentityProviderUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, identity_provider_name=identity_provider_name, @@ -945,16 +912,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -970,13 +936,9 @@ def update( deserialized = self._deserialize("IdentityProviderContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1000,7 +962,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1019,23 +980,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, identity_provider_name=identity_provider_name, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1046,11 +1006,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_secrets( @@ -1070,7 +1026,6 @@ def list_secrets( :param identity_provider_name: Identity Provider Type identifier. Known values are: "facebook", "google", "microsoft", "twitter", "aad", and "aadB2C". Required. :type identity_provider_name: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :keyword callable cls: A custom type or function that will be passed the direct response :return: ClientSecretContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ClientSecretContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1089,22 +1044,21 @@ def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClientSecretContract] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, service_name=service_name, identity_provider_name=identity_provider_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1120,10 +1074,6 @@ def list_secrets( deserialized = self._deserialize("ClientSecretContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_issue_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_issue_operations.py index b3374ea4e716..2544e79f662f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_issue_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_issue_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +72,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -121,7 +121,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -181,7 +181,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IssueContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.IssueContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -203,7 +202,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -211,12 +210,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -228,13 +226,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("IssueCollection", pipeline_response) @@ -244,11 +242,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -261,10 +259,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues" - } - @distributed_trace def get(self, resource_group_name: str, service_name: str, issue_id: str, **kwargs: Any) -> _models.IssueContract: """Gets API Management issue details. @@ -277,7 +271,6 @@ def get(self, resource_group_name: str, service_name: str, issue_id: str, **kwar :param issue_id: Issue identifier. Must be unique in the current API Management service instance. Required. :type issue_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IssueContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.IssueContract :raises ~azure.core.exceptions.HttpResponseError: @@ -296,22 +289,21 @@ def get(self, resource_group_name: str, service_name: str, issue_id: str, **kwar api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IssueContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, issue_id=issue_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -327,10 +319,6 @@ def get(self, resource_group_name: str, service_name: str, issue_id: str, **kwar deserialized = self._deserialize("IssueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues/{issueId}" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_logger_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_logger_operations.py index 3031d6b996de..282deb89a865 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_logger_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_logger_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +73,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -119,7 +120,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +161,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -208,7 +209,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -254,7 +255,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -298,7 +299,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -360,7 +361,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LoggerContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.LoggerContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -382,7 +382,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -390,12 +390,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -407,13 +406,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("LoggerCollection", pipeline_response) @@ -423,11 +422,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -440,10 +439,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers" - } - @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, logger_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the logger specified by its identifier. @@ -456,7 +451,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, logger_id: :param logger_id: Logger identifier. Must be unique in the API Management service instance. Required. :type logger_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -475,22 +469,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, logger_id: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, logger_id=logger_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -504,13 +497,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, logger_id: response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" - } - @distributed_trace def get(self, resource_group_name: str, service_name: str, logger_id: str, **kwargs: Any) -> _models.LoggerContract: """Gets the details of the logger specified by its identifier. @@ -523,7 +512,6 @@ def get(self, resource_group_name: str, service_name: str, logger_id: str, **kwa :param logger_id: Logger identifier. Must be unique in the API Management service instance. Required. :type logger_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LoggerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.LoggerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -542,22 +530,21 @@ def get(self, resource_group_name: str, service_name: str, logger_id: str, **kwa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LoggerContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, logger_id=logger_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -573,13 +560,9 @@ def get(self, resource_group_name: str, service_name: str, logger_id: str, **kwa deserialized = self._deserialize("LoggerContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -611,7 +594,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LoggerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.LoggerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -623,7 +605,7 @@ def create_or_update( resource_group_name: str, service_name: str, logger_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -640,14 +622,13 @@ def create_or_update( Required. :type logger_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LoggerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.LoggerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -659,7 +640,7 @@ def create_or_update( resource_group_name: str, service_name: str, logger_id: str, - parameters: Union[_models.LoggerContract, IO], + parameters: Union[_models.LoggerContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.LoggerContract: @@ -673,15 +654,12 @@ def create_or_update( :param logger_id: Logger identifier. Must be unique in the API Management service instance. Required. :type logger_id: str - :param parameters: Create parameters. Is either a LoggerContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.LoggerContract or IO + :param parameters: Create parameters. Is either a LoggerContract type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.apimanagement.models.LoggerContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LoggerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.LoggerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -704,12 +682,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "LoggerContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, logger_id=logger_id, @@ -719,16 +697,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -754,10 +731,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" - } - @overload def update( self, @@ -788,7 +761,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LoggerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.LoggerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -801,7 +773,7 @@ def update( service_name: str, logger_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -820,11 +792,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: LoggerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.LoggerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -837,7 +808,7 @@ def update( service_name: str, logger_id: str, if_match: str, - parameters: Union[_models.LoggerUpdateContract, IO], + parameters: Union[_models.LoggerUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.LoggerContract: """Updates an existing logger. @@ -853,13 +824,9 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a LoggerUpdateContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.LoggerUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a LoggerUpdateContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.LoggerUpdateContract or IO[bytes] :return: LoggerContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.LoggerContract :raises ~azure.core.exceptions.HttpResponseError: @@ -882,12 +849,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "LoggerUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, logger_id=logger_id, @@ -897,16 +864,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -922,13 +888,9 @@ def update( deserialized = self._deserialize("LoggerContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -947,7 +909,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -966,23 +927,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, logger_id=logger_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -993,8 +953,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_named_value_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_named_value_operations.py index ac9cf85e0c3e..fc2acf5894a2 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_named_value_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_named_value_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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 @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +76,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -128,7 +129,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +172,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -221,7 +222,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -275,7 +276,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -327,7 +328,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -371,7 +372,7 @@ def build_list_value_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -414,7 +415,7 @@ def build_refresh_secret_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -478,7 +479,6 @@ def list_by_service( :param is_key_vault_refresh_failed: When set to true, the response contains only named value entities which failed refresh. Default value is None. :type is_key_vault_refresh_failed: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NamedValueContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.NamedValueContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -500,7 +500,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -509,12 +509,11 @@ def prepare_request(next_link=None): skip=skip, is_key_vault_refresh_failed=is_key_vault_refresh_failed, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -526,13 +525,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("NamedValueCollection", pipeline_response) @@ -542,11 +541,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -559,10 +558,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues" - } - @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, named_value_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the named value specified by its identifier. @@ -574,7 +569,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, named_valu :type service_name: str :param named_value_id: Identifier of the NamedValue. Required. :type named_value_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -593,22 +587,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, named_valu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -622,13 +615,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, named_valu response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, named_value_id: str, **kwargs: Any @@ -642,7 +631,6 @@ def get( :type service_name: str :param named_value_id: Identifier of the NamedValue. Required. :type named_value_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NamedValueContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.NamedValueContract :raises ~azure.core.exceptions.HttpResponseError: @@ -661,22 +649,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NamedValueContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -692,20 +679,16 @@ def get( deserialized = self._deserialize("NamedValueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, service_name: str, named_value_id: str, - parameters: Union[_models.NamedValueCreateContract, IO], + parameters: Union[_models.NamedValueCreateContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> Optional[_models.NamedValueContract]: @@ -727,12 +710,12 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "NamedValueCreateContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, @@ -742,16 +725,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -774,13 +756,9 @@ def _create_or_update_initial( deserialized = self._deserialize("NamedValueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -811,14 +789,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either NamedValueContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] @@ -831,7 +801,7 @@ def begin_create_or_update( resource_group_name: str, service_name: str, named_value_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -847,21 +817,13 @@ def begin_create_or_update( :param named_value_id: Identifier of the NamedValue. Required. :type named_value_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either NamedValueContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] @@ -874,7 +836,7 @@ def begin_create_or_update( resource_group_name: str, service_name: str, named_value_id: str, - parameters: Union[_models.NamedValueCreateContract, IO], + parameters: Union[_models.NamedValueCreateContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> LROPoller[_models.NamedValueContract]: @@ -887,23 +849,12 @@ def begin_create_or_update( :type service_name: str :param named_value_id: Identifier of the NamedValue. Required. :type named_value_id: str - :param parameters: Create parameters. Is either a NamedValueCreateContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.NamedValueCreateContract or IO + :param parameters: Create parameters. Is either a NamedValueCreateContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.NamedValueCreateContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either NamedValueContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] @@ -941,7 +892,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("NamedValueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -953,17 +904,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.NamedValueContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" - } + return LROPoller[_models.NamedValueContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, @@ -971,7 +920,7 @@ def _update_initial( service_name: str, named_value_id: str, if_match: str, - parameters: Union[_models.NamedValueUpdateParameters, IO], + parameters: Union[_models.NamedValueUpdateParameters, IO[bytes]], **kwargs: Any ) -> Optional[_models.NamedValueContract]: error_map = { @@ -992,12 +941,12 @@ def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "NamedValueUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, @@ -1007,16 +956,15 @@ def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1034,13 +982,9 @@ def _update_initial( deserialized = self._deserialize("NamedValueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" - } + return deserialized # type: ignore @overload def begin_update( @@ -1071,14 +1015,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either NamedValueContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] @@ -1092,7 +1028,7 @@ def begin_update( service_name: str, named_value_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1110,18 +1046,10 @@ def begin_update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either NamedValueContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] @@ -1135,7 +1063,7 @@ def begin_update( service_name: str, named_value_id: str, if_match: str, - parameters: Union[_models.NamedValueUpdateParameters, IO], + parameters: Union[_models.NamedValueUpdateParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.NamedValueContract]: """Updates the specific named value. @@ -1150,20 +1078,9 @@ def begin_update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a NamedValueUpdateParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.NamedValueUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Update parameters. Is either a NamedValueUpdateParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.NamedValueUpdateParameters or IO[bytes] :return: An instance of LROPoller that returns either NamedValueContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] @@ -1201,7 +1118,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("NamedValueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -1213,17 +1130,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.NamedValueContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" - } + return LROPoller[_models.NamedValueContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1241,7 +1156,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1260,23 +1174,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1287,11 +1200,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_value( @@ -1306,7 +1215,6 @@ def list_value( :type service_name: str :param named_value_id: Identifier of the NamedValue. Required. :type named_value_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NamedValueSecretContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.NamedValueSecretContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1325,22 +1233,21 @@ def list_value( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NamedValueSecretContract] = kwargs.pop("cls", None) - request = build_list_value_request( + _request = build_list_value_request( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_value.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1356,13 +1263,9 @@ def list_value( deserialized = self._deserialize("NamedValueSecretContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - list_value.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/listValue" - } + return deserialized # type: ignore def _refresh_secret_initial( self, resource_group_name: str, service_name: str, named_value_id: str, **kwargs: Any @@ -1381,22 +1284,21 @@ def _refresh_secret_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.NamedValueContract]] = kwargs.pop("cls", None) - request = build_refresh_secret_request( + _request = build_refresh_secret_request( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._refresh_secret_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1414,13 +1316,9 @@ def _refresh_secret_initial( deserialized = self._deserialize("NamedValueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _refresh_secret_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/refreshSecret" - } + return deserialized # type: ignore @distributed_trace def begin_refresh_secret( @@ -1435,14 +1333,6 @@ def begin_refresh_secret( :type service_name: str :param named_value_id: Identifier of the NamedValue. Required. :type named_value_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either NamedValueContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] @@ -1476,7 +1366,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("NamedValueContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -1488,14 +1378,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.NamedValueContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_refresh_secret.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/refreshSecret" - } + return LROPoller[_models.NamedValueContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_network_status_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_network_status_operations.py index b74d46c09b0c..8e6fb3339d2b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_network_status_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_network_status_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +63,7 @@ def build_list_by_service_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,7 +104,7 @@ def build_list_by_location_request( "locationName": _SERIALIZER.url("location_name", location_name, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -147,7 +147,6 @@ def list_by_service( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: list of NetworkStatusContractByLocation or the result of cls(response) :rtype: list[~azure.mgmt.apimanagement.models.NetworkStatusContractByLocation] :raises ~azure.core.exceptions.HttpResponseError: @@ -166,21 +165,20 @@ def list_by_service( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[List[_models.NetworkStatusContractByLocation]] = kwargs.pop("cls", None) - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -193,13 +191,9 @@ def list_by_service( deserialized = self._deserialize("[NetworkStatusContractByLocation]", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/networkstatus" - } + return deserialized # type: ignore @distributed_trace def list_by_location( @@ -217,7 +211,6 @@ def list_by_location( :param location_name: Location in which the API Management service is deployed. This is one of the Azure Regions like West US, East US, South Central US. Required. :type location_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkStatusContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.NetworkStatusContract :raises ~azure.core.exceptions.HttpResponseError: @@ -236,22 +229,21 @@ def list_by_location( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NetworkStatusContract] = kwargs.pop("cls", None) - request = build_list_by_location_request( + _request = build_list_by_location_request( resource_group_name=resource_group_name, service_name=service_name, location_name=location_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_location.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -264,10 +256,6 @@ def list_by_location( deserialized = self._deserialize("NetworkStatusContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_location.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/locations/{locationName}/networkstatus" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_operations.py index 3312995c192b..49841dd6dd56 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +71,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if top is not None: @@ -120,7 +120,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -167,7 +167,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,7 +219,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NotificationContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.NotificationContract] @@ -242,19 +241,18 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -266,13 +264,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("NotificationCollection", pipeline_response) @@ -282,11 +280,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -299,10 +297,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications" - } - @distributed_trace def get( self, @@ -323,7 +317,6 @@ def get( "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage", "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required. :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName - :keyword callable cls: A custom type or function that will be passed the direct response :return: NotificationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.NotificationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -342,22 +335,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NotificationContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -370,13 +362,9 @@ def get( deserialized = self._deserialize("NotificationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}" - } + return deserialized # type: ignore @distributed_trace def create_or_update( @@ -402,7 +390,6 @@ def create_or_update( :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NotificationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.NotificationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -421,23 +408,22 @@ def create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NotificationContract] = kwargs.pop("cls", None) - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -450,10 +436,6 @@ def create_or_update( deserialized = self._deserialize("NotificationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_recipient_email_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_recipient_email_operations.py index fd04a5ef7dc7..d4f0596ab91c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_recipient_email_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_recipient_email_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +68,7 @@ def build_list_by_notification_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -115,7 +115,7 @@ def build_check_entity_exists_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -162,7 +162,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,7 +209,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -259,7 +259,6 @@ def list_by_notification( "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage", "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required. :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName - :keyword callable cls: A custom type or function that will be passed the direct response :return: RecipientEmailCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.RecipientEmailCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -278,22 +277,21 @@ def list_by_notification( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecipientEmailCollection] = kwargs.pop("cls", None) - request = build_list_by_notification_request( + _request = build_list_by_notification_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_notification.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -306,13 +304,9 @@ def list_by_notification( deserialized = self._deserialize("RecipientEmailCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_by_notification.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails" - } + return deserialized # type: ignore @distributed_trace def check_entity_exists( @@ -337,7 +331,6 @@ def check_entity_exists( :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName :param email: Email identifier. Required. :type email: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -356,23 +349,22 @@ def check_entity_exists( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_check_entity_exists_request( + _request = build_check_entity_exists_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, email=email, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.check_entity_exists.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -383,13 +375,9 @@ def check_entity_exists( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 - check_entity_exists.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}" - } - @distributed_trace def create_or_update( self, @@ -413,7 +401,6 @@ def create_or_update( :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName :param email: Email identifier. Required. :type email: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RecipientEmailContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.RecipientEmailContract :raises ~azure.core.exceptions.HttpResponseError: @@ -432,23 +419,22 @@ def create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecipientEmailContract] = kwargs.pop("cls", None) - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, email=email, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -469,10 +455,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, @@ -496,7 +478,6 @@ def delete( # pylint: disable=inconsistent-return-statements :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName :param email: Email identifier. Required. :type email: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -515,23 +496,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, email=email, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -542,8 +522,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_recipient_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_recipient_user_operations.py index 2031ae1e390c..788581fdc9e5 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_recipient_user_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_recipient_user_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +68,7 @@ def build_list_by_notification_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -115,7 +115,7 @@ def build_check_entity_exists_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -162,7 +162,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,7 +209,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -259,7 +259,6 @@ def list_by_notification( "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage", "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required. :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName - :keyword callable cls: A custom type or function that will be passed the direct response :return: RecipientUserCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.RecipientUserCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -278,22 +277,21 @@ def list_by_notification( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecipientUserCollection] = kwargs.pop("cls", None) - request = build_list_by_notification_request( + _request = build_list_by_notification_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_notification.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -306,13 +304,9 @@ def list_by_notification( deserialized = self._deserialize("RecipientUserCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_by_notification.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers" - } + return deserialized # type: ignore @distributed_trace def check_entity_exists( @@ -338,7 +332,6 @@ def check_entity_exists( :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -357,23 +350,22 @@ def check_entity_exists( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_check_entity_exists_request( + _request = build_check_entity_exists_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.check_entity_exists.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -384,13 +376,9 @@ def check_entity_exists( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 - check_entity_exists.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}" - } - @distributed_trace def create_or_update( self, @@ -415,7 +403,6 @@ def create_or_update( :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RecipientUserContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.RecipientUserContract :raises ~azure.core.exceptions.HttpResponseError: @@ -434,23 +421,22 @@ def create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecipientUserContract] = kwargs.pop("cls", None) - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -471,10 +457,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, @@ -499,7 +481,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -518,23 +499,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, notification_name=notification_name, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -545,8 +525,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_open_id_connect_provider_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_open_id_connect_provider_operations.py index 8622bd9d0fdd..28044167dabb 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_open_id_connect_provider_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_open_id_connect_provider_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +73,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -119,7 +120,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +161,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -208,7 +209,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -254,7 +255,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -298,7 +299,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -340,7 +341,7 @@ def build_list_secrets_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -397,7 +398,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OpenidConnectProviderContract or the result of cls(response) :rtype: @@ -421,7 +421,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -429,12 +429,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -446,13 +445,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("OpenIdConnectProviderCollection", pipeline_response) @@ -462,11 +461,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -479,10 +478,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders" - } - @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, opid: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the openIdConnectProvider specified by its identifier. @@ -494,7 +489,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, opid: str, :type service_name: str :param opid: Identifier of the OpenID Connect Provider. Required. :type opid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -513,22 +507,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, opid: str, api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, opid=opid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -542,13 +535,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, opid: str, response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, opid: str, **kwargs: Any @@ -562,7 +551,6 @@ def get( :type service_name: str :param opid: Identifier of the OpenID Connect Provider. Required. :type opid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OpenidConnectProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -581,22 +569,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OpenidConnectProviderContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, opid=opid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -612,13 +599,9 @@ def get( deserialized = self._deserialize("OpenidConnectProviderContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -649,7 +632,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OpenidConnectProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -661,7 +643,7 @@ def create_or_update( resource_group_name: str, service_name: str, opid: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -677,14 +659,13 @@ def create_or_update( :param opid: Identifier of the OpenID Connect Provider. Required. :type opid: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OpenidConnectProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -696,7 +677,7 @@ def create_or_update( resource_group_name: str, service_name: str, opid: str, - parameters: Union[_models.OpenidConnectProviderContract, IO], + parameters: Union[_models.OpenidConnectProviderContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.OpenidConnectProviderContract: @@ -709,16 +690,12 @@ def create_or_update( :type service_name: str :param opid: Identifier of the OpenID Connect Provider. Required. :type opid: str - :param parameters: Create parameters. Is either a OpenidConnectProviderContract type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract or IO + :param parameters: Create parameters. Is either a OpenidConnectProviderContract type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OpenidConnectProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -741,12 +718,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "OpenidConnectProviderContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, opid=opid, @@ -756,16 +733,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -791,10 +767,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" - } - @overload def update( self, @@ -824,7 +796,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OpenidConnectProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -837,7 +808,7 @@ def update( service_name: str, opid: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -855,11 +826,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: OpenidConnectProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -872,7 +842,7 @@ def update( service_name: str, opid: str, if_match: str, - parameters: Union[_models.OpenidConnectProviderUpdateContract, IO], + parameters: Union[_models.OpenidConnectProviderUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.OpenidConnectProviderContract: """Updates the specific OpenID Connect Provider. @@ -888,12 +858,9 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Is either a OpenidConnectProviderUpdateContract type or a - IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.OpenidConnectProviderUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.OpenidConnectProviderUpdateContract or + IO[bytes] :return: OpenidConnectProviderContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract :raises ~azure.core.exceptions.HttpResponseError: @@ -916,12 +883,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "OpenidConnectProviderUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, opid=opid, @@ -931,16 +898,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -956,13 +922,9 @@ def update( deserialized = self._deserialize("OpenidConnectProviderContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -980,7 +942,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -999,23 +960,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, opid=opid, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1026,11 +986,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_secrets( @@ -1045,7 +1001,6 @@ def list_secrets( :type service_name: str :param opid: Identifier of the OpenID Connect Provider. Required. :type opid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ClientSecretContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ClientSecretContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1064,22 +1019,21 @@ def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClientSecretContract] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, service_name=service_name, opid=opid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1095,10 +1049,6 @@ def list_secrets( deserialized = self._deserialize("ClientSecretContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_operation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_operation_operations.py index 1006c6d07690..ef0d82d8af44 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_operation_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_operation_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +75,7 @@ def build_list_by_tags_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -153,7 +153,6 @@ def list_by_tags( :type skip: int :param include_not_tagged_operations: Include not tagged Operations. Default value is None. :type include_not_tagged_operations: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TagResourceContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagResourceContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -175,7 +174,7 @@ def list_by_tags( def prepare_request(next_link=None): if not next_link: - request = build_list_by_tags_request( + _request = build_list_by_tags_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -185,12 +184,11 @@ def prepare_request(next_link=None): skip=skip, include_not_tagged_operations=include_not_tagged_operations, api_version=api_version, - template_url=self.list_by_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -202,13 +200,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("TagResourceCollection", pipeline_response) @@ -218,11 +216,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,7 +232,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operationsByTags" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_outbound_network_dependencies_endpoints_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_outbound_network_dependencies_endpoints_operations.py index 36d6bdb7e1f1..0bd550934915 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_outbound_network_dependencies_endpoints_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_outbound_network_dependencies_endpoints_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +63,7 @@ def build_list_by_service_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -74,7 +74,7 @@ def build_list_by_service_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class OutboundNetworkDependenciesEndpointsOperations: +class OutboundNetworkDependenciesEndpointsOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -104,7 +104,6 @@ def list_by_service( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OutboundEnvironmentEndpointList or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.OutboundEnvironmentEndpointList :raises ~azure.core.exceptions.HttpResponseError: @@ -123,21 +122,20 @@ def list_by_service( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OutboundEnvironmentEndpointList] = kwargs.pop("cls", None) - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -150,10 +148,6 @@ def list_by_service( deserialized = self._deserialize("OutboundEnvironmentEndpointList", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/outboundNetworkDependenciesEndpoints" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_description_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_description_operations.py index 4e445d47bd8c..7fb691c99793 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_description_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_description_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +68,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if scope is not None: @@ -118,7 +118,6 @@ def list_by_service( :param scope: Policy scope. Known values are: "Tenant", "Product", "Api", "Operation", and "All". Default value is None. :type scope: str or ~azure.mgmt.apimanagement.models.PolicyScopeContract - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyDescriptionCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyDescriptionCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -137,22 +136,21 @@ def list_by_service( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyDescriptionCollection] = kwargs.pop("cls", None) - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, scope=scope, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -165,10 +163,6 @@ def list_by_service( deserialized = self._deserialize("PolicyDescriptionCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyDescriptions" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_fragment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_fragment_operations.py index 67d9da142320..c6a8522dfbb5 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_fragment_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_fragment_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +74,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -122,7 +123,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -169,7 +170,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,7 +220,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -264,7 +265,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -313,7 +314,7 @@ def build_list_references_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -378,7 +379,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyFragmentCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyFragmentCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -397,7 +397,7 @@ def list_by_service( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyFragmentCollection] = kwargs.pop("cls", None) - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -406,16 +406,15 @@ def list_by_service( top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -428,13 +427,9 @@ def list_by_service( deserialized = self._deserialize("PolicyFragmentCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments" - } + return deserialized # type: ignore @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, id: str, **kwargs: Any) -> bool: @@ -447,7 +442,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, id: str, * :type service_name: str :param id: A resource identifier. Required. :type id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -466,22 +460,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, id: str, * api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, id=id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -495,13 +488,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, id: str, * response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" - } - @distributed_trace def get( self, @@ -523,7 +512,6 @@ def get( :param format: Policy fragment content format. Known values are: "xml" and "rawxml". Default value is None. :type format: str or ~azure.mgmt.apimanagement.models.PolicyFragmentContentFormat - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyFragmentContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyFragmentContract :raises ~azure.core.exceptions.HttpResponseError: @@ -542,23 +530,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyFragmentContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, id=id, subscription_id=self._config.subscription_id, format=format, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -574,20 +561,16 @@ def get( deserialized = self._deserialize("PolicyFragmentContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, service_name: str, id: str, - parameters: Union[_models.PolicyFragmentContract, IO], + parameters: Union[_models.PolicyFragmentContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> Optional[_models.PolicyFragmentContract]: @@ -609,12 +592,12 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PolicyFragmentContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, id=id, @@ -624,16 +607,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -659,13 +641,9 @@ def _create_or_update_initial( response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -696,14 +674,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PolicyFragmentContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.PolicyFragmentContract] @@ -716,7 +686,7 @@ def begin_create_or_update( resource_group_name: str, service_name: str, id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -732,21 +702,13 @@ def begin_create_or_update( :param id: A resource identifier. Required. :type id: str :param parameters: The policy fragment contents to apply. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PolicyFragmentContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.PolicyFragmentContract] @@ -759,7 +721,7 @@ def begin_create_or_update( resource_group_name: str, service_name: str, id: str, - parameters: Union[_models.PolicyFragmentContract, IO], + parameters: Union[_models.PolicyFragmentContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> LROPoller[_models.PolicyFragmentContract]: @@ -773,22 +735,11 @@ def begin_create_or_update( :param id: A resource identifier. Required. :type id: str :param parameters: The policy fragment contents to apply. Is either a PolicyFragmentContract - type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.PolicyFragmentContract or IO + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PolicyFragmentContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PolicyFragmentContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.PolicyFragmentContract] @@ -826,7 +777,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("PolicyFragmentContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -838,17 +789,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PolicyFragmentContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" - } + return LROPoller[_models.PolicyFragmentContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -866,7 +815,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -885,23 +833,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, id=id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -912,11 +859,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_references( @@ -941,7 +884,6 @@ def list_references( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: ResourceCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ResourceCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -960,7 +902,7 @@ def list_references( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceCollection] = kwargs.pop("cls", None) - request = build_list_references_request( + _request = build_list_references_request( resource_group_name=resource_group_name, service_name=service_name, id=id, @@ -968,16 +910,15 @@ def list_references( top=top, skip=skip, api_version=api_version, - template_url=self.list_references.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -990,10 +931,6 @@ def list_references( deserialized = self._deserialize("ResourceCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_references.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}/listReferences" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_operations.py index f2e58d85fb5a..13fe9cf1df30 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +64,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,7 +109,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +156,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if format is not None: @@ -205,7 +206,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -256,7 +257,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -296,7 +297,6 @@ def list_by_service(self, resource_group_name: str, service_name: str, **kwargs: :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -315,21 +315,20 @@ def list_by_service(self, resource_group_name: str, service_name: str, **kwargs: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None) - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -342,13 +341,9 @@ def list_by_service(self, resource_group_name: str, service_name: str, **kwargs: deserialized = self._deserialize("PolicyCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies" - } + return deserialized # type: ignore @distributed_trace def get_entity_tag( @@ -364,7 +359,6 @@ def get_entity_tag( :type service_name: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -383,22 +377,21 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, policy_id=policy_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -412,13 +405,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}" - } - @distributed_trace def get( self, @@ -440,7 +429,6 @@ def get( :param format: Policy Export Format. Known values are: "xml" and "rawxml". Default value is "xml". :type format: str or ~azure.mgmt.apimanagement.models.PolicyExportFormat - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -459,23 +447,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, policy_id=policy_id, subscription_id=self._config.subscription_id, format=format, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -491,13 +478,9 @@ def get( deserialized = self._deserialize("PolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -528,7 +511,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -540,7 +522,7 @@ def create_or_update( resource_group_name: str, service_name: str, policy_id: Union[str, _models.PolicyIdName], - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -556,14 +538,13 @@ def create_or_update( :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName :param parameters: The policy contents to apply. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -575,7 +556,7 @@ def create_or_update( resource_group_name: str, service_name: str, policy_id: Union[str, _models.PolicyIdName], - parameters: Union[_models.PolicyContract, IO], + parameters: Union[_models.PolicyContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.PolicyContract: @@ -588,16 +569,12 @@ def create_or_update( :type service_name: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO + :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -620,12 +597,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PolicyContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, policy_id=policy_id, @@ -635,16 +612,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -670,10 +646,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, @@ -695,7 +667,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -714,23 +685,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, policy_id=policy_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -741,8 +711,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_config_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_config_operations.py index 492a8e39bda3..f0f8123bec04 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_config_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_config_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +64,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,7 +105,7 @@ def build_get_entity_tag_request( "portalConfigId": _SERIALIZER.url("portal_config_id", portal_config_id, "str", max_length=80, min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,7 +146,7 @@ def build_get_request( "portalConfigId": _SERIALIZER.url("portal_config_id", portal_config_id, "str", max_length=80, min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -193,7 +194,7 @@ def build_update_request( "portalConfigId": _SERIALIZER.url("portal_config_id", portal_config_id, "str", max_length=80, min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -244,7 +245,7 @@ def build_create_or_update_request( "portalConfigId": _SERIALIZER.url("portal_config_id", portal_config_id, "str", max_length=80, min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -288,7 +289,6 @@ def list_by_service( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalConfigCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalConfigCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -307,21 +307,20 @@ def list_by_service( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PortalConfigCollection] = kwargs.pop("cls", None) - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -334,13 +333,9 @@ def list_by_service( deserialized = self._deserialize("PortalConfigCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs" - } + return deserialized # type: ignore @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, portal_config_id: str, **kwargs: Any) -> bool: @@ -353,7 +348,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, portal_con :type service_name: str :param portal_config_id: Portal configuration identifier. Required. :type portal_config_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -372,22 +366,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, portal_con api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, portal_config_id=portal_config_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -401,13 +394,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, portal_con response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, portal_config_id: str, **kwargs: Any @@ -421,7 +410,6 @@ def get( :type service_name: str :param portal_config_id: Portal configuration identifier. Required. :type portal_config_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalConfigContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract :raises ~azure.core.exceptions.HttpResponseError: @@ -440,22 +428,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PortalConfigContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, portal_config_id=portal_config_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -471,13 +458,9 @@ def get( deserialized = self._deserialize("PortalConfigContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}" - } + return deserialized # type: ignore @overload def update( @@ -508,7 +491,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalConfigContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract :raises ~azure.core.exceptions.HttpResponseError: @@ -521,7 +503,7 @@ def update( service_name: str, portal_config_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -539,11 +521,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update the developer portal configuration. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalConfigContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract :raises ~azure.core.exceptions.HttpResponseError: @@ -556,7 +537,7 @@ def update( service_name: str, portal_config_id: str, if_match: str, - parameters: Union[_models.PortalConfigContract, IO], + parameters: Union[_models.PortalConfigContract, IO[bytes]], **kwargs: Any ) -> _models.PortalConfigContract: """Update the developer portal configuration. @@ -572,12 +553,8 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update the developer portal configuration. Is either a PortalConfigContract - type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalConfigContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalConfigContract or IO[bytes] :return: PortalConfigContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract :raises ~azure.core.exceptions.HttpResponseError: @@ -600,12 +577,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalConfigContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, portal_config_id=portal_config_id, @@ -615,16 +592,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -637,13 +613,9 @@ def update( deserialized = self._deserialize("PortalConfigContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -674,7 +646,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalConfigContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract :raises ~azure.core.exceptions.HttpResponseError: @@ -687,7 +658,7 @@ def create_or_update( service_name: str, portal_config_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -705,11 +676,10 @@ def create_or_update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update the developer portal configuration. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalConfigContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract :raises ~azure.core.exceptions.HttpResponseError: @@ -722,7 +692,7 @@ def create_or_update( service_name: str, portal_config_id: str, if_match: str, - parameters: Union[_models.PortalConfigContract, IO], + parameters: Union[_models.PortalConfigContract, IO[bytes]], **kwargs: Any ) -> _models.PortalConfigContract: """Create or update the developer portal configuration. @@ -738,12 +708,8 @@ def create_or_update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update the developer portal configuration. Is either a PortalConfigContract - type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalConfigContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalConfigContract or IO[bytes] :return: PortalConfigContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract :raises ~azure.core.exceptions.HttpResponseError: @@ -766,12 +732,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalConfigContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, portal_config_id=portal_config_id, @@ -781,16 +747,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -803,10 +768,6 @@ def create_or_update( deserialized = self._deserialize("PortalConfigContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_revision_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_revision_operations.py index 3c6f0509e881..321c745a9057 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_revision_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_revision_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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 @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +75,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -123,7 +124,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -166,7 +167,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -210,7 +211,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -262,7 +263,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -329,7 +330,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PortalRevisionContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.PortalRevisionContract] @@ -352,7 +352,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -360,12 +360,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -377,13 +376,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PortalRevisionCollection", pipeline_response) @@ -393,11 +392,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -410,10 +409,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions" - } - @distributed_trace def get_entity_tag( self, resource_group_name: str, service_name: str, portal_revision_id: str, **kwargs: Any @@ -428,7 +423,6 @@ def get_entity_tag( :param portal_revision_id: Portal revision identifier. Must be unique in the current API Management service instance. Required. :type portal_revision_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -447,22 +441,21 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, portal_revision_id=portal_revision_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -476,13 +469,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, portal_revision_id: str, **kwargs: Any @@ -497,7 +486,6 @@ def get( :param portal_revision_id: Portal revision identifier. Must be unique in the current API Management service instance. Required. :type portal_revision_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalRevisionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalRevisionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -516,22 +504,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PortalRevisionContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, portal_revision_id=portal_revision_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -547,20 +534,16 @@ def get( deserialized = self._deserialize("PortalRevisionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, service_name: str, portal_revision_id: str, - parameters: Union[_models.PortalRevisionContract, IO], + parameters: Union[_models.PortalRevisionContract, IO[bytes]], **kwargs: Any ) -> Optional[_models.PortalRevisionContract]: error_map = { @@ -581,12 +564,12 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalRevisionContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, portal_revision_id=portal_revision_id, @@ -595,16 +578,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -622,13 +604,9 @@ def _create_or_update_initial( deserialized = self._deserialize("PortalRevisionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -657,14 +635,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PortalRevisionContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.PortalRevisionContract] @@ -677,7 +647,7 @@ def begin_create_or_update( resource_group_name: str, service_name: str, portal_revision_id: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -694,18 +664,10 @@ def begin_create_or_update( Management service instance. Required. :type portal_revision_id: str :param parameters: Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PortalRevisionContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.PortalRevisionContract] @@ -718,7 +680,7 @@ def begin_create_or_update( resource_group_name: str, service_name: str, portal_revision_id: str, - parameters: Union[_models.PortalRevisionContract, IO], + parameters: Union[_models.PortalRevisionContract, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PortalRevisionContract]: """Creates a new developer portal's revision by running the portal's publishing. The ``isCurrent`` @@ -732,19 +694,8 @@ def begin_create_or_update( :param portal_revision_id: Portal revision identifier. Must be unique in the current API Management service instance. Required. :type portal_revision_id: str - :param parameters: Is either a PortalRevisionContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalRevisionContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Is either a PortalRevisionContract type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalRevisionContract or IO[bytes] :return: An instance of LROPoller that returns either PortalRevisionContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.PortalRevisionContract] @@ -781,7 +732,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("PortalRevisionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -793,17 +744,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PortalRevisionContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" - } + return LROPoller[_models.PortalRevisionContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, @@ -811,7 +760,7 @@ def _update_initial( service_name: str, portal_revision_id: str, if_match: str, - parameters: Union[_models.PortalRevisionContract, IO], + parameters: Union[_models.PortalRevisionContract, IO[bytes]], **kwargs: Any ) -> Optional[_models.PortalRevisionContract]: error_map = { @@ -832,12 +781,12 @@ def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalRevisionContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, portal_revision_id=portal_revision_id, @@ -847,16 +796,15 @@ def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -874,13 +822,9 @@ def _update_initial( deserialized = self._deserialize("PortalRevisionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" - } + return deserialized # type: ignore @overload def begin_update( @@ -912,14 +856,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PortalRevisionContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.PortalRevisionContract] @@ -933,7 +869,7 @@ def begin_update( service_name: str, portal_revision_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -952,18 +888,10 @@ def begin_update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PortalRevisionContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.PortalRevisionContract] @@ -977,7 +905,7 @@ def begin_update( service_name: str, portal_revision_id: str, if_match: str, - parameters: Union[_models.PortalRevisionContract, IO], + parameters: Union[_models.PortalRevisionContract, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PortalRevisionContract]: """Updates the description of specified portal revision or makes it current. @@ -993,19 +921,8 @@ def begin_update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Is either a PortalRevisionContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalRevisionContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Is either a PortalRevisionContract type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalRevisionContract or IO[bytes] :return: An instance of LROPoller that returns either PortalRevisionContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.PortalRevisionContract] @@ -1043,7 +960,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("PortalRevisionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -1055,14 +972,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PortalRevisionContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" - } + return LROPoller[_models.PortalRevisionContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_settings_operations.py index 6e7307b7c641..7dfe53efa777 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_settings_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +63,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,7 +104,6 @@ def list_by_service( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSettingsCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSettingsCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -123,21 +122,20 @@ def list_by_service( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PortalSettingsCollection] = kwargs.pop("cls", None) - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -150,10 +148,6 @@ def list_by_service( deserialized = self._deserialize("PortalSettingsCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_private_endpoint_connection_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_private_endpoint_connection_operations.py index c5e40739b4ef..7fe3dfb4b125 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_private_endpoint_connection_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_private_endpoint_connection_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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 @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -67,7 +68,7 @@ def build_list_by_service_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +115,7 @@ def build_get_by_name_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -162,7 +163,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -211,7 +212,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -251,7 +252,7 @@ def build_list_private_link_resources_request( # pylint: disable=name-too-long ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -298,7 +299,7 @@ def build_get_private_link_resource_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -339,7 +340,6 @@ def list_by_service( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -363,17 +363,16 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -385,13 +384,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) @@ -401,11 +400,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,10 +417,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections" - } - @distributed_trace def get_by_name( self, resource_group_name: str, service_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -435,7 +430,6 @@ def get_by_name( :type service_name: str :param private_endpoint_connection_name: Name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: @@ -454,22 +448,21 @@ def get_by_name( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_by_name_request( + _request = build_get_by_name_request( resource_group_name=resource_group_name, service_name=service_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_name.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -482,20 +475,16 @@ def get_by_name( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_by_name.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, service_name: str, private_endpoint_connection_name: str, - private_endpoint_connection_request: Union[_models.PrivateEndpointConnectionRequest, IO], + private_endpoint_connection_request: Union[_models.PrivateEndpointConnectionRequest, IO[bytes]], **kwargs: Any ) -> Optional[_models.PrivateEndpointConnection]: error_map = { @@ -516,12 +505,12 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(private_endpoint_connection_request, (IO, bytes)): + if isinstance(private_endpoint_connection_request, (IOBase, bytes)): _content = private_endpoint_connection_request else: _json = self._serialize.body(private_endpoint_connection_request, "PrivateEndpointConnectionRequest") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -530,16 +519,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -554,13 +542,9 @@ def _create_or_update_initial( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -588,14 +572,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -609,7 +585,7 @@ def begin_create_or_update( resource_group_name: str, service_name: str, private_endpoint_connection_name: str, - private_endpoint_connection_request: IO, + private_endpoint_connection_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -624,18 +600,10 @@ def begin_create_or_update( :param private_endpoint_connection_name: Name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection_request: Required. - :type private_endpoint_connection_request: IO + :type private_endpoint_connection_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -649,7 +617,7 @@ def begin_create_or_update( resource_group_name: str, service_name: str, private_endpoint_connection_name: str, - private_endpoint_connection_request: Union[_models.PrivateEndpointConnectionRequest, IO], + private_endpoint_connection_request: Union[_models.PrivateEndpointConnectionRequest, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PrivateEndpointConnection]: """Creates a new Private Endpoint Connection or updates an existing one. @@ -662,20 +630,9 @@ def begin_create_or_update( :param private_endpoint_connection_name: Name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection_request: Is either a PrivateEndpointConnectionRequest type - or a IO type. Required. + or a IO[bytes] type. Required. :type private_endpoint_connection_request: - ~azure.mgmt.apimanagement.models.PrivateEndpointConnectionRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ~azure.mgmt.apimanagement.models.PrivateEndpointConnectionRequest or IO[bytes] :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -709,7 +666,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -719,17 +676,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return LROPoller[_models.PrivateEndpointConnection]( + 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, service_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -748,22 +703,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -774,11 +728,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -793,14 +743,6 @@ def begin_delete( :type service_name: str :param private_endpoint_connection_name: Name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -828,7 +770,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -837,17 +779,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list_private_link_resources( @@ -860,7 +798,6 @@ def list_private_link_resources( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResourceListResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: @@ -879,21 +816,20 @@ def list_private_link_resources( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - request = build_list_private_link_resources_request( + _request = build_list_private_link_resources_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_private_link_resources.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -906,13 +842,9 @@ def list_private_link_resources( deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_private_link_resources.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources" - } + return deserialized # type: ignore @distributed_trace def get_private_link_resource( @@ -927,7 +859,6 @@ def get_private_link_resource( :type service_name: str :param private_link_sub_resource_name: Name of the private link resource. Required. :type private_link_sub_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PrivateLinkResource :raises ~azure.core.exceptions.HttpResponseError: @@ -946,22 +877,21 @@ def get_private_link_resource( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - request = build_get_private_link_resource_request( + _request = build_get_private_link_resource_request( resource_group_name=resource_group_name, service_name=service_name, private_link_sub_resource_name=private_link_sub_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_private_link_resource.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -974,10 +904,6 @@ def get_private_link_resource( deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_private_link_resource.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources/{privateLinkSubResourceName}" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_api_operations.py index 37220caf49ef..98cab51788f2 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_api_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_api_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +74,7 @@ def build_list_by_product_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -122,7 +122,7 @@ def build_check_entity_exists_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,7 +164,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -206,7 +206,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -270,7 +270,6 @@ def list_by_product( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -292,7 +291,7 @@ def list_by_product( def prepare_request(next_link=None): if not next_link: - request = build_list_by_product_request( + _request = build_list_by_product_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -301,12 +300,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -318,13 +316,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ApiCollection", pipeline_response) @@ -334,11 +332,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -351,10 +349,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis" - } - @distributed_trace def check_entity_exists( self, resource_group_name: str, service_name: str, product_id: str, api_id: str, **kwargs: Any @@ -372,7 +366,6 @@ def check_entity_exists( :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -391,23 +384,22 @@ def check_entity_exists( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_check_entity_exists_request( + _request = build_check_entity_exists_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.check_entity_exists.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,13 +410,9 @@ def check_entity_exists( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 - check_entity_exists.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}" - } - @distributed_trace def create_or_update( self, resource_group_name: str, service_name: str, product_id: str, api_id: str, **kwargs: Any @@ -442,7 +430,6 @@ def create_or_update( :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -461,23 +448,22 @@ def create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApiContract] = kwargs.pop("cls", None) - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -498,10 +484,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, product_id: str, api_id: str, **kwargs: Any @@ -519,7 +501,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required. :type api_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -538,23 +519,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, api_id=api_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -565,8 +545,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_group_operations.py index bcb3b225a4a7..28c8cbc846eb 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_group_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_group_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +74,7 @@ def build_list_by_product_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -122,7 +122,7 @@ def build_check_entity_exists_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,7 +164,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -206,7 +206,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -266,7 +266,6 @@ def list_by_product( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GroupContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.GroupContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -288,7 +287,7 @@ def list_by_product( def prepare_request(next_link=None): if not next_link: - request = build_list_by_product_request( + _request = build_list_by_product_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -297,12 +296,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -314,13 +312,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("GroupCollection", pipeline_response) @@ -330,11 +328,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -347,10 +345,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups" - } - @distributed_trace def check_entity_exists( self, resource_group_name: str, service_name: str, product_id: str, group_id: str, **kwargs: Any @@ -368,7 +362,6 @@ def check_entity_exists( :param group_id: Group identifier. Must be unique in the current API Management service instance. Required. :type group_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -387,23 +380,22 @@ def check_entity_exists( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_check_entity_exists_request( + _request = build_check_entity_exists_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, group_id=group_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.check_entity_exists.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -414,13 +406,9 @@ def check_entity_exists( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 - check_entity_exists.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}" - } - @distributed_trace def create_or_update( self, resource_group_name: str, service_name: str, product_id: str, group_id: str, **kwargs: Any @@ -438,7 +426,6 @@ def create_or_update( :param group_id: Group identifier. Must be unique in the current API Management service instance. Required. :type group_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GroupContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GroupContract :raises ~azure.core.exceptions.HttpResponseError: @@ -457,23 +444,22 @@ def create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GroupContract] = kwargs.pop("cls", None) - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, group_id=group_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -494,10 +480,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, product_id: str, group_id: str, **kwargs: Any @@ -515,7 +497,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param group_id: Group identifier. Must be unique in the current API Management service instance. Required. :type group_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -534,23 +515,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, group_id=group_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -561,8 +541,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_operations.py index 067ccf2ce519..707b8a0fbb52 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +75,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -125,7 +126,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -166,7 +167,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -214,7 +215,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -260,7 +261,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -311,7 +312,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if delete_subscriptions is not None: @@ -362,7 +363,7 @@ def build_list_by_tags_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -439,7 +440,6 @@ def list_by_service( :type expand_groups: bool :param tags: Products which are part of a specific tag. Default value is None. :type tags: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProductContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ProductContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -461,7 +461,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -471,12 +471,11 @@ def prepare_request(next_link=None): expand_groups=expand_groups, tags=tags, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -488,13 +487,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ProductCollection", pipeline_response) @@ -504,11 +503,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -521,10 +520,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products" - } - @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, product_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the product specified by its identifier. @@ -537,7 +532,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, product_id :param product_id: Product identifier. Must be unique in the current API Management service instance. Required. :type product_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -556,22 +550,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, product_id api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -585,13 +578,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, product_id response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, product_id: str, **kwargs: Any @@ -606,7 +595,6 @@ def get( :param product_id: Product identifier. Must be unique in the current API Management service instance. Required. :type product_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ProductContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ProductContract :raises ~azure.core.exceptions.HttpResponseError: @@ -625,22 +613,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProductContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -656,13 +643,9 @@ def get( deserialized = self._deserialize("ProductContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -694,7 +677,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ProductContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ProductContract :raises ~azure.core.exceptions.HttpResponseError: @@ -706,7 +688,7 @@ def create_or_update( resource_group_name: str, service_name: str, product_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -723,14 +705,13 @@ def create_or_update( instance. Required. :type product_id: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ProductContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ProductContract :raises ~azure.core.exceptions.HttpResponseError: @@ -742,7 +723,7 @@ def create_or_update( resource_group_name: str, service_name: str, product_id: str, - parameters: Union[_models.ProductContract, IO], + parameters: Union[_models.ProductContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.ProductContract: @@ -756,16 +737,12 @@ def create_or_update( :param product_id: Product identifier. Must be unique in the current API Management service instance. Required. :type product_id: str - :param parameters: Create or update parameters. Is either a ProductContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.ProductContract or IO + :param parameters: Create or update parameters. Is either a ProductContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ProductContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ProductContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ProductContract :raises ~azure.core.exceptions.HttpResponseError: @@ -788,12 +765,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ProductContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -803,16 +780,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -838,10 +814,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" - } - @overload def update( self, @@ -872,7 +844,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ProductContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ProductContract :raises ~azure.core.exceptions.HttpResponseError: @@ -885,7 +856,7 @@ def update( service_name: str, product_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -904,11 +875,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: ProductContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ProductContract :raises ~azure.core.exceptions.HttpResponseError: @@ -921,7 +891,7 @@ def update( service_name: str, product_id: str, if_match: str, - parameters: Union[_models.ProductUpdateParameters, IO], + parameters: Union[_models.ProductUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.ProductContract: """Update existing product details. @@ -937,13 +907,9 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a ProductUpdateParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.ProductUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a ProductUpdateParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ProductUpdateParameters or IO[bytes] :return: ProductContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ProductContract :raises ~azure.core.exceptions.HttpResponseError: @@ -966,12 +932,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ProductUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -981,16 +947,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1006,13 +971,9 @@ def update( deserialized = self._deserialize("ProductContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1040,7 +1001,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param delete_subscriptions: Delete existing subscriptions associated with the product or not. Default value is None. :type delete_subscriptions: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1059,7 +1019,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -1067,16 +1027,15 @@ def delete( # pylint: disable=inconsistent-return-statements if_match=if_match, delete_subscriptions=delete_subscriptions, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1087,11 +1046,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_by_tags( @@ -1126,7 +1081,6 @@ def list_by_tags( :type skip: int :param include_not_tagged_products: Include not tagged Products. Default value is None. :type include_not_tagged_products: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TagResourceContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagResourceContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -1148,7 +1102,7 @@ def list_by_tags( def prepare_request(next_link=None): if not next_link: - request = build_list_by_tags_request( + _request = build_list_by_tags_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -1157,12 +1111,11 @@ def prepare_request(next_link=None): skip=skip, include_not_tagged_products=include_not_tagged_products, api_version=api_version, - template_url=self.list_by_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1174,13 +1127,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("TagResourceCollection", pipeline_response) @@ -1190,11 +1143,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1206,7 +1159,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/productsByTags" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_policy_operations.py index c5d0a34d26ae..88a95cbe6947 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_policy_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +65,7 @@ def build_list_by_product_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,7 +112,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +161,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if format is not None: @@ -212,7 +213,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -265,7 +266,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -310,7 +311,6 @@ def list_by_product( :param product_id: Product identifier. Must be unique in the current API Management service instance. Required. :type product_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -329,22 +329,21 @@ def list_by_product( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None) - request = build_list_by_product_request( + _request = build_list_by_product_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -357,13 +356,9 @@ def list_by_product( deserialized = self._deserialize("PolicyCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies" - } + return deserialized # type: ignore @distributed_trace def get_entity_tag( @@ -386,7 +381,6 @@ def get_entity_tag( :type product_id: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -405,23 +399,22 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, policy_id=policy_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -435,13 +428,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}" - } - @distributed_trace def get( self, @@ -467,7 +456,6 @@ def get( :param format: Policy Export Format. Known values are: "xml" and "rawxml". Default value is "xml". :type format: str or ~azure.mgmt.apimanagement.models.PolicyExportFormat - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -486,7 +474,7 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -494,16 +482,15 @@ def get( subscription_id=self._config.subscription_id, format=format, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -519,13 +506,9 @@ def get( deserialized = self._deserialize("PolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -560,7 +543,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -573,7 +555,7 @@ def create_or_update( service_name: str, product_id: str, policy_id: Union[str, _models.PolicyIdName], - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -592,14 +574,13 @@ def create_or_update( :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName :param parameters: The policy contents to apply. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -612,7 +593,7 @@ def create_or_update( service_name: str, product_id: str, policy_id: Union[str, _models.PolicyIdName], - parameters: Union[_models.PolicyContract, IO], + parameters: Union[_models.PolicyContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.PolicyContract: @@ -628,16 +609,12 @@ def create_or_update( :type product_id: str :param policy_id: The identifier of the Policy. "policy" Required. :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName - :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO + :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PolicyContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PolicyContract :raises ~azure.core.exceptions.HttpResponseError: @@ -660,12 +637,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PolicyContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -676,16 +653,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -711,10 +687,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, @@ -740,7 +712,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -759,7 +730,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -767,16 +738,15 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -787,8 +757,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_subscriptions_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_subscriptions_operations.py index 909bec7559df..9f8299e83d9b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_subscriptions_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_subscriptions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +74,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -147,7 +147,6 @@ def list( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SubscriptionContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.SubscriptionContract] @@ -170,7 +169,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -179,12 +178,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -196,13 +194,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("SubscriptionCollection", pipeline_response) @@ -212,11 +210,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -228,7 +226,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/subscriptions" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wiki_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wiki_operations.py index dc0685124f94..2ea47a95f4a8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wiki_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wiki_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +65,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,7 +106,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -153,7 +154,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,7 +200,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -243,7 +244,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -286,7 +287,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, product_id :param product_id: Product identifier. Must be unique in the current API Management service instance. Required. :type product_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -305,22 +305,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, product_id api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -334,13 +333,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, product_id response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" - } - @distributed_trace def get(self, resource_group_name: str, service_name: str, product_id: str, **kwargs: Any) -> _models.WikiContract: """Gets the details of the Wiki for a Product specified by its identifier. @@ -353,7 +348,6 @@ def get(self, resource_group_name: str, service_name: str, product_id: str, **kw :param product_id: Product identifier. Must be unique in the current API Management service instance. Required. :type product_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -372,22 +366,21 @@ def get(self, resource_group_name: str, service_name: str, product_id: str, **kw api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WikiContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -403,13 +396,9 @@ def get(self, resource_group_name: str, service_name: str, product_id: str, **kw deserialized = self._deserialize("WikiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" - } + return deserialized # type: ignore @overload def create_or_update( @@ -441,7 +430,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -453,7 +441,7 @@ def create_or_update( resource_group_name: str, service_name: str, product_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -470,14 +458,13 @@ def create_or_update( instance. Required. :type product_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -489,7 +476,7 @@ def create_or_update( resource_group_name: str, service_name: str, product_id: str, - parameters: Union[_models.WikiContract, IO], + parameters: Union[_models.WikiContract, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.WikiContract: @@ -503,15 +490,12 @@ def create_or_update( :param product_id: Product identifier. Must be unique in the current API Management service instance. Required. :type product_id: str - :param parameters: Create parameters. Is either a WikiContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.WikiContract or IO + :param parameters: Create parameters. Is either a WikiContract type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.apimanagement.models.WikiContract or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -534,12 +518,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WikiContract") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -549,16 +533,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -584,10 +567,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" - } - @overload def update( self, @@ -618,7 +597,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -631,7 +609,7 @@ def update( service_name: str, product_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -650,11 +628,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Wiki Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -667,7 +644,7 @@ def update( service_name: str, product_id: str, if_match: str, - parameters: Union[_models.WikiUpdateContract, IO], + parameters: Union[_models.WikiUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.WikiContract: """Updates the details of the Wiki for a Product specified by its identifier. @@ -683,13 +660,9 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Wiki Update parameters. Is either a WikiUpdateContract type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.WikiUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Wiki Update parameters. Is either a WikiUpdateContract type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.WikiUpdateContract or IO[bytes] :return: WikiContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.WikiContract :raises ~azure.core.exceptions.HttpResponseError: @@ -712,12 +685,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WikiUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -727,16 +700,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -752,13 +724,9 @@ def update( deserialized = self._deserialize("WikiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -777,7 +745,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -796,23 +763,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -823,8 +789,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wikis_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wikis_operations.py index e45df57ac751..595ebc2753af 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wikis_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wikis_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +74,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -139,7 +139,6 @@ def list( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WikiContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.WikiContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -161,7 +160,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -170,12 +169,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -187,13 +185,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("WikiCollection", pipeline_response) @@ -203,11 +201,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -219,7 +217,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_quota_by_counter_keys_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_quota_by_counter_keys_operations.py index 576445a9ae17..6db23c2bcfcb 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_quota_by_counter_keys_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_quota_by_counter_keys_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +65,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -106,7 +107,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,7 +160,6 @@ def list_by_service( counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key. Required. :type quota_counter_key: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: QuotaCounterCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.QuotaCounterCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -178,22 +178,21 @@ def list_by_service( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.QuotaCounterCollection] = kwargs.pop("cls", None) - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, quota_counter_key=quota_counter_key, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -206,13 +205,9 @@ def list_by_service( deserialized = self._deserialize("QuotaCounterCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}" - } + return deserialized # type: ignore @overload def update( @@ -244,7 +239,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: QuotaCounterCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.QuotaCounterCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -256,7 +250,7 @@ def update( resource_group_name: str, service_name: str, quota_counter_key: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -276,11 +270,10 @@ def update( :type quota_counter_key: str :param parameters: The value of the quota counter to be applied to all quota counter periods. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: QuotaCounterCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.QuotaCounterCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -292,7 +285,7 @@ def update( resource_group_name: str, service_name: str, quota_counter_key: str, - parameters: Union[_models.QuotaCounterValueUpdateContract, IO], + parameters: Union[_models.QuotaCounterValueUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.QuotaCounterCollection: """Updates all the quota counter values specified with the existing quota counter key to a value @@ -309,12 +302,8 @@ def update( as counter-key="@("b"+"a")" then it will be accessible by "ba" key. Required. :type quota_counter_key: str :param parameters: The value of the quota counter to be applied to all quota counter periods. - Is either a QuotaCounterValueUpdateContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.QuotaCounterValueUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + Is either a QuotaCounterValueUpdateContract type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.QuotaCounterValueUpdateContract or IO[bytes] :return: QuotaCounterCollection or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.QuotaCounterCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -337,12 +326,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "QuotaCounterValueUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, quota_counter_key=quota_counter_key, @@ -351,16 +340,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -373,10 +361,6 @@ def update( deserialized = self._deserialize("QuotaCounterCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_quota_by_period_keys_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_quota_by_period_keys_operations.py index 9bb1c968aa33..dbbb07428dda 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_quota_by_period_keys_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_quota_by_period_keys_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +71,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,7 +119,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,7 +174,6 @@ def get( :type quota_counter_key: str :param quota_period_key: Quota period key identifier. Required. :type quota_period_key: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: QuotaCounterContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.QuotaCounterContract :raises ~azure.core.exceptions.HttpResponseError: @@ -192,23 +192,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.QuotaCounterContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, quota_counter_key=quota_counter_key, quota_period_key=quota_period_key, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -221,13 +220,9 @@ def get( deserialized = self._deserialize("QuotaCounterContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}" - } + return deserialized # type: ignore @overload def update( @@ -261,7 +256,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: QuotaCounterContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.QuotaCounterContract :raises ~azure.core.exceptions.HttpResponseError: @@ -274,7 +268,7 @@ def update( service_name: str, quota_counter_key: str, quota_period_key: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -295,11 +289,10 @@ def update( :type quota_period_key: str :param parameters: The value of the Quota counter to be applied on the specified period. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: QuotaCounterContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.QuotaCounterContract :raises ~azure.core.exceptions.HttpResponseError: @@ -312,7 +305,7 @@ def update( service_name: str, quota_counter_key: str, quota_period_key: str, - parameters: Union[_models.QuotaCounterValueUpdateContract, IO], + parameters: Union[_models.QuotaCounterValueUpdateContract, IO[bytes]], **kwargs: Any ) -> _models.QuotaCounterContract: """Updates an existing quota counter value in the specified service instance. @@ -330,12 +323,8 @@ def update( :param quota_period_key: Quota period key identifier. Required. :type quota_period_key: str :param parameters: The value of the Quota counter to be applied on the specified period. Is - either a QuotaCounterValueUpdateContract type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.QuotaCounterValueUpdateContract or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + either a QuotaCounterValueUpdateContract type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.QuotaCounterValueUpdateContract or IO[bytes] :return: QuotaCounterContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.QuotaCounterContract :raises ~azure.core.exceptions.HttpResponseError: @@ -358,12 +347,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "QuotaCounterValueUpdateContract") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, quota_counter_key=quota_counter_key, @@ -373,16 +362,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -395,10 +383,6 @@ def update( deserialized = self._deserialize("QuotaCounterContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_region_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_region_operations.py index 39904e55326c..66a99f7cc09e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_region_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_region_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +65,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -106,7 +106,6 @@ def list_by_service( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegionContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.RegionContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -128,17 +127,16 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -150,13 +148,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("RegionListResult", pipeline_response) @@ -166,11 +164,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -182,7 +180,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/regions" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_reports_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_reports_operations.py index 8289b4dbf1ed..74b98b9f016e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_reports_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_reports_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -28,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +74,7 @@ def build_list_by_api_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["$filter"] = _SERIALIZER.query("filter", filter, "str") @@ -129,7 +129,7 @@ def build_list_by_user_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["$filter"] = _SERIALIZER.query("filter", filter, "str") @@ -184,7 +184,7 @@ def build_list_by_operation_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["$filter"] = _SERIALIZER.query("filter", filter, "str") @@ -239,7 +239,7 @@ def build_list_by_product_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["$filter"] = _SERIALIZER.query("filter", filter, "str") @@ -293,7 +293,7 @@ def build_list_by_geo_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["$filter"] = _SERIALIZER.query("filter", filter, "str") @@ -346,7 +346,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["$filter"] = _SERIALIZER.query("filter", filter, "str") @@ -402,7 +402,7 @@ def build_list_by_time_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["$filter"] = _SERIALIZER.query("filter", filter, "str") @@ -457,7 +457,7 @@ def build_list_by_request_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["$filter"] = _SERIALIZER.query("filter", filter, "str") @@ -518,7 +518,6 @@ def list_by_api( :type skip: int :param orderby: OData order by query option. Default value is None. :type orderby: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportRecordContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ReportRecordContract] @@ -541,7 +540,7 @@ def list_by_api( def prepare_request(next_link=None): if not next_link: - request = build_list_by_api_request( + _request = build_list_by_api_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -550,12 +549,11 @@ def prepare_request(next_link=None): skip=skip, orderby=orderby, api_version=api_version, - template_url=self.list_by_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -567,13 +565,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) @@ -583,11 +581,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -600,10 +598,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byApi" - } - @distributed_trace def list_by_user( self, @@ -643,7 +637,6 @@ def list_by_user( :type skip: int :param orderby: OData order by query option. Default value is None. :type orderby: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportRecordContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ReportRecordContract] @@ -666,7 +659,7 @@ def list_by_user( def prepare_request(next_link=None): if not next_link: - request = build_list_by_user_request( + _request = build_list_by_user_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -675,12 +668,11 @@ def prepare_request(next_link=None): skip=skip, orderby=orderby, api_version=api_version, - template_url=self.list_by_user.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -692,13 +684,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) @@ -708,11 +700,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -725,10 +717,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_user.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byUser" - } - @distributed_trace def list_by_operation( self, @@ -768,7 +756,6 @@ def list_by_operation( :type skip: int :param orderby: OData order by query option. Default value is None. :type orderby: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportRecordContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ReportRecordContract] @@ -791,7 +778,7 @@ def list_by_operation( def prepare_request(next_link=None): if not next_link: - request = build_list_by_operation_request( + _request = build_list_by_operation_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -800,12 +787,11 @@ def prepare_request(next_link=None): skip=skip, orderby=orderby, api_version=api_version, - template_url=self.list_by_operation.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -817,13 +803,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) @@ -833,11 +819,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -850,10 +836,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_operation.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byOperation" - } - @distributed_trace def list_by_product( self, @@ -892,7 +874,6 @@ def list_by_product( :type skip: int :param orderby: OData order by query option. Default value is None. :type orderby: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportRecordContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ReportRecordContract] @@ -915,7 +896,7 @@ def list_by_product( def prepare_request(next_link=None): if not next_link: - request = build_list_by_product_request( + _request = build_list_by_product_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -924,12 +905,11 @@ def prepare_request(next_link=None): skip=skip, orderby=orderby, api_version=api_version, - template_url=self.list_by_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -941,13 +921,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) @@ -957,11 +937,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -974,10 +954,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byProduct" - } - @distributed_trace def list_by_geo( self, @@ -1013,7 +989,6 @@ def list_by_geo( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportRecordContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ReportRecordContract] @@ -1036,7 +1011,7 @@ def list_by_geo( def prepare_request(next_link=None): if not next_link: - request = build_list_by_geo_request( + _request = build_list_by_geo_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -1044,12 +1019,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_geo.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1061,13 +1035,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) @@ -1077,11 +1051,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1094,10 +1068,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_geo.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byGeo" - } - @distributed_trace def list_by_subscription( self, @@ -1136,7 +1106,6 @@ def list_by_subscription( :type skip: int :param orderby: OData order by query option. Default value is None. :type orderby: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportRecordContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ReportRecordContract] @@ -1159,7 +1128,7 @@ def list_by_subscription( def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -1168,12 +1137,11 @@ def prepare_request(next_link=None): skip=skip, orderby=orderby, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1185,13 +1153,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) @@ -1201,11 +1169,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1218,10 +1186,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/bySubscription" - } - @distributed_trace def list_by_time( self, @@ -1265,7 +1229,6 @@ def list_by_time( :type skip: int :param orderby: OData order by query option. Default value is None. :type orderby: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportRecordContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ReportRecordContract] @@ -1288,7 +1251,7 @@ def list_by_time( def prepare_request(next_link=None): if not next_link: - request = build_list_by_time_request( + _request = build_list_by_time_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -1298,12 +1261,11 @@ def prepare_request(next_link=None): skip=skip, orderby=orderby, api_version=api_version, - template_url=self.list_by_time.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1315,13 +1277,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) @@ -1331,11 +1293,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1348,10 +1310,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_time.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byTime" - } - @distributed_trace def list_by_request( self, @@ -1379,7 +1337,6 @@ def list_by_request( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RequestReportRecordContract or the result of cls(response) :rtype: @@ -1403,7 +1360,7 @@ def list_by_request( def prepare_request(next_link=None): if not next_link: - request = build_list_by_request_request( + _request = build_list_by_request_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -1411,12 +1368,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_request.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1428,13 +1384,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("RequestReportCollection", pipeline_response) @@ -1444,11 +1400,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1460,7 +1416,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_request.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byRequest" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_sign_in_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_sign_in_settings_operations.py index 2e05922652df..1cd6b13fdbef 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_sign_in_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_sign_in_settings_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +64,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,7 +102,7 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +143,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,7 +187,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,7 +230,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -248,21 +248,20 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -276,13 +275,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin" - } - @distributed_trace def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.PortalSigninSettings: """Get Sign In Settings for the Portal. @@ -292,7 +287,6 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSigninSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSigninSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -311,21 +305,20 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PortalSigninSettings] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -341,13 +334,9 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo deserialized = self._deserialize("PortalSigninSettings", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin" - } + return deserialized # type: ignore @overload def update( # pylint: disable=inconsistent-return-statements @@ -375,7 +364,6 @@ def update( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -387,7 +375,7 @@ def update( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -403,11 +391,10 @@ def update( # pylint: disable=inconsistent-return-statements response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update Sign-In settings. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -419,7 +406,7 @@ def update( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, if_match: str, - parameters: Union[_models.PortalSigninSettings, IO], + parameters: Union[_models.PortalSigninSettings, IO[bytes]], **kwargs: Any ) -> None: """Update Sign-In settings. @@ -432,13 +419,9 @@ def update( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update Sign-In settings. Is either a PortalSigninSettings type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalSigninSettings or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update Sign-In settings. Is either a PortalSigninSettings type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalSigninSettings or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -461,12 +444,12 @@ def update( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalSigninSettings") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -475,16 +458,15 @@ def update( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -495,11 +477,7 @@ def update( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def create_or_update( @@ -527,7 +505,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSigninSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSigninSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -538,7 +515,7 @@ def create_or_update( self, resource_group_name: str, service_name: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -552,14 +529,13 @@ def create_or_update( :param service_name: The name of the API Management service. Required. :type service_name: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSigninSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSigninSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -570,7 +546,7 @@ def create_or_update( self, resource_group_name: str, service_name: str, - parameters: Union[_models.PortalSigninSettings, IO], + parameters: Union[_models.PortalSigninSettings, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.PortalSigninSettings: @@ -581,16 +557,12 @@ def create_or_update( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :param parameters: Create or update parameters. Is either a PortalSigninSettings type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalSigninSettings or IO + :param parameters: Create or update parameters. Is either a PortalSigninSettings type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalSigninSettings or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSigninSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSigninSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -613,12 +585,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalSigninSettings") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -627,16 +599,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -649,10 +620,6 @@ def create_or_update( deserialized = self._deserialize("PortalSigninSettings", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_sign_up_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_sign_up_settings_operations.py index ebb72905705f..9fb857691410 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_sign_up_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_sign_up_settings_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +64,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,7 +102,7 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +143,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,7 +187,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,7 +230,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -248,21 +248,20 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -276,13 +275,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup" - } - @distributed_trace def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.PortalSignupSettings: """Get Sign Up Settings for the Portal. @@ -292,7 +287,6 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSignupSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSignupSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -311,21 +305,20 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PortalSignupSettings] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -341,13 +334,9 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo deserialized = self._deserialize("PortalSignupSettings", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup" - } + return deserialized # type: ignore @overload def update( # pylint: disable=inconsistent-return-statements @@ -375,7 +364,6 @@ def update( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -387,7 +375,7 @@ def update( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -403,11 +391,10 @@ def update( # pylint: disable=inconsistent-return-statements response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update Sign-Up settings. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -419,7 +406,7 @@ def update( # pylint: disable=inconsistent-return-statements resource_group_name: str, service_name: str, if_match: str, - parameters: Union[_models.PortalSignupSettings, IO], + parameters: Union[_models.PortalSignupSettings, IO[bytes]], **kwargs: Any ) -> None: """Update Sign-Up settings. @@ -432,13 +419,9 @@ def update( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update Sign-Up settings. Is either a PortalSignupSettings type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalSignupSettings or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update Sign-Up settings. Is either a PortalSignupSettings type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalSignupSettings or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -461,12 +444,12 @@ def update( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalSignupSettings") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -475,16 +458,15 @@ def update( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -495,11 +477,7 @@ def update( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def create_or_update( @@ -527,7 +505,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSignupSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSignupSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -538,7 +515,7 @@ def create_or_update( self, resource_group_name: str, service_name: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -552,14 +529,13 @@ def create_or_update( :param service_name: The name of the API Management service. Required. :type service_name: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSignupSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSignupSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -570,7 +546,7 @@ def create_or_update( self, resource_group_name: str, service_name: str, - parameters: Union[_models.PortalSignupSettings, IO], + parameters: Union[_models.PortalSignupSettings, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.PortalSignupSettings: @@ -581,16 +557,12 @@ def create_or_update( :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str - :param parameters: Create or update parameters. Is either a PortalSignupSettings type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.PortalSignupSettings or IO + :param parameters: Create or update parameters. Is either a PortalSignupSettings type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalSignupSettings or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PortalSignupSettings or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.PortalSignupSettings :raises ~azure.core.exceptions.HttpResponseError: @@ -613,12 +585,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PortalSignupSettings") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -627,16 +599,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -649,10 +620,6 @@ def create_or_update( deserialized = self._deserialize("PortalSignupSettings", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_subscription_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_subscription_operations.py index 79bf51ab5cd7..bbc5dd3f0737 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_subscription_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_subscription_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +73,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -119,7 +120,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +161,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -210,7 +211,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if notify is not None: @@ -268,7 +269,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if notify is not None: @@ -316,7 +317,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -358,7 +359,7 @@ def build_regenerate_primary_key_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -399,7 +400,7 @@ def build_regenerate_secondary_key_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -440,7 +441,7 @@ def build_list_secrets_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -503,7 +504,6 @@ def list( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SubscriptionContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.SubscriptionContract] @@ -526,7 +526,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -534,12 +534,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -551,13 +550,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("SubscriptionCollection", pipeline_response) @@ -567,11 +566,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -584,10 +583,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions" - } - @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, sid: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the apimanagement subscription specified by its @@ -601,7 +596,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, sid: str, :param sid: Subscription entity Identifier. The entity represents the association between a user and a product in API Management. Required. :type sid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -620,22 +614,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, sid: str, api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, sid=sid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -649,13 +642,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, sid: str, response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" - } - @distributed_trace def get(self, resource_group_name: str, service_name: str, sid: str, **kwargs: Any) -> _models.SubscriptionContract: """Gets the specified Subscription entity. @@ -668,7 +657,6 @@ def get(self, resource_group_name: str, service_name: str, sid: str, **kwargs: A :param sid: Subscription entity Identifier. The entity represents the association between a user and a product in API Management. Required. :type sid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -687,22 +675,21 @@ def get(self, resource_group_name: str, service_name: str, sid: str, **kwargs: A api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SubscriptionContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, sid=sid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -718,13 +705,9 @@ def get(self, resource_group_name: str, service_name: str, sid: str, **kwargs: A deserialized = self._deserialize("SubscriptionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -768,7 +751,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -780,7 +762,7 @@ def create_or_update( resource_group_name: str, service_name: str, sid: str, - parameters: IO, + parameters: IO[bytes], notify: Optional[bool] = None, if_match: Optional[str] = None, app_type: Optional[Union[str, _models.AppType]] = None, @@ -799,7 +781,7 @@ def create_or_update( user and a product in API Management. Required. :type sid: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param notify: Notify change in Subscription State. @@ -816,7 +798,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -828,7 +809,7 @@ def create_or_update( resource_group_name: str, service_name: str, sid: str, - parameters: Union[_models.SubscriptionCreateParameters, IO], + parameters: Union[_models.SubscriptionCreateParameters, IO[bytes]], notify: Optional[bool] = None, if_match: Optional[str] = None, app_type: Optional[Union[str, _models.AppType]] = None, @@ -844,9 +825,9 @@ def create_or_update( :param sid: Subscription entity Identifier. The entity represents the association between a user and a product in API Management. Required. :type sid: str - :param parameters: Create parameters. Is either a SubscriptionCreateParameters type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionCreateParameters or IO + :param parameters: Create parameters. Is either a SubscriptionCreateParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionCreateParameters or IO[bytes] :param notify: Notify change in Subscription State. @@ -860,10 +841,6 @@ def create_or_update( is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is None. :type app_type: str or ~azure.mgmt.apimanagement.models.AppType - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -886,12 +863,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SubscriptionCreateParameters") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, sid=sid, @@ -903,16 +880,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -938,10 +914,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" - } - @overload def update( self, @@ -984,7 +956,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -997,7 +968,7 @@ def update( service_name: str, sid: str, if_match: str, - parameters: IO, + parameters: IO[bytes], notify: Optional[bool] = None, app_type: Optional[Union[str, _models.AppType]] = None, *, @@ -1018,7 +989,7 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param notify: Notify change in Subscription State. @@ -1032,7 +1003,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1045,7 +1015,7 @@ def update( service_name: str, sid: str, if_match: str, - parameters: Union[_models.SubscriptionUpdateParameters, IO], + parameters: Union[_models.SubscriptionUpdateParameters, IO[bytes]], notify: Optional[bool] = None, app_type: Optional[Union[str, _models.AppType]] = None, **kwargs: Any @@ -1063,9 +1033,9 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a SubscriptionUpdateParameters type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionUpdateParameters or IO + :param parameters: Update parameters. Is either a SubscriptionUpdateParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionUpdateParameters or IO[bytes] :param notify: Notify change in Subscription State. @@ -1076,10 +1046,6 @@ def update( is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is None. :type app_type: str or ~azure.mgmt.apimanagement.models.AppType - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1102,12 +1068,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SubscriptionUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, sid=sid, @@ -1119,16 +1085,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1144,13 +1109,9 @@ def update( deserialized = self._deserialize("SubscriptionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1169,7 +1130,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1188,23 +1148,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, sid=sid, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1215,11 +1174,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def regenerate_primary_key( # pylint: disable=inconsistent-return-statements @@ -1235,7 +1190,6 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements :param sid: Subscription entity Identifier. The entity represents the association between a user and a product in API Management. Required. :type sid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1254,22 +1208,21 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_regenerate_primary_key_request( + _request = build_regenerate_primary_key_request( resource_group_name=resource_group_name, service_name=service_name, sid=sid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.regenerate_primary_key.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1280,11 +1233,7 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - regenerate_primary_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regeneratePrimaryKey" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements @@ -1300,7 +1249,6 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements :param sid: Subscription entity Identifier. The entity represents the association between a user and a product in API Management. Required. :type sid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1319,22 +1267,21 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_regenerate_secondary_key_request( + _request = build_regenerate_secondary_key_request( resource_group_name=resource_group_name, service_name=service_name, sid=sid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.regenerate_secondary_key.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1345,11 +1292,7 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - regenerate_secondary_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regenerateSecondaryKey" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_secrets( @@ -1365,7 +1308,6 @@ def list_secrets( :param sid: Subscription entity Identifier. The entity represents the association between a user and a product in API Management. Required. :type sid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionKeysContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SubscriptionKeysContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1384,22 +1326,21 @@ def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SubscriptionKeysContract] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, service_name=service_name, sid=sid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1415,10 +1356,6 @@ def list_secrets( deserialized = self._deserialize("SubscriptionKeysContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_operations.py index e573e0d6cb21..87c761434a1d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +77,7 @@ def build_list_by_operation_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -131,7 +132,7 @@ def build_get_entity_state_by_operation_request( # pylint: disable=name-too-lon "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -180,7 +181,7 @@ def build_get_by_operation_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,7 +230,7 @@ def build_assign_to_operation_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -278,7 +279,7 @@ def build_detach_from_operation_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -327,7 +328,7 @@ def build_list_by_api_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -375,7 +376,7 @@ def build_get_entity_state_by_api_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -417,7 +418,7 @@ def build_get_by_api_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -459,7 +460,7 @@ def build_assign_to_api_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -501,7 +502,7 @@ def build_detach_from_api_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -550,7 +551,7 @@ def build_list_by_product_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -598,7 +599,7 @@ def build_get_entity_state_by_product_request( # pylint: disable=name-too-long "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -640,7 +641,7 @@ def build_get_by_product_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -682,7 +683,7 @@ def build_assign_to_product_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -724,7 +725,7 @@ def build_detach_from_product_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -772,7 +773,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -821,7 +822,7 @@ def build_get_entity_state_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -862,7 +863,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -910,7 +911,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -956,7 +957,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1000,7 +1001,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1066,7 +1067,6 @@ def list_by_operation( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TagContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -1088,7 +1088,7 @@ def list_by_operation( def prepare_request(next_link=None): if not next_link: - request = build_list_by_operation_request( + _request = build_list_by_operation_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -1098,12 +1098,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_operation.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1115,13 +1114,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("TagCollection", pipeline_response) @@ -1131,11 +1130,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1148,10 +1147,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_operation.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags" - } - @distributed_trace def get_entity_state_by_operation( self, resource_group_name: str, service_name: str, api_id: str, operation_id: str, tag_id: str, **kwargs: Any @@ -1172,7 +1167,6 @@ def get_entity_state_by_operation( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -1191,7 +1185,7 @@ def get_entity_state_by_operation( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_state_by_operation_request( + _request = build_get_entity_state_by_operation_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -1199,16 +1193,15 @@ def get_entity_state_by_operation( tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_state_by_operation.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1222,13 +1215,9 @@ def get_entity_state_by_operation( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_state_by_operation.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}" - } - @distributed_trace def get_by_operation( self, resource_group_name: str, service_name: str, api_id: str, operation_id: str, tag_id: str, **kwargs: Any @@ -1249,7 +1238,6 @@ def get_by_operation( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1268,7 +1256,7 @@ def get_by_operation( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TagContract] = kwargs.pop("cls", None) - request = build_get_by_operation_request( + _request = build_get_by_operation_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -1276,16 +1264,15 @@ def get_by_operation( tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_operation.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1301,13 +1288,9 @@ def get_by_operation( deserialized = self._deserialize("TagContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get_by_operation.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}" - } + return deserialized # type: ignore @distributed_trace def assign_to_operation( @@ -1329,7 +1312,6 @@ def assign_to_operation( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1348,7 +1330,7 @@ def assign_to_operation( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TagContract] = kwargs.pop("cls", None) - request = build_assign_to_operation_request( + _request = build_assign_to_operation_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -1356,16 +1338,15 @@ def assign_to_operation( tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.assign_to_operation.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1386,10 +1367,6 @@ def assign_to_operation( return deserialized # type: ignore - assign_to_operation.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}" - } - @distributed_trace def detach_from_operation( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, api_id: str, operation_id: str, tag_id: str, **kwargs: Any @@ -1410,7 +1387,6 @@ def detach_from_operation( # pylint: disable=inconsistent-return-statements :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1429,7 +1405,7 @@ def detach_from_operation( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_detach_from_operation_request( + _request = build_detach_from_operation_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -1437,16 +1413,15 @@ def detach_from_operation( # pylint: disable=inconsistent-return-statements tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.detach_from_operation.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1457,11 +1432,7 @@ def detach_from_operation( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - detach_from_operation.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_by_api( @@ -1494,7 +1465,6 @@ def list_by_api( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TagContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -1516,7 +1486,7 @@ def list_by_api( def prepare_request(next_link=None): if not next_link: - request = build_list_by_api_request( + _request = build_list_by_api_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -1525,12 +1495,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1542,13 +1511,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("TagCollection", pipeline_response) @@ -1558,11 +1527,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1575,10 +1544,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags" - } - @distributed_trace def get_entity_state_by_api( self, resource_group_name: str, service_name: str, api_id: str, tag_id: str, **kwargs: Any @@ -1596,7 +1561,6 @@ def get_entity_state_by_api( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -1615,23 +1579,22 @@ def get_entity_state_by_api( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_state_by_api_request( + _request = build_get_entity_state_by_api_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_state_by_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1645,13 +1608,9 @@ def get_entity_state_by_api( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_state_by_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}" - } - @distributed_trace def get_by_api( self, resource_group_name: str, service_name: str, api_id: str, tag_id: str, **kwargs: Any @@ -1669,7 +1628,6 @@ def get_by_api( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1688,23 +1646,22 @@ def get_by_api( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TagContract] = kwargs.pop("cls", None) - request = build_get_by_api_request( + _request = build_get_by_api_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1720,13 +1677,9 @@ def get_by_api( deserialized = self._deserialize("TagContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get_by_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}" - } + return deserialized # type: ignore @distributed_trace def assign_to_api( @@ -1745,7 +1698,6 @@ def assign_to_api( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1764,23 +1716,22 @@ def assign_to_api( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TagContract] = kwargs.pop("cls", None) - request = build_assign_to_api_request( + _request = build_assign_to_api_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.assign_to_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1806,10 +1757,6 @@ def assign_to_api( return deserialized # type: ignore - assign_to_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}" - } - @distributed_trace def detach_from_api( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, api_id: str, tag_id: str, **kwargs: Any @@ -1827,7 +1774,6 @@ def detach_from_api( # pylint: disable=inconsistent-return-statements :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1846,23 +1792,22 @@ def detach_from_api( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_detach_from_api_request( + _request = build_detach_from_api_request( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.detach_from_api.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1873,11 +1818,7 @@ def detach_from_api( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - detach_from_api.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_by_product( @@ -1910,7 +1851,6 @@ def list_by_product( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TagContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -1932,7 +1872,7 @@ def list_by_product( def prepare_request(next_link=None): if not next_link: - request = build_list_by_product_request( + _request = build_list_by_product_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, @@ -1941,12 +1881,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1958,13 +1897,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("TagCollection", pipeline_response) @@ -1974,11 +1913,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1991,10 +1930,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags" - } - @distributed_trace def get_entity_state_by_product( self, resource_group_name: str, service_name: str, product_id: str, tag_id: str, **kwargs: Any @@ -2012,7 +1947,6 @@ def get_entity_state_by_product( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -2031,23 +1965,22 @@ def get_entity_state_by_product( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_state_by_product_request( + _request = build_get_entity_state_by_product_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_state_by_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2061,13 +1994,9 @@ def get_entity_state_by_product( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_state_by_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}" - } - @distributed_trace def get_by_product( self, resource_group_name: str, service_name: str, product_id: str, tag_id: str, **kwargs: Any @@ -2085,7 +2014,6 @@ def get_by_product( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -2104,23 +2032,22 @@ def get_by_product( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TagContract] = kwargs.pop("cls", None) - request = build_get_by_product_request( + _request = build_get_by_product_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2136,13 +2063,9 @@ def get_by_product( deserialized = self._deserialize("TagContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get_by_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}" - } + return deserialized # type: ignore @distributed_trace def assign_to_product( @@ -2161,7 +2084,6 @@ def assign_to_product( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -2180,23 +2102,22 @@ def assign_to_product( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TagContract] = kwargs.pop("cls", None) - request = build_assign_to_product_request( + _request = build_assign_to_product_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.assign_to_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2217,10 +2138,6 @@ def assign_to_product( return deserialized # type: ignore - assign_to_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}" - } - @distributed_trace def detach_from_product( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, product_id: str, tag_id: str, **kwargs: Any @@ -2238,7 +2155,6 @@ def detach_from_product( # pylint: disable=inconsistent-return-statements :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -2257,23 +2173,22 @@ def detach_from_product( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_detach_from_product_request( + _request = build_detach_from_product_request( resource_group_name=resource_group_name, service_name=service_name, product_id=product_id, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.detach_from_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2284,11 +2199,7 @@ def detach_from_product( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - detach_from_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_by_service( @@ -2320,7 +2231,6 @@ def list_by_service( :type skip: int :param scope: Scope like 'apis', 'products' or 'apis/{apiId}. Default value is None. :type scope: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TagContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -2342,7 +2252,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -2351,12 +2261,11 @@ def prepare_request(next_link=None): skip=skip, scope=scope, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -2368,13 +2277,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("TagCollection", pipeline_response) @@ -2384,11 +2293,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2401,10 +2310,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags" - } - @distributed_trace def get_entity_state(self, resource_group_name: str, service_name: str, tag_id: str, **kwargs: Any) -> bool: """Gets the entity state version of the tag specified by its identifier. @@ -2417,7 +2322,6 @@ def get_entity_state(self, resource_group_name: str, service_name: str, tag_id: :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -2436,22 +2340,21 @@ def get_entity_state(self, resource_group_name: str, service_name: str, tag_id: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_state_request( + _request = build_get_entity_state_request( resource_group_name=resource_group_name, service_name=service_name, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_state.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2465,13 +2368,9 @@ def get_entity_state(self, resource_group_name: str, service_name: str, tag_id: response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_state.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}" - } - @distributed_trace def get(self, resource_group_name: str, service_name: str, tag_id: str, **kwargs: Any) -> _models.TagContract: """Gets the details of the tag specified by its identifier. @@ -2484,7 +2383,6 @@ def get(self, resource_group_name: str, service_name: str, tag_id: str, **kwargs :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -2503,22 +2401,21 @@ def get(self, resource_group_name: str, service_name: str, tag_id: str, **kwargs api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TagContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, tag_id=tag_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2534,13 +2431,9 @@ def get(self, resource_group_name: str, service_name: str, tag_id: str, **kwargs deserialized = self._deserialize("TagContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -2572,7 +2465,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -2584,7 +2476,7 @@ def create_or_update( resource_group_name: str, service_name: str, tag_id: str, - parameters: IO, + parameters: IO[bytes], if_match: Optional[str] = None, *, content_type: str = "application/json", @@ -2601,14 +2493,13 @@ def create_or_update( Required. :type tag_id: str :param parameters: Create parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -2620,7 +2511,7 @@ def create_or_update( resource_group_name: str, service_name: str, tag_id: str, - parameters: Union[_models.TagCreateUpdateParameters, IO], + parameters: Union[_models.TagCreateUpdateParameters, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any ) -> _models.TagContract: @@ -2634,16 +2525,12 @@ def create_or_update( :param tag_id: Tag identifier. Must be unique in the current API Management service instance. Required. :type tag_id: str - :param parameters: Create parameters. Is either a TagCreateUpdateParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters or IO + :param parameters: Create parameters. Is either a TagCreateUpdateParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters or IO[bytes] :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -2666,12 +2553,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagCreateUpdateParameters") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, tag_id=tag_id, @@ -2681,16 +2568,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2716,10 +2602,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}" - } - @overload def update( self, @@ -2750,7 +2632,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -2763,7 +2644,7 @@ def update( service_name: str, tag_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -2782,11 +2663,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -2799,7 +2679,7 @@ def update( service_name: str, tag_id: str, if_match: str, - parameters: Union[_models.TagCreateUpdateParameters, IO], + parameters: Union[_models.TagCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.TagContract: """Updates the details of the tag specified by its identifier. @@ -2815,13 +2695,9 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a TagCreateUpdateParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a TagCreateUpdateParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters or IO[bytes] :return: TagContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TagContract :raises ~azure.core.exceptions.HttpResponseError: @@ -2844,12 +2720,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagCreateUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, tag_id=tag_id, @@ -2859,16 +2735,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2884,13 +2759,9 @@ def update( deserialized = self._deserialize("TagContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -2909,7 +2780,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -2928,23 +2798,22 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, tag_id=tag_id, subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2955,8 +2824,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_resource_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_resource_operations.py index 7822da240133..db5c4e3fe86c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_resource_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_resource_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +72,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -145,7 +145,6 @@ def list_by_service( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TagResourceContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagResourceContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -167,7 +166,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -175,12 +174,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -192,13 +190,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("TagResourceCollection", pipeline_response) @@ -208,11 +206,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -224,7 +222,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tagResources" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_access_git_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_access_git_operations.py index 058d857b61b7..6c21a0eb1c00 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_access_git_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_access_git_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +68,7 @@ def build_regenerate_primary_key_request( "accessName": _SERIALIZER.url("access_name", access_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -113,7 +113,7 @@ def build_regenerate_secondary_key_request( "accessName": _SERIALIZER.url("access_name", access_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,7 +157,6 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements :param access_name: The identifier of the Access configuration. Known values are: "access" and "gitAccess". Required. :type access_name: str or ~azure.mgmt.apimanagement.models.AccessIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -176,22 +175,21 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_regenerate_primary_key_request( + _request = build_regenerate_primary_key_request( resource_group_name=resource_group_name, service_name=service_name, access_name=access_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.regenerate_primary_key.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -202,11 +200,7 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - regenerate_primary_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regeneratePrimaryKey" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements @@ -222,7 +216,6 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements :param access_name: The identifier of the Access configuration. Known values are: "access" and "gitAccess". Required. :type access_name: str or ~azure.mgmt.apimanagement.models.AccessIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -241,22 +234,21 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_regenerate_secondary_key_request( + _request = build_regenerate_secondary_key_request( resource_group_name=resource_group_name, service_name=service_name, access_name=access_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.regenerate_secondary_key.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -267,8 +259,4 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - regenerate_secondary_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regenerateSecondaryKey" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_access_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_access_operations.py index 3a454f450d38..19aaa7949e6b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_access_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_access_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +66,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -112,7 +113,7 @@ def build_get_entity_tag_request( "accessName": _SERIALIZER.url("access_name", access_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,7 +158,7 @@ def build_get_request( "accessName": _SERIALIZER.url("access_name", access_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -205,7 +206,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -256,7 +257,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -304,7 +305,7 @@ def build_regenerate_primary_key_request( "accessName": _SERIALIZER.url("access_name", access_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -349,7 +350,7 @@ def build_regenerate_secondary_key_request( "accessName": _SERIALIZER.url("access_name", access_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -394,7 +395,7 @@ def build_list_secrets_request( "accessName": _SERIALIZER.url("access_name", access_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -437,7 +438,6 @@ def list_by_service( :type service_name: str :param filter: Not used. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AccessInformationContract or the result of cls(response) :rtype: @@ -461,18 +461,17 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -484,13 +483,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("AccessInformationCollection", pipeline_response) @@ -500,11 +499,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -517,10 +516,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant" - } - @distributed_trace def get_entity_tag( self, resource_group_name: str, service_name: str, access_name: Union[str, _models.AccessIdName], **kwargs: Any @@ -535,7 +530,6 @@ def get_entity_tag( :param access_name: The identifier of the Access configuration. Known values are: "access" and "gitAccess". Required. :type access_name: str or ~azure.mgmt.apimanagement.models.AccessIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -554,22 +548,21 @@ def get_entity_tag( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, access_name=access_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -583,13 +576,9 @@ def get_entity_tag( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, access_name: Union[str, _models.AccessIdName], **kwargs: Any @@ -604,7 +593,6 @@ def get( :param access_name: The identifier of the Access configuration. Known values are: "access" and "gitAccess". Required. :type access_name: str or ~azure.mgmt.apimanagement.models.AccessIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessInformationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -623,22 +611,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccessInformationContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, access_name=access_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -654,13 +641,9 @@ def get( deserialized = self._deserialize("AccessInformationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}" - } + return deserialized # type: ignore @overload def create( @@ -692,7 +675,6 @@ def create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessInformationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -705,7 +687,7 @@ def create( service_name: str, access_name: Union[str, _models.AccessIdName], if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -724,11 +706,10 @@ def create( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Parameters supplied to retrieve the Tenant Access Information. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessInformationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -741,7 +722,7 @@ def create( service_name: str, access_name: Union[str, _models.AccessIdName], if_match: str, - parameters: Union[_models.AccessInformationCreateParameters, IO], + parameters: Union[_models.AccessInformationCreateParameters, IO[bytes]], **kwargs: Any ) -> _models.AccessInformationContract: """Update tenant access information details. @@ -758,12 +739,9 @@ def create( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Parameters supplied to retrieve the Tenant Access Information. Is either a - AccessInformationCreateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.AccessInformationCreateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + AccessInformationCreateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AccessInformationCreateParameters or + IO[bytes] :return: AccessInformationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -786,12 +764,12 @@ def create( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AccessInformationCreateParameters") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, service_name=service_name, access_name=access_name, @@ -801,16 +779,15 @@ def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -826,13 +803,9 @@ def create( deserialized = self._deserialize("AccessInformationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}" - } + return deserialized # type: ignore @overload def update( @@ -864,7 +837,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessInformationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -877,7 +849,7 @@ def update( service_name: str, access_name: Union[str, _models.AccessIdName], if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -896,11 +868,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Parameters supplied to retrieve the Tenant Access Information. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessInformationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -913,7 +884,7 @@ def update( service_name: str, access_name: Union[str, _models.AccessIdName], if_match: str, - parameters: Union[_models.AccessInformationUpdateParameters, IO], + parameters: Union[_models.AccessInformationUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.AccessInformationContract: """Update tenant access information details. @@ -930,12 +901,9 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Parameters supplied to retrieve the Tenant Access Information. Is either a - AccessInformationUpdateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.AccessInformationUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + AccessInformationUpdateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AccessInformationUpdateParameters or + IO[bytes] :return: AccessInformationContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract :raises ~azure.core.exceptions.HttpResponseError: @@ -958,12 +926,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AccessInformationUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, access_name=access_name, @@ -973,16 +941,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -998,13 +965,9 @@ def update( deserialized = self._deserialize("AccessInformationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}" - } + return deserialized # type: ignore @distributed_trace def regenerate_primary_key( # pylint: disable=inconsistent-return-statements @@ -1020,7 +983,6 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements :param access_name: The identifier of the Access configuration. Known values are: "access" and "gitAccess". Required. :type access_name: str or ~azure.mgmt.apimanagement.models.AccessIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1039,22 +1001,21 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_regenerate_primary_key_request( + _request = build_regenerate_primary_key_request( resource_group_name=resource_group_name, service_name=service_name, access_name=access_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.regenerate_primary_key.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1065,11 +1026,7 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - regenerate_primary_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regeneratePrimaryKey" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements @@ -1085,7 +1042,6 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements :param access_name: The identifier of the Access configuration. Known values are: "access" and "gitAccess". Required. :type access_name: str or ~azure.mgmt.apimanagement.models.AccessIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1104,22 +1060,21 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_regenerate_secondary_key_request( + _request = build_regenerate_secondary_key_request( resource_group_name=resource_group_name, service_name=service_name, access_name=access_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.regenerate_secondary_key.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1130,11 +1085,7 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - regenerate_secondary_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regenerateSecondaryKey" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_secrets( @@ -1150,7 +1101,6 @@ def list_secrets( :param access_name: The identifier of the Access configuration. Known values are: "access" and "gitAccess". Required. :type access_name: str or ~azure.mgmt.apimanagement.models.AccessIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessInformationSecretsContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.AccessInformationSecretsContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1169,22 +1119,21 @@ def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccessInformationSecretsContract] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, service_name=service_name, access_name=access_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1200,10 +1149,6 @@ def list_secrets( deserialized = self._deserialize("AccessInformationSecretsContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_configuration_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_configuration_operations.py index 4b8555c8f3e5..043a833ea5b1 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_configuration_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_configuration_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +72,7 @@ def build_deploy_request( "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,7 +120,7 @@ def build_save_request( "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -167,7 +168,7 @@ def build_validate_request( "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -214,7 +215,7 @@ def build_get_sync_state_request( "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -249,7 +250,7 @@ def _deploy_initial( resource_group_name: str, service_name: str, configuration_name: Union[str, _models.ConfigurationIdName], - parameters: Union[_models.DeployConfigurationParameters, IO], + parameters: Union[_models.DeployConfigurationParameters, IO[bytes]], **kwargs: Any ) -> Optional[_models.OperationResultContract]: error_map = { @@ -270,12 +271,12 @@ def _deploy_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DeployConfigurationParameters") - request = build_deploy_request( + _request = build_deploy_request( resource_group_name=resource_group_name, service_name=service_name, configuration_name=configuration_name, @@ -284,16 +285,15 @@ def _deploy_initial( content_type=content_type, json=_json, content=_content, - template_url=self._deploy_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -308,13 +308,9 @@ def _deploy_initial( deserialized = self._deserialize("OperationResultContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _deploy_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy" - } + return deserialized # type: ignore @overload def begin_deploy( @@ -347,14 +343,6 @@ def begin_deploy( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either OperationResultContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.OperationResultContract] @@ -367,7 +355,7 @@ def begin_deploy( resource_group_name: str, service_name: str, configuration_name: Union[str, _models.ConfigurationIdName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -388,18 +376,10 @@ def begin_deploy( Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName :param parameters: Deploy Configuration parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either OperationResultContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.OperationResultContract] @@ -412,7 +392,7 @@ def begin_deploy( resource_group_name: str, service_name: str, configuration_name: Union[str, _models.ConfigurationIdName], - parameters: Union[_models.DeployConfigurationParameters, IO], + parameters: Union[_models.DeployConfigurationParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.OperationResultContract]: """This operation applies changes from the specified Git branch to the configuration database. @@ -431,19 +411,8 @@ def begin_deploy( Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName :param parameters: Deploy Configuration parameters. Is either a DeployConfigurationParameters - type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.DeployConfigurationParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.DeployConfigurationParameters or IO[bytes] :return: An instance of LROPoller that returns either OperationResultContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.OperationResultContract] @@ -476,7 +445,7 @@ def begin_deploy( def get_long_running_output(pipeline_response): deserialized = self._deserialize("OperationResultContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -488,24 +457,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.OperationResultContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_deploy.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy" - } + return LROPoller[_models.OperationResultContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _save_initial( self, resource_group_name: str, service_name: str, configuration_name: Union[str, _models.ConfigurationIdName], - parameters: Union[_models.SaveConfigurationParameter, IO], + parameters: Union[_models.SaveConfigurationParameter, IO[bytes]], **kwargs: Any ) -> Optional[_models.OperationResultContract]: error_map = { @@ -526,12 +493,12 @@ def _save_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SaveConfigurationParameter") - request = build_save_request( + _request = build_save_request( resource_group_name=resource_group_name, service_name=service_name, configuration_name=configuration_name, @@ -540,16 +507,15 @@ def _save_initial( content_type=content_type, json=_json, content=_content, - template_url=self._save_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -564,13 +530,9 @@ def _save_initial( deserialized = self._deserialize("OperationResultContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _save_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save" - } + return deserialized # type: ignore @overload def begin_save( @@ -603,14 +565,6 @@ def begin_save( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either OperationResultContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.OperationResultContract] @@ -623,7 +577,7 @@ def begin_save( resource_group_name: str, service_name: str, configuration_name: Union[str, _models.ConfigurationIdName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -644,18 +598,10 @@ def begin_save( Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName :param parameters: Save Configuration parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either OperationResultContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.OperationResultContract] @@ -668,7 +614,7 @@ def begin_save( resource_group_name: str, service_name: str, configuration_name: Union[str, _models.ConfigurationIdName], - parameters: Union[_models.SaveConfigurationParameter, IO], + parameters: Union[_models.SaveConfigurationParameter, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.OperationResultContract]: """This operation creates a commit with the current configuration snapshot to the specified branch @@ -687,19 +633,8 @@ def begin_save( Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName :param parameters: Save Configuration parameters. Is either a SaveConfigurationParameter type - or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.SaveConfigurationParameter or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.SaveConfigurationParameter or IO[bytes] :return: An instance of LROPoller that returns either OperationResultContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.OperationResultContract] @@ -732,7 +667,7 @@ def begin_save( def get_long_running_output(pipeline_response): deserialized = self._deserialize("OperationResultContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -744,24 +679,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.OperationResultContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_save.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save" - } + return LROPoller[_models.OperationResultContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _validate_initial( self, resource_group_name: str, service_name: str, configuration_name: Union[str, _models.ConfigurationIdName], - parameters: Union[_models.DeployConfigurationParameters, IO], + parameters: Union[_models.DeployConfigurationParameters, IO[bytes]], **kwargs: Any ) -> Optional[_models.OperationResultContract]: error_map = { @@ -782,12 +715,12 @@ def _validate_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DeployConfigurationParameters") - request = build_validate_request( + _request = build_validate_request( resource_group_name=resource_group_name, service_name=service_name, configuration_name=configuration_name, @@ -796,16 +729,15 @@ def _validate_initial( content_type=content_type, json=_json, content=_content, - template_url=self._validate_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -820,13 +752,9 @@ def _validate_initial( deserialized = self._deserialize("OperationResultContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _validate_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate" - } + return deserialized # type: ignore @overload def begin_validate( @@ -855,14 +783,6 @@ def begin_validate( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either OperationResultContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.OperationResultContract] @@ -875,7 +795,7 @@ def begin_validate( resource_group_name: str, service_name: str, configuration_name: Union[str, _models.ConfigurationIdName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -892,18 +812,10 @@ def begin_validate( Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName :param parameters: Validate Configuration parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either OperationResultContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.OperationResultContract] @@ -916,7 +828,7 @@ def begin_validate( resource_group_name: str, service_name: str, configuration_name: Union[str, _models.ConfigurationIdName], - parameters: Union[_models.DeployConfigurationParameters, IO], + parameters: Union[_models.DeployConfigurationParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.OperationResultContract]: """This operation validates the changes in the specified Git branch. This is a long running @@ -931,19 +843,8 @@ def begin_validate( Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName :param parameters: Validate Configuration parameters. Is either a DeployConfigurationParameters - type or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.DeployConfigurationParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.DeployConfigurationParameters or IO[bytes] :return: An instance of LROPoller that returns either OperationResultContract or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.OperationResultContract] @@ -976,7 +877,7 @@ def begin_validate( def get_long_running_output(pipeline_response): deserialized = self._deserialize("OperationResultContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -988,17 +889,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.OperationResultContract].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_validate.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate" - } + return LROPoller[_models.OperationResultContract]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def get_sync_state( @@ -1019,7 +918,6 @@ def get_sync_state( :param configuration_name: The identifier of the Git Configuration Operation. "configuration" Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName - :keyword callable cls: A custom type or function that will be passed the direct response :return: TenantConfigurationSyncStateContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TenantConfigurationSyncStateContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1038,22 +936,21 @@ def get_sync_state( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TenantConfigurationSyncStateContract] = kwargs.pop("cls", None) - request = build_get_sync_state_request( + _request = build_get_sync_state_request( resource_group_name=resource_group_name, service_name=service_name, configuration_name=configuration_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_sync_state.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1066,10 +963,6 @@ def get_sync_state( deserialized = self._deserialize("TenantConfigurationSyncStateContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_sync_state.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/syncState" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_settings_operations.py index 65907936adad..b0ff8cb1e2d2 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_settings_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +65,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -112,7 +112,7 @@ def build_get_request( "settingsType": _SERIALIZER.url("settings_type", settings_type, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +155,6 @@ def list_by_service( :type service_name: str :param filter: Not used. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TenantSettingsContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TenantSettingsContract] @@ -178,18 +177,17 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -201,13 +199,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("TenantSettingsCollection", pipeline_response) @@ -217,11 +215,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,10 +232,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings" - } - @distributed_trace def get( self, @@ -255,7 +249,6 @@ def get( :type service_name: str :param settings_type: The identifier of the settings. "public" Required. :type settings_type: str or ~azure.mgmt.apimanagement.models.SettingsTypeName - :keyword callable cls: A custom type or function that will be passed the direct response :return: TenantSettingsContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.TenantSettingsContract :raises ~azure.core.exceptions.HttpResponseError: @@ -274,22 +267,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TenantSettingsContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, settings_type=settings_type, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -305,10 +297,6 @@ def get( deserialized = self._deserialize("TenantSettingsContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings/{settingsType}" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_confirmation_password_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_confirmation_password_operations.py index 94cfe314af91..a44daf3472b6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_confirmation_password_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_confirmation_password_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +70,7 @@ def build_send_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -125,7 +125,6 @@ def send( # pylint: disable=inconsistent-return-statements is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is None. :type app_type: str or ~azure.mgmt.apimanagement.models.AppType - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -144,23 +143,22 @@ def send( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_send_request( + _request = build_send_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, subscription_id=self._config.subscription_id, app_type=app_type, api_version=api_version, - template_url=self.send.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -171,8 +169,4 @@ def send( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - send.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/confirmations/password/send" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_group_operations.py index d94cfde7c8e9..1a90bdf33d46 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_group_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_group_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +74,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -143,7 +143,6 @@ def list( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GroupContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.GroupContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -165,7 +164,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, @@ -174,12 +173,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -191,13 +189,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("GroupCollection", pipeline_response) @@ -207,11 +205,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -223,7 +221,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/groups" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_identities_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_identities_operations.py index 35f377f13206..2172465cd34d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_identities_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_identities_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -66,7 +66,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,7 +110,6 @@ def list( :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserIdentityContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.UserIdentityContract] @@ -133,18 +132,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -156,13 +154,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("UserIdentityCollection", pipeline_response) @@ -172,11 +170,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,7 +186,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/identities" - } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_operations.py index 8cf5e6f59d50..b888ea9dfd3f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +74,7 @@ def build_list_by_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -122,7 +123,7 @@ def build_get_entity_tag_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -163,7 +164,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -212,7 +213,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if notify is not None: @@ -260,7 +261,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -313,7 +314,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if delete_subscriptions is not None: @@ -361,7 +362,7 @@ def build_generate_sso_url_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -403,7 +404,7 @@ def build_get_shared_access_token_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -469,7 +470,6 @@ def list_by_service( :type skip: int :param expand_groups: Detailed Group in response. Default value is None. :type expand_groups: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.UserContract] :raises ~azure.core.exceptions.HttpResponseError: @@ -491,7 +491,7 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, service_name=service_name, subscription_id=self._config.subscription_id, @@ -500,12 +500,11 @@ def prepare_request(next_link=None): skip=skip, expand_groups=expand_groups, api_version=api_version, - template_url=self.list_by_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -517,13 +516,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("UserCollection", pipeline_response) @@ -533,11 +532,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -550,10 +549,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users" - } - @distributed_trace def get_entity_tag(self, resource_group_name: str, service_name: str, user_id: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the user specified by its identifier. @@ -566,7 +561,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, user_id: s :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: bool or the result of cls(response) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: @@ -585,22 +579,21 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, user_id: s api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_get_entity_tag_request( + _request = build_get_entity_tag_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_entity_tag.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -614,13 +607,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, user_id: s response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 - get_entity_tag.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" - } - @distributed_trace def get(self, resource_group_name: str, service_name: str, user_id: str, **kwargs: Any) -> _models.UserContract: """Gets the details of the user specified by its identifier. @@ -633,7 +622,6 @@ def get(self, resource_group_name: str, service_name: str, user_id: str, **kwarg :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserContract :raises ~azure.core.exceptions.HttpResponseError: @@ -652,22 +640,21 @@ def get(self, resource_group_name: str, service_name: str, user_id: str, **kwarg api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UserContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -683,13 +670,9 @@ def get(self, resource_group_name: str, service_name: str, user_id: str, **kwarg deserialized = self._deserialize("UserContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -724,7 +707,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserContract :raises ~azure.core.exceptions.HttpResponseError: @@ -736,7 +718,7 @@ def create_or_update( resource_group_name: str, service_name: str, user_id: str, - parameters: IO, + parameters: IO[bytes], notify: Optional[bool] = None, if_match: Optional[str] = None, *, @@ -754,7 +736,7 @@ def create_or_update( Required. :type user_id: str :param parameters: Create or update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :param notify: Send an Email notification to the User. Default value is None. :type notify: bool :param if_match: ETag of the Entity. Not required when creating an entity, but required when @@ -763,7 +745,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserContract :raises ~azure.core.exceptions.HttpResponseError: @@ -775,7 +756,7 @@ def create_or_update( resource_group_name: str, service_name: str, user_id: str, - parameters: Union[_models.UserCreateParameters, IO], + parameters: Union[_models.UserCreateParameters, IO[bytes]], notify: Optional[bool] = None, if_match: Optional[str] = None, **kwargs: Any @@ -790,18 +771,14 @@ def create_or_update( :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :param parameters: Create or update parameters. Is either a UserCreateParameters type or a IO - type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.UserCreateParameters or IO + :param parameters: Create or update parameters. Is either a UserCreateParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.UserCreateParameters or IO[bytes] :param notify: Send an Email notification to the User. Default value is None. :type notify: bool :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. :type if_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserContract :raises ~azure.core.exceptions.HttpResponseError: @@ -824,12 +801,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UserCreateParameters") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, @@ -840,16 +817,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -875,10 +851,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" - } - @overload def update( self, @@ -909,7 +881,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserContract :raises ~azure.core.exceptions.HttpResponseError: @@ -922,7 +893,7 @@ def update( service_name: str, user_id: str, if_match: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -941,11 +912,10 @@ def update( response of the GET request or it should be * for unconditional update. Required. :type if_match: str :param parameters: Update parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserContract :raises ~azure.core.exceptions.HttpResponseError: @@ -958,7 +928,7 @@ def update( service_name: str, user_id: str, if_match: str, - parameters: Union[_models.UserUpdateParameters, IO], + parameters: Union[_models.UserUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.UserContract: """Updates the details of the user specified by its identifier. @@ -974,13 +944,9 @@ def update( :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. Required. :type if_match: str - :param parameters: Update parameters. Is either a UserUpdateParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.apimanagement.models.UserUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Update parameters. Is either a UserUpdateParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.UserUpdateParameters or IO[bytes] :return: UserContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserContract :raises ~azure.core.exceptions.HttpResponseError: @@ -1003,12 +969,12 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UserUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, @@ -1018,16 +984,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1043,13 +1008,9 @@ def update( deserialized = self._deserialize("UserContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1085,7 +1046,6 @@ def delete( # pylint: disable=inconsistent-return-statements is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is None. :type app_type: str or ~azure.mgmt.apimanagement.models.AppType - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1104,7 +1064,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, @@ -1114,16 +1074,15 @@ def delete( # pylint: disable=inconsistent-return-statements notify=notify, app_type=app_type, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1134,11 +1093,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def generate_sso_url( @@ -1155,7 +1110,6 @@ def generate_sso_url( :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GenerateSsoUrlResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.GenerateSsoUrlResult :raises ~azure.core.exceptions.HttpResponseError: @@ -1174,22 +1128,21 @@ def generate_sso_url( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GenerateSsoUrlResult] = kwargs.pop("cls", None) - request = build_generate_sso_url_request( + _request = build_generate_sso_url_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.generate_sso_url.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1202,13 +1155,9 @@ def generate_sso_url( deserialized = self._deserialize("GenerateSsoUrlResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - generate_sso_url.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/generateSsoUrl" - } + return deserialized # type: ignore @overload def get_shared_access_token( @@ -1236,7 +1185,6 @@ def get_shared_access_token( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserTokenResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserTokenResult :raises ~azure.core.exceptions.HttpResponseError: @@ -1248,7 +1196,7 @@ def get_shared_access_token( resource_group_name: str, service_name: str, user_id: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1264,11 +1212,10 @@ def get_shared_access_token( Required. :type user_id: str :param parameters: Create Authorization Token parameters. Required. - :type parameters: IO + :type 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserTokenResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserTokenResult :raises ~azure.core.exceptions.HttpResponseError: @@ -1280,7 +1227,7 @@ def get_shared_access_token( resource_group_name: str, service_name: str, user_id: str, - parameters: Union[_models.UserTokenParameters, IO], + parameters: Union[_models.UserTokenParameters, IO[bytes]], **kwargs: Any ) -> _models.UserTokenResult: """Gets the Shared Access Authorization Token for the User. @@ -1294,12 +1241,8 @@ def get_shared_access_token( Required. :type user_id: str :param parameters: Create Authorization Token parameters. Is either a UserTokenParameters type - or a IO type. Required. - :type parameters: ~azure.mgmt.apimanagement.models.UserTokenParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.apimanagement.models.UserTokenParameters or IO[bytes] :return: UserTokenResult or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.UserTokenResult :raises ~azure.core.exceptions.HttpResponseError: @@ -1322,12 +1265,12 @@ def get_shared_access_token( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UserTokenParameters") - request = build_get_shared_access_token_request( + _request = build_get_shared_access_token_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, @@ -1336,16 +1279,15 @@ def get_shared_access_token( content_type=content_type, json=_json, content=_content, - template_url=self.get_shared_access_token.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1358,10 +1300,6 @@ def get_shared_access_token( deserialized = self._deserialize("UserTokenResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_shared_access_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/token" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_subscription_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_subscription_operations.py index 081e68a54976..f991e90bcbe6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_subscription_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_subscription_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import ApiManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +74,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -122,7 +122,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,7 +188,6 @@ def list( :type top: int :param skip: Number of records to skip. Default value is None. :type skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SubscriptionContract or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.SubscriptionContract] @@ -211,7 +210,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, @@ -220,12 +219,11 @@ def prepare_request(next_link=None): top=top, skip=skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -237,13 +235,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("SubscriptionCollection", pipeline_response) @@ -253,11 +251,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -270,10 +268,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions" - } - @distributed_trace def get( self, resource_group_name: str, service_name: str, user_id: str, sid: str, **kwargs: Any @@ -291,7 +285,6 @@ def get( :param sid: Subscription entity Identifier. The entity represents the association between a user and a product in API Management. Required. :type sid: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionContract or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract :raises ~azure.core.exceptions.HttpResponseError: @@ -310,23 +303,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SubscriptionContract] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, service_name=service_name, user_id=user_id, sid=sid, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -342,10 +334,6 @@ def get( deserialized = self._deserialize("SubscriptionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions/{sid}" - } + return deserialized # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_apply_network_configuration_updates.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_apply_network_configuration_updates.py index 9c0913a1103e..3dd87af23d74 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_apply_network_configuration_updates.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_apply_network_configuration_updates.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_approve_or_reject_private_endpoint_connection.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_approve_or_reject_private_endpoint_connection.py index 866e795c08a7..47ca9ebf4adc 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_approve_or_reject_private_endpoint_connection.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_approve_or_reject_private_endpoint_connection.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_authorization_server_list_secrets.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_authorization_server_list_secrets.py index 7b386a31e04c..66aa19d8682e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_authorization_server_list_secrets.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_authorization_server_list_secrets.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backend_reconnect.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backend_reconnect.py index ab95404face8..2dcfc0d108c7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backend_reconnect.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backend_reconnect.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,12 +30,11 @@ def main(): subscription_id="subid", ) - response = client.backend.reconnect( + client.backend.reconnect( resource_group_name="rg1", service_name="apimService1", backend_id="proxybackend", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementBackendReconnect.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_access_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_access_key.py index afc0be2e5da1..2a0e5cb7f855 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_access_key.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_access_key.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_system_managed_identity.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_system_managed_identity.py index a9d692ddb896..bed66ff2c560 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_system_managed_identity.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_system_managed_identity.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_user_assigned_managed_identity.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_user_assigned_managed_identity.py index 99c9e67c1398..c3217f2487a4 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_user_assigned_managed_identity.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_user_assigned_managed_identity.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_ai_logger.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_ai_logger.py index 62a47f74bf61..ebafe51242ac 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_ai_logger.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_ai_logger.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api.py index bdf19c72acb1..795f6a7a9f36 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_clone.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_clone.py index 76cbe83e0822..8ecf84be3b5f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_clone.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_clone.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_diagnostic.py index e234f7f326c5..148ac7bb73e5 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_diagnostic.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_diagnostic.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue.py index 47f9477689a2..78a56e2e35bf 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue_attachment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue_attachment.py index a902b10e2936..1d528b578d09 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue_attachment.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue_attachment.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue_comment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue_comment.py index c29fb088ef95..c5c99039fd71 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue_comment.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue_comment.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_new_version_using_existing_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_new_version_using_existing_api.py index 2dbc979cb1be..77914e3d2027 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_new_version_using_existing_api.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_new_version_using_existing_api.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation.py index 997cf3d36e4e..7137883ca85c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation_policy.py index 931d0c16dfd3..97c283a58f4b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation_tag.py index 0eda2fe84ae4..0e47cfe4e3a0 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation_tag.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation_tag.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_policy.py index 9d0a20ec2314..22bfabc0fc73 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_policy_non_xml_encoded.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_policy_non_xml_encoded.py index 8f2ee2123898..d10697303280 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_policy_non_xml_encoded.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_policy_non_xml_encoded.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_release.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_release.py index d333daf5e79f..c2b5ac57b9e2 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_release.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_release.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_revision_from_existing_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_revision_from_existing_api.py index cff644c8763c..58df746c5359 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_revision_from_existing_api.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_revision_from_existing_api.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_schema.py index 85b2e19c0f0d..29fe682f3055 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_schema.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_schema.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_tag.py index a201adaff8d9..fbffafe62d06 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_tag.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_tag.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_tag_description.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_tag_description.py index 5edab1228919..a53a6dc09db6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_tag_description.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_tag_description.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_import_override_service_url.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_import_override_service_url.py index c8adaa0c8ddb..573cda6ddc9a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_import_override_service_url.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_import_override_service_url.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_oai3_import.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_oai3_import.py index ca6dc2a47ba7..9f7e66fca83c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_oai3_import.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_oai3_import.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_oai3_import_with_translate_required_query_parameters_conduct.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_oai3_import_with_translate_required_query_parameters_conduct.py index b82c55216874..9247b88dc12f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_oai3_import_with_translate_required_query_parameters_conduct.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_oai3_import_with_translate_required_query_parameters_conduct.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_swagger_import.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_swagger_import.py index 18432af91a9f..fd65860c4854 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_swagger_import.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_swagger_import.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_wadl_import.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_wadl_import.py index 660e4e0706ff..be5f77a74676 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_wadl_import.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_wadl_import.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_version_set.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_version_set.py index 5ebb16858411..f264ccbe9e72 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_version_set.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_version_set.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_wiki.py index e1ac3e8d2fae..f75af9e56666 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_wiki.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_wiki.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_auth_servers.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_auth_servers.py index 9a7e4f120062..f7aa7e312144 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_auth_servers.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_auth_servers.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_open_id_connect_providers.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_open_id_connect_providers.py index f547a8c80566..51baf16fb1fe 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_open_id_connect_providers.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_open_id_connect_providers.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_open_id_connect.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_open_id_connect.py index d75125657e81..00ff26bb0787 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_open_id_connect.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_open_id_connect.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_auth_code.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_auth_code.py index 3e3f53355ebd..c0e9c7775080 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_auth_code.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_auth_code.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_client_cred.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_client_cred.py index d66d2bcdc3ff..136424336e69 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_client_cred.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_client_cred.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ @@ -40,7 +43,7 @@ def main(): "oauth2grantType": "AuthorizationCode", "parameters": { "clientId": "53790925-fdd3-4b80-bc7a-4c3aaf25801d", - "clientSecret": "FcJkQ3iPSaKAQRA7Ft8Q~fZ1X5vKmqzUAfJagcJ8", + "clientSecret": "xxxxxxxxxxxxxxx~xxxxxxxxx", }, } }, diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_access_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_access_policy.py index e5b27bba4dad..e2ef181923a8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_access_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_access_policy.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_auth_code.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_auth_code.py index 1c3d79a871dc..5e207b22cc50 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_auth_code.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_auth_code.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ @@ -41,7 +44,7 @@ def main(): "grantTypes": { "authorizationCode": { "clientId": "59790825-fdd3-4b10-bc7a-4c3aaf25801d", - "clientSecret": "Q3iPSaKQ~fZFcJk5vKmqzUAfJagcJ8", + "clientSecret": "xxxxxxxxxxxxxxxxxxxxxxxx", "resourceUri": "https://graph.microsoft.com", "scopes": "User.Read.All Group.Read.All", } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_client_cred.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_client_cred.py index dce23b211d17..75087d593c76 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_client_cred.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_client_cred.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_generic_oauth2.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_generic_oauth2.py index 136d0102929f..300ff958185e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_generic_oauth2.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_generic_oauth2.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ @@ -41,10 +44,10 @@ def main(): "grantTypes": { "authorizationCode": { "authorizationUrl": "https://www.eventbrite.com/oauth/authorize", - "clientId": "ZYIJTBTABHOUQQDLZY", - "clientSecret": "Q3iPSaKQ~fZFcJk5vKmqzUAfJagcJ8", + "clientId": "genericClientId", + "clientSecret": "xxxxxxxxxxxxxxxxxxxxxxxx", "refreshUrl": "https://www.eventbrite.com/oauth/token", - "scopes": None, + "scopes": "", "tokenUrl": "https://www.eventbrite.com/oauth/token", } }, diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_oob_google.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_oob_google.py index 3b1dd1398660..5007f303c727 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_oob_google.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_oob_google.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ @@ -40,8 +43,8 @@ def main(): "oauth2": { "grantTypes": { "authorizationCode": { - "clientId": "508791967882-5qv6o2i99a75un7329vlegtk78kr766h.apps.googleusercontent.com", - "clientSecret": "qDN0VyVFjU1OsOyT5Kz8ce", + "clientId": "99999999-xxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com", + "clientSecret": "XXXXXXXXXXXXXXXXXXXX", "scopes": "openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email", } }, diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_server.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_server.py index ced222c85d93..db604163bb16 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_server.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_server.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_backend_proxy_backend.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_backend_proxy_backend.py index 660b77831be2..39eea9a2a057 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_backend_proxy_backend.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_backend_proxy_backend.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_backend_service_fabric.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_backend_service_fabric.py index 286c9b981618..4b2dd41b87f0 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_backend_service_fabric.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_backend_service_fabric.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_cache.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_cache.py index 19db318518b7..51734b97c986 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_cache.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_cache.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_certificate.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_certificate.py index 8beefccfeaa7..3c4fc86ef3a3 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_certificate.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_certificate.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_certificate_with_key_vault.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_certificate_with_key_vault.py index c38592b14d5d..a62ba4b93a0d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_certificate_with_key_vault.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_certificate_with_key_vault.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_content_type.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_content_type.py index 2a3fd6513f84..2f753eb79280 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_content_type.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_content_type.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_content_type_content_item.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_content_type_content_item.py index c008a5299155..42a5cd2f1691 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_content_type_content_item.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_content_type_content_item.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_diagnostic.py index e7128a76d6e2..92bb01ecec29 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_diagnostic.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_diagnostic.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_documentation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_documentation.py index 97e997000344..4058eddc8001 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_documentation.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_documentation.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_eh_logger.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_eh_logger.py index 9f184e8d9d1e..018bab238e06 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_eh_logger.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_eh_logger.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway.py index 8987d294fe1d..ce4bd494c43e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_api.py index 457ef7bdfd78..da3fb7e85279 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_api.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_api.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_certificate_authority.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_certificate_authority.py index 1bfbb71590e2..033b67a01dbc 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_certificate_authority.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_certificate_authority.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_hostname_configuration.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_hostname_configuration.py index cd1ca1f5b6d7..eece8c385720 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_hostname_configuration.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_hostname_configuration.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema1.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema1.py index 43159c660445..1f7d05d80c1b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema1.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema1.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema2.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema2.py index 786cff0e0fa1..96809f390c32 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema2.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema2.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api.py index 51de15eec866..d214e403ae76 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver.py index d51ecce90217..49b10ccb4f89 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver_policy.py index a6a795b7b651..b27e995c94ce 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group.py index ac42dffb2fe2..394831375be3 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group_external.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group_external.py index fc49963ea614..fa8592dfe0b7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group_external.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group_external.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group_user.py index e9836afd9d86..e4d9d1725e86 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group_user.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group_user.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_identity_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_identity_provider.py index f11cfccf08ba..02fb426e3a99 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_identity_provider.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_identity_provider.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_multi_region_service_with_custom_hostname.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_multi_region_service_with_custom_hostname.py index 3a8d75aeb984..23a8c0811874 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_multi_region_service_with_custom_hostname.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_multi_region_service_with_custom_hostname.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_named_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_named_value.py index 86be1b09b56c..25fbae15022b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_named_value.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_named_value.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_named_value_with_key_vault.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_named_value_with_key_vault.py index 646381950ec7..c75554f95b94 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_named_value_with_key_vault.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_named_value_with_key_vault.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification.py index a008810a2a79..c4e43113a3dd 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification_recipient_email.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification_recipient_email.py index 4a508ff99f3b..e4eda87dd062 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification_recipient_email.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification_recipient_email.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification_recipient_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification_recipient_user.py index 49bddde3336b..42b92682dba5 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification_recipient_user.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification_recipient_user.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_open_id_connect_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_open_id_connect_provider.py index 792c44aa500a..90ec5c3aa56d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_open_id_connect_provider.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_open_id_connect_provider.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy.py index 94da1ee882af..8b05fc576fd4 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy_fragment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy_fragment.py index 7965fa178968..dd9c1ea7e4d7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy_fragment.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy_fragment.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_config.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_config.py index 4476b4d39569..b34cd16c6f33 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_config.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_config.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_revision.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_revision.py index b14099fad1ae..f108ebed3134 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_revision.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_revision.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product.py index a6b677242960..144d8a3dbde2 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_api.py index f74f7f05782a..e9c7583d42ae 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_api.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_api.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_group.py index fc2148c1c51a..1713e706cb8d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_group.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_policy.py index 0ea8bce9f0d3..52bbc31e8a6e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_tag.py index 21f5a33a3423..07ab1d31f2f6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_tag.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_tag.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_wiki.py index ac7b22aee0a2..48a8254322a0 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_wiki.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_wiki.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service.py index ecc5415b0cc9..988fb15918db 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_having_msi.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_having_msi.py index 3bebe1bc1c33..533d7cd1955e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_having_msi.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_having_msi.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_in_vnet_with_public_ip.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_in_vnet_with_public_ip.py index 7b820ec214f3..d51b010977a2 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_in_vnet_with_public_ip.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_in_vnet_with_public_ip.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_in_zones.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_in_zones.py index e81ad0f01ca3..1b1b5135affe 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_in_zones.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_in_zones.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_custom_hostname_key_vault.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_custom_hostname_key_vault.py index 581cc7c4ff4b..4bb51386bf8e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_custom_hostname_key_vault.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_custom_hostname_key_vault.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_nat_gateway_enabled.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_nat_gateway_enabled.py index 63ff3831197f..1448415d9754 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_nat_gateway_enabled.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_nat_gateway_enabled.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_system_certificates.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_system_certificates.py index fada765fab3c..d63975a51d7e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_system_certificates.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_system_certificates.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_user_assigned_identity.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_user_assigned_identity.py index a3ee4ded4bce..83f973b85a7a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_user_assigned_identity.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_user_assigned_identity.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_soap_pass_through_api_using_wsdl_import.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_soap_pass_through_api_using_wsdl_import.py index 311ded97a5d8..251633f4860c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_soap_pass_through_api_using_wsdl_import.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_soap_pass_through_api_using_wsdl_import.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_soap_to_rest_api_using_wsdl_import.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_soap_to_rest_api_using_wsdl_import.py index 031b56325ab1..7694e79ac435 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_soap_to_rest_api_using_wsdl_import.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_soap_to_rest_api_using_wsdl_import.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_subscription.py index e1673a588051..92571e820f8b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_subscription.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_subscription.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag.py index 0b30647817aa..25e575987f49 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_template.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_template.py index 5aaea8ba209e..6b2a883b22ce 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_template.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_template.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tenant_access.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tenant_access.py index 3686be972670..a2a4ed6d5c41 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tenant_access.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tenant_access.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_user.py index b23a44fbb6a2..c131f88e7621 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_user.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_user.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_websocket_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_websocket_api.py index f32fc0d62cae..a4d2d45e9c3a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_websocket_api.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_websocket_api.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api.py index 9be10ce50609..4bb68cfc66c1 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.api.delete( + client.api.delete( resource_group_name="rg1", service_name="apimService1", api_id="echo-api", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApi.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_diagnostic.py index 6b9119c4bc2a..55a9dc1a41f9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_diagnostic.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_diagnostic.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,14 +30,13 @@ def main(): subscription_id="subid", ) - response = client.api_diagnostic.delete( + client.api_diagnostic.delete( resource_group_name="rg1", service_name="apimService1", api_id="57d1f7558aa04f15146d9d8a", diagnostic_id="applicationinsights", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiDiagnostic.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue.py index 1320cea1195d..827e38e93761 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,14 +30,13 @@ def main(): subscription_id="subid", ) - response = client.api_issue.delete( + client.api_issue.delete( resource_group_name="rg1", service_name="apimService1", api_id="57d1f7558aa04f15146d9d8a", issue_id="57d2ef278aa04f0ad01d6cdc", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiIssue.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue_attachment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue_attachment.py index 6ddcee0dcc09..1827d3f8232f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue_attachment.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue_attachment.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,7 +30,7 @@ def main(): subscription_id="subid", ) - response = client.api_issue_attachment.delete( + client.api_issue_attachment.delete( resource_group_name="rg1", service_name="apimService1", api_id="57d1f7558aa04f15146d9d8a", @@ -37,7 +38,6 @@ def main(): attachment_id="57d2ef278aa04f0888cba3f3", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiIssueAttachment.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue_comment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue_comment.py index 41d86b3ac75c..1827187fe125 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue_comment.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue_comment.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,7 +30,7 @@ def main(): subscription_id="subid", ) - response = client.api_issue_comment.delete( + client.api_issue_comment.delete( resource_group_name="rg1", service_name="apimService1", api_id="57d1f7558aa04f15146d9d8a", @@ -37,7 +38,6 @@ def main(): comment_id="599e29ab193c3c0bd0b3e2fb", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiIssueComment.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation.py index 30ca907557ce..18ef26a3d397 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,14 +30,13 @@ def main(): subscription_id="subid", ) - response = client.api_operation.delete( + client.api_operation.delete( resource_group_name="rg1", service_name="apimService1", api_id="57d2ef278aa04f0888cba3f3", operation_id="57d2ef278aa04f0ad01d6cdc", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiOperation.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation_policy.py index eafb3619907c..cb4e6cb981a9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -29,7 +35,7 @@ def main(): subscription_id="subid", ) - response = client.api_operation_policy.delete( + client.api_operation_policy.delete( resource_group_name="rg1", service_name="apimService1", api_id="testapi", @@ -37,7 +43,6 @@ def main(): policy_id="policy", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiOperationPolicy.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation_tag.py index 908ce449b927..0a5d3fe9e06a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation_tag.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation_tag.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,14 +30,13 @@ def main(): subscription_id="subid", ) - response = client.tag.detach_from_operation( + client.tag.detach_from_operation( resource_group_name="rg1", service_name="apimService1", api_id="59d5b28d1f7fab116c282650", operation_id="59d5b28d1f7fab116c282651", tag_id="59d5b28e1f7fab116402044e", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiOperationTag.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_policy.py index 388004a9e0c0..52a9df19721b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -29,14 +35,13 @@ def main(): subscription_id="subid", ) - response = client.api_policy.delete( + client.api_policy.delete( resource_group_name="rg1", service_name="apimService1", api_id="loggerId", policy_id="policy", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiPolicy.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_release.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_release.py index a4eac7ee0db3..202406766505 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_release.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_release.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,14 +30,13 @@ def main(): subscription_id="subid", ) - response = client.api_release.delete( + client.api_release.delete( resource_group_name="rg1", service_name="apimService1", api_id="5a5fcc09124a7fa9b89f2f1d", release_id="testrev", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiRelease.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_schema.py index 4351c5294187..e3e6fe582d0e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_schema.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_schema.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,14 +30,13 @@ def main(): subscription_id="subid", ) - response = client.api_schema.delete( + client.api_schema.delete( resource_group_name="rg1", service_name="apimService1", api_id="59d5b28d1f7fab116c282650", schema_id="59d5b28e1f7fab116402044e", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiSchema.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_tag.py index 72ebe4b5b87b..c948e711f62d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_tag.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_tag.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.tag.detach_from_api( + client.tag.detach_from_api( resource_group_name="rg1", service_name="apimService1", api_id="59d5b28d1f7fab116c282650", tag_id="59d5b28e1f7fab116402044e", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiTag.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_tag_description.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_tag_description.py index 7806815ae385..cddb3b56c747 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_tag_description.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_tag_description.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,14 +30,13 @@ def main(): subscription_id="subid", ) - response = client.api_tag_description.delete( + client.api_tag_description.delete( resource_group_name="rg1", service_name="apimService1", api_id="59d5b28d1f7fab116c282650", tag_description_id="59d5b28e1f7fab116402044e", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiTagDescription.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_version_set.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_version_set.py index 0e111d9e13bc..6b50c35a9e3f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_version_set.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_version_set.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.api_version_set.delete( + client.api_version_set.delete( resource_group_name="rg1", service_name="apimService1", version_set_id="a1", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiVersionSet.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_wiki.py index 78358be3727f..e52729d05db5 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_wiki.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_wiki.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.api_wiki.delete( + client.api_wiki.delete( resource_group_name="rg1", service_name="apimService1", api_id="57d1f7558aa04f15146d9d8a", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiWiki.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization.py index fda86e21e9e5..f5732609c933 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,14 +30,13 @@ def main(): subscription_id="subid", ) - response = client.authorization.delete( + client.authorization.delete( resource_group_name="rg1", service_name="apimService1", authorization_provider_id="aadwithauthcode", authorization_id="authz1", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteAuthorization.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_access_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_access_policy.py index 65e91a879e6a..95e849238c7a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_access_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_access_policy.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,7 +30,7 @@ def main(): subscription_id="subid", ) - response = client.authorization_access_policy.delete( + client.authorization_access_policy.delete( resource_group_name="rg1", service_name="apimService1", authorization_provider_id="aadwithauthcode", @@ -37,7 +38,6 @@ def main(): authorization_access_policy_id="fe0bed83-631f-4149-bd0b-0464b1bc7cab", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteAuthorizationAccessPolicy.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_provider.py index f464346a31bf..cc7a5fb19f6e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_provider.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_provider.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.authorization_provider.delete( + client.authorization_provider.delete( resource_group_name="rg1", service_name="apimService1", authorization_provider_id="aadwithauthcode", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteAuthorizationProvider.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_server.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_server.py index 19ed49dee3e1..d25e8269a16e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_server.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.authorization_server.delete( + client.authorization_server.delete( resource_group_name="rg1", service_name="apimService1", authsid="newauthServer2", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteAuthorizationServer.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_backend.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_backend.py index b35075299406..56494fb40d52 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_backend.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_backend.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.backend.delete( + client.backend.delete( resource_group_name="rg1", service_name="apimService1", backend_id="sfbackend", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteBackend.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_cache.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_cache.py index b2f812b814c1..f41a809feaef 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_cache.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_cache.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.cache.delete( + client.cache.delete( resource_group_name="rg1", service_name="apimService1", cache_id="southindia", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteCache.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_certificate.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_certificate.py index 064937131620..b5a2f695a547 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_certificate.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_certificate.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.certificate.delete( + client.certificate.delete( resource_group_name="rg1", service_name="apimService1", certificate_id="tempcert", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteCertificate.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_content_type.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_content_type.py index 8d5611b867aa..6aa6ad3d4f19 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_content_type.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_content_type.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.content_type.delete( + client.content_type.delete( resource_group_name="rg1", service_name="apimService1", content_type_id="page", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteContentType.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_content_type_content_item.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_content_type_content_item.py index e399366dc69d..0fcec8d006aa 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_content_type_content_item.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_content_type_content_item.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,14 +30,13 @@ def main(): subscription_id="subid", ) - response = client.content_item.delete( + client.content_item.delete( resource_group_name="rg1", service_name="apimService1", content_type_id="page", content_item_id="4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteContentTypeContentItem.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_diagnostic.py index fa47b92426c2..9c31ab72a752 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_diagnostic.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_diagnostic.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.diagnostic.delete( + client.diagnostic.delete( resource_group_name="rg1", service_name="apimService1", diagnostic_id="applicationinsights", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteDiagnostic.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_documentation.py similarity index 84% rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_api.py rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_documentation.py index 901172a34a39..e205a5b0b984 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_api.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_documentation.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-apimanagement # USAGE - python api_management_get_reports_by_api.py + python api_management_delete_documentation.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,15 +30,14 @@ def main(): subscription_id="subid", ) - response = client.reports.list_by_api( + client.documentation.delete( resource_group_name="rg1", service_name="apimService1", - filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'", + documentation_id="57d1f7558aa04f15146d9d8a", + if_match="*", ) - for item in response: - print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsByApi.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteDocumentation.json if __name__ == "__main__": main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway.py index ce562fe0bb28..77f01bb30929 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.gateway.delete( + client.gateway.delete( resource_group_name="rg1", service_name="apimService1", gateway_id="gw1", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteGateway.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_api.py index b3c82688efec..00f48c23f97c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_api.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_api.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.gateway_api.delete( + client.gateway_api.delete( resource_group_name="rg1", service_name="apimService1", gateway_id="gw1", api_id="echo-api", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteGatewayApi.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_certificate_authority.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_certificate_authority.py index 1f9bce046cee..866810f0f7ea 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_certificate_authority.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_certificate_authority.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,14 +30,13 @@ def main(): subscription_id="subid", ) - response = client.gateway_certificate_authority.delete( + client.gateway_certificate_authority.delete( resource_group_name="rg1", service_name="apimService1", gateway_id="gw1", certificate_id="default", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteGatewayCertificateAuthority.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_hostname_configuration.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_hostname_configuration.py index c535670c1dd0..972a4837e74c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_hostname_configuration.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_hostname_configuration.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,14 +30,13 @@ def main(): subscription_id="subid", ) - response = client.gateway_hostname_configuration.delete( + client.gateway_hostname_configuration.delete( resource_group_name="rg1", service_name="apimService1", gateway_id="gw1", hc_id="default", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteGatewayHostnameConfiguration.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_global_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_global_schema.py index 29d385eee68d..cab1d5a319a5 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_global_schema.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_global_schema.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.global_schema.delete( + client.global_schema.delete( resource_group_name="rg1", service_name="apimService1", schema_id="schema1", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteGlobalSchema.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver.py index 247cb77ab2b7..50c4c63ce963 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,14 +30,13 @@ def main(): subscription_id="subid", ) - response = client.graph_ql_api_resolver.delete( + client.graph_ql_api_resolver.delete( resource_group_name="rg1", service_name="apimService1", api_id="57d2ef278aa04f0888cba3f3", resolver_id="57d2ef278aa04f0ad01d6cdc", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteGraphQLApiResolver.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver_policy.py index 269ffc60fff2..b3b873fff3d1 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -29,7 +35,7 @@ def main(): subscription_id="subid", ) - response = client.graph_ql_api_resolver_policy.delete( + client.graph_ql_api_resolver_policy.delete( resource_group_name="rg1", service_name="apimService1", api_id="testapi", @@ -37,7 +43,6 @@ def main(): policy_id="policy", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteGraphQLApiResolverPolicy.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_group.py index 3baf4e23dba9..31ff1b1fe3dc 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_group.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.group.delete( + client.group.delete( resource_group_name="rg1", service_name="apimService1", group_id="aadGroup", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteGroup.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_group_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_group_user.py index 5a4fd00e38d6..bb43bfbb2f9d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_group_user.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_group_user.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.group_user.delete( + client.group_user.delete( resource_group_name="rg1", service_name="apimService1", group_id="templategroup", user_id="59307d350af58404d8a26300", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteGroupUser.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_identity_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_identity_provider.py index f13a68c26c46..c694ca5a7ba6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_identity_provider.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_identity_provider.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -29,13 +35,12 @@ def main(): subscription_id="subid", ) - response = client.identity_provider.delete( + client.identity_provider.delete( resource_group_name="rg1", service_name="apimService1", identity_provider_name="aad", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteIdentityProvider.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_logger.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_logger.py index 0a9d5fa23502..28317a5bfc68 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_logger.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_logger.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.logger.delete( + client.logger.delete( resource_group_name="rg1", service_name="apimService1", logger_id="loggerId", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteLogger.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_named_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_named_value.py index 6ef310657d43..f5c796873d3c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_named_value.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_named_value.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.named_value.delete( + client.named_value.delete( resource_group_name="rg1", service_name="apimService1", named_value_id="testprop2", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteNamedValue.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_notification_recipient_email.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_notification_recipient_email.py index bbaa6786d006..330851fa2b30 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_notification_recipient_email.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_notification_recipient_email.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -29,13 +35,12 @@ def main(): subscription_id="subid", ) - response = client.notification_recipient_email.delete( + client.notification_recipient_email.delete( resource_group_name="rg1", service_name="apimService1", notification_name="RequestPublisherNotificationMessage", email="contoso@live.com", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteNotificationRecipientEmail.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_notification_recipient_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_notification_recipient_user.py index 736f9c1b46c7..9a6b8e99742d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_notification_recipient_user.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_notification_recipient_user.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -29,13 +35,12 @@ def main(): subscription_id="subid", ) - response = client.notification_recipient_user.delete( + client.notification_recipient_user.delete( resource_group_name="rg1", service_name="apimService1", notification_name="RequestPublisherNotificationMessage", user_id="576823d0a40f7e74ec07d642", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteNotificationRecipientUser.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_open_id_connect_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_open_id_connect_provider.py index 6ddd1926e565..297712b1f5ea 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_open_id_connect_provider.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_open_id_connect_provider.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.open_id_connect_provider.delete( + client.open_id_connect_provider.delete( resource_group_name="rg1", service_name="apimService1", opid="templateOpenIdConnect3", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteOpenIdConnectProvider.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy.py index 9404ab237483..246c406b1791 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -29,13 +35,12 @@ def main(): subscription_id="subid", ) - response = client.policy.delete( + client.policy.delete( resource_group_name="rg1", service_name="apimService1", policy_id="policy", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeletePolicy.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy_fragment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy_fragment.py index 175224fc32cc..74851e77959b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy_fragment.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy_fragment.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.policy_fragment.delete( + client.policy_fragment.delete( resource_group_name="rg1", service_name="apimService1", id="policyFragment1", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeletePolicyFragment.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_private_endpoint_connection.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_private_endpoint_connection.py index 657cd5cc11da..fc164db00fd8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_private_endpoint_connection.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_private_endpoint_connection.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,12 +30,11 @@ def main(): subscription_id="subid", ) - response = client.private_endpoint_connection.begin_delete( + client.private_endpoint_connection.begin_delete( resource_group_name="rg1", service_name="apimService1", private_endpoint_connection_name="privateEndpointConnectionName", ).result() - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeletePrivateEndpointConnection.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product.py index bcfd154ca128..7e1ddaec2635 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.product.delete( + client.product.delete( resource_group_name="rg1", service_name="apimService1", product_id="testproduct", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteProduct.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_api.py index 6184b23a4d22..d97b1bba40d0 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_api.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_api.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.product_api.delete( + client.product_api.delete( resource_group_name="rg1", service_name="apimService1", product_id="testproduct", api_id="echo-api", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteProductApi.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_group.py index 88d23dd04e70..2e9f5b417a6e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_group.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.product_group.delete( + client.product_group.delete( resource_group_name="rg1", service_name="apimService1", product_id="testproduct", group_id="templateGroup", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteProductGroup.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_policy.py index 7d59fe657c96..874c469d4c5f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -29,14 +35,13 @@ def main(): subscription_id="subid", ) - response = client.product_policy.delete( + client.product_policy.delete( resource_group_name="rg1", service_name="apimService1", product_id="testproduct", policy_id="policy", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteProductPolicy.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_tag.py index 794355eb6152..0b12e0908788 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_tag.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_tag.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.tag.detach_from_product( + client.tag.detach_from_product( resource_group_name="rg1", service_name="apimService1", product_id="59d5b28d1f7fab116c282650", tag_id="59d5b28e1f7fab116402044e", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteProductTag.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_wiki.py index 362c57e670ba..8d69fbdad9b7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_wiki.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_wiki.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.product_wiki.delete( + client.product_wiki.delete( resource_group_name="rg1", service_name="apimService1", product_id="57d1f7558aa04f15146d9d8a", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteProductWiki.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_subscription.py index 1b6378e9d831..cabb2c534cc3 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_subscription.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.subscription.delete( + client.subscription.delete( resource_group_name="rg1", service_name="apimService1", sid="testsub", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteSubscription.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag.py index 4fc160714b00..7345d7055f2e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.tag.delete( + client.tag.delete( resource_group_name="rg1", service_name="apimService1", tag_id="tagId1", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteTag.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_template.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_template.py index 3a6973e2e7db..de0ce6f4a590 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_template.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_template.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -29,13 +35,12 @@ def main(): subscription_id="subid", ) - response = client.email_template.delete( + client.email_template.delete( resource_group_name="rg1", service_name="apimService1", template_name="newIssueNotificationMessage", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteTemplate.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_user.py index ad0b212e3e9c..91104a6c4bc1 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_user.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_user.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,13 +30,12 @@ def main(): subscription_id="subid", ) - response = client.user.delete( + client.user.delete( resource_group_name="rg1", service_name="apimService1", user_id="5931a75ae4bbd512288c680b", if_match="*", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteUser.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_deleted_services_list_by_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_deleted_services_list_by_subscription.py index 1afa288dbba0..ed919f3341fd 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_deleted_services_list_by_subscription.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_deleted_services_list_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_deleted_services_purge.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_deleted_services_purge.py index 8733ac654d62..06cd5675a080 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_deleted_services_purge.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_deleted_services_purge.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_generate_token.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_generate_token.py index fd749bc415dd..0de4c30147b6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_generate_token.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_generate_token.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_keys.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_keys.py index b79cc17505ee..6f684b85ba1a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_keys.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_keys.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_regenerate_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_regenerate_key.py index 3fdbe8cdf7b9..d8ca06e71e5a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_regenerate_key.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_regenerate_key.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ @@ -29,13 +32,12 @@ def main(): subscription_id="subid", ) - response = client.gateway.regenerate_key( + client.gateway.regenerate_key( resource_group_name="rg1", service_name="apimService1", gateway_id="gwId", parameters={"keyType": "primary"}, ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGatewayRegenerateKey.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_contract.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_contract.py index e25e5f5b8c67..8ee81c7656b4 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_contract.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_contract.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_diagnostic.py index ee0e3329be7f..2964b8c270c8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_diagnostic.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_diagnostic.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_export_in_open_api2dot0.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_export_in_open_api2dot0.py index 1b5c86209b6f..5e40f4521d23 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_export_in_open_api2dot0.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_export_in_open_api2dot0.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_export_in_open_api3dot0.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_export_in_open_api3dot0.py index 394a01f559e5..f3b9bccce595 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_export_in_open_api3dot0.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_export_in_open_api3dot0.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue.py index b9a83da56cba..96e02aee1f79 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue_attachment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue_attachment.py index d66b6211b9d3..2ddf67d2b24c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue_attachment.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue_attachment.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue_comment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue_comment.py index 4d9ee8faf668..a37524cc58d7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue_comment.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue_comment.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation.py index e31e44c23124..dc700cfa8f56 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_pet_store.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_pet_store.py index 885eacace5ea..908036d62923 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_pet_store.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_pet_store.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_policy.py index 420418157b38..25de9d95fe29 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_tag.py index 0f94b8f7babf..ddb5a13fd4a3 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_tag.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_tag.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_policy.py index 3790995d5f75..e0a7e30f5427 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_release.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_release.py index ccb1abf680ee..02614487f48d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_release.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_release.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_revision.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_revision.py index e6c70b6a1ded..41db9662047e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_revision.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_revision.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_schema.py index 69f23588adce..37912612399e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_schema.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_schema.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_tag.py index fe612a39de9f..2f4385e8cd49 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_tag.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_tag.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_tag_description.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_tag_description.py index 9968fe99f2d7..32e617f9d396 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_tag_description.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_tag_description.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_version_set.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_version_set.py index a5c52589869d..4bb0d23484a9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_version_set.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_version_set.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_wiki.py index a9e58a851c2f..29e84e21edc9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_wiki.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_wiki.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization.py index 9938fbe489b6..08d36cea5fed 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_access_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_access_policy.py index 889bd6c66525..495a8a8ae81e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_access_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_access_policy.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_login_request.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_login_request.py index 91a8679592a0..4dc17670ea5d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_login_request.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_login_request.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_provider.py index d2a635cd9367..9ea39097ab71 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_provider.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_provider.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_server.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_server.py index cdb52249df96..6affc8c4ebec 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_server.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_backend.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_backend.py index 02055b15dd11..444ff20108c4 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_backend.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_backend.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_cache.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_cache.py index a92a816552a7..2059cee7c260 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_cache.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_cache.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_certificate.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_certificate.py index 700e33b78d70..91e7c6b67ba3 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_certificate.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_certificate.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_certificate_with_key_vault.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_certificate_with_key_vault.py index 389f010be603..5e2dde379d7e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_certificate_with_key_vault.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_certificate_with_key_vault.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_content_type.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_content_type.py index c7f84ae2f14a..c4a2e511c263 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_content_type.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_content_type.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_content_type_content_item.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_content_type_content_item.py index ad7aeb998437..803cde0ee5e3 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_content_type_content_item.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_content_type_content_item.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_deleted_service_by_name.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_deleted_service_by_name.py index 9386293b9261..ae186cb7e7ba 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_deleted_service_by_name.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_deleted_service_by_name.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_diagnostic.py index 6a68e671fa7d..b630143394d4 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_diagnostic.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_diagnostic.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_documentation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_documentation.py index 0fc66abe3c3d..c49cdbe4b441 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_documentation.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_documentation.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway.py index 67a57f377667..9a3bd49a369d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_certificate_authority.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_certificate_authority.py index 1fc4568d34e4..b00c32221a67 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_certificate_authority.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_certificate_authority.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_hostname_configuration.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_hostname_configuration.py index 027d3acf1944..d24d55c66755 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_hostname_configuration.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_hostname_configuration.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema1.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema1.py index 40d620878fb0..c889aa01b480 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema1.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema1.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema2.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema2.py index a3ac221911f4..3f052c323de3 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema2.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema2.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver.py index ef827021ec25..5116772f83da 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver_policy.py index 7c1cf4ce63a4..cd11ba532dd6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_group.py index 6ee0505371c5..0d89263d91f1 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_group.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_identity_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_identity_provider.py index 3b5c84ee7b0f..09e7f6d9c4b3 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_identity_provider.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_identity_provider.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_issue.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_issue.py index 16a3c0c19d91..8c040c16e68f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_issue.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_issue.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_logger.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_logger.py index 5627e38da3de..f6f4e24c9d4a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_logger.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_logger.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_named_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_named_value.py index 6c92ec253e56..176e4d9fe2c7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_named_value.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_named_value.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_named_value_with_key_vault.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_named_value_with_key_vault.py index b4d73eae42a5..5712f4498e3a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_named_value_with_key_vault.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_named_value_with_key_vault.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_notification.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_notification.py index b1bd321e778c..e6fead4414bb 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_notification.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_notification.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_open_id_connect_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_open_id_connect_provider.py index d3b1fe5bac7a..423019a12081 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_open_id_connect_provider.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_open_id_connect_provider.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy.py index 61a9f87a0c59..e612230cf757 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_format.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_format.py index 06992cffd8f9..12a600ddbdc8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_format.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_format.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment.py index b1dbfa25095d..533027279d66 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment_format.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment_format.py index a83da3f0b53e..b9546109675a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment_format.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment_format.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_portal_revision.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_portal_revision.py index ca15c2610f31..45dfbfdffd76 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_portal_revision.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_portal_revision.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_private_endpoint_connection.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_private_endpoint_connection.py index c15b7e16d1b4..8e29d2e0b881 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_private_endpoint_connection.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_private_endpoint_connection.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_private_link_group_resource.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_private_link_group_resource.py index b68af6008f97..eb867e0cd4ea 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_private_link_group_resource.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_private_link_group_resource.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product.py index fd7ccc52f9d1..4344d348dc72 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_policy.py index 4a4ceb3bbb7b..a3e668e5dc6c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_tag.py index 8e57d00a14b6..714e96baa7dc 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_tag.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_tag.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_wiki.py index 8a5765a19842..75f97bdb7608 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_wiki.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_wiki.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_quota_counter_keys.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_quota_counter_keys.py index aafc467b3547..61f0b35132ae 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_quota_counter_keys.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_quota_counter_keys.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_quota_counter_keys_by_quota_period.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_quota_counter_keys_by_quota_period.py index 325aaae9f834..a14df6e14f5a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_quota_counter_keys_by_quota_period.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_quota_counter_keys_by_quota_period.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_geo.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_geo.py deleted file mode 100644 index 40167add3648..000000000000 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_geo.py +++ /dev/null @@ -1,43 +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.apimanagement import ApiManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-apimanagement -# USAGE - python api_management_get_reports_by_geo.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 = ApiManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.reports.list_by_geo( - resource_group_name="rg1", - service_name="apimService1", - filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsByGeo.json -if __name__ == "__main__": - main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_operation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_operation.py deleted file mode 100644 index a98babd79de4..000000000000 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_operation.py +++ /dev/null @@ -1,43 +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.apimanagement import ApiManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-apimanagement -# USAGE - python api_management_get_reports_by_operation.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 = ApiManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.reports.list_by_operation( - resource_group_name="rg1", - service_name="apimService1", - filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsByOperation.json -if __name__ == "__main__": - main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_product.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_product.py deleted file mode 100644 index 3c5db9edee1c..000000000000 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_product.py +++ /dev/null @@ -1,43 +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.apimanagement import ApiManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-apimanagement -# USAGE - python api_management_get_reports_by_product.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 = ApiManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.reports.list_by_product( - resource_group_name="rg1", - service_name="apimService1", - filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsByProduct.json -if __name__ == "__main__": - main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_request.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_request.py deleted file mode 100644 index 3f66b9b7c6f5..000000000000 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_request.py +++ /dev/null @@ -1,43 +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.apimanagement import ApiManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-apimanagement -# USAGE - python api_management_get_reports_by_request.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 = ApiManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.reports.list_by_request( - resource_group_name="rg1", - service_name="apimService1", - filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsByRequest.json -if __name__ == "__main__": - main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_subscription.py deleted file mode 100644 index 5f041ecd09f9..000000000000 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_subscription.py +++ /dev/null @@ -1,43 +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.apimanagement import ApiManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-apimanagement -# USAGE - python api_management_get_reports_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 = ApiManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.reports.list_by_subscription( - resource_group_name="rg1", - service_name="apimService1", - filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_user.py deleted file mode 100644 index 72a9f8525676..000000000000 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_user.py +++ /dev/null @@ -1,43 +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.apimanagement import ApiManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-apimanagement -# USAGE - python api_management_get_reports_by_user.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 = ApiManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.reports.list_by_user( - resource_group_name="rg1", - service_name="apimService1", - filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsByUser.json -if __name__ == "__main__": - main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_subscription.py index 9c7333f36351..4ec7c62ac178 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_subscription.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tag.py index 2024e3638c58..304f4ec47d3f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tag.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tag.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_template.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_template.py index 20d4484f9d90..9c3a204d67f4 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_template.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_template.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_access.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_access.py index 086a3df90aef..842d3d94bb27 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_access.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_access.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_git_access.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_git_access.py index 8e66129ddcdd..0d9f70892ff5 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_git_access.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_git_access.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_settings.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_settings.py index 29efeea62c6c..ccd5bcdef0a8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_settings.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_settings.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_user.py index eb04bd44a98e..5b147fe993e8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_user.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_user.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_user_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_user_subscription.py index d0c7acfc7ef2..c9c15c2c77cd 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_user_subscription.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_user_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api.py index c3e21976fff6..fa6a8254731f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_diagnostic.py index f6853a879692..69e3d19e16a4 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_diagnostic.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_diagnostic.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue.py index b09689dce42f..e14412375162 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue_attachment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue_attachment.py index 96dadb477371..dd109e0acd9d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue_attachment.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue_attachment.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue_comment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue_comment.py index 1aaf883f4cae..0697ddcf1a14 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue_comment.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue_comment.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation.py index 8de3881349a5..17b92ca7768b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation_policy.py index ba35eea190d0..823e15e466f5 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation_tag.py index fdb59e274979..0abd86a040d2 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation_tag.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation_tag.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_policy.py index 5b341c9e558f..75c6a181138a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_release.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_release.py index 7a295bbb287e..21010d3f5c22 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_release.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_release.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_schema.py index e65d902f7809..bb17e74b3501 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_schema.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_schema.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_tag.py index 51882e1cee82..59b2f956fcc6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_tag.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_tag.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_tag_description.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_tag_description.py index 54a154533db1..f7a78ea3b0ce 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_tag_description.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_tag_description.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_version_set.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_version_set.py index bab6a3917883..426a77bda173 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_version_set.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_version_set.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_wiki.py index 491b0bcd8964..913a51103a25 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_wiki.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_wiki.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_authorization_server.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_authorization_server.py index b1809292f3f6..a381f0f36882 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_authorization_server.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_authorization_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_backend.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_backend.py index 0cb33535c357..83168b195f87 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_backend.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_backend.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_cache.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_cache.py index d25da5d41ead..33ed80ec6736 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_cache.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_cache.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_certificate.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_certificate.py index c2f961530bbb..1c6fef00183e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_certificate.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_certificate.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_content_type_content_item.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_content_type_content_item.py index 28511033a9f0..1fb26995b567 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_content_type_content_item.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_content_type_content_item.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_delegation_settings.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_delegation_settings.py index 20fa54441574..07e61eb3e26a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_delegation_settings.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_delegation_settings.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_diagnostic.py index f50f609a11c8..e0ff879c0cd0 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_diagnostic.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_diagnostic.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_documentation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_documentation.py index 2d3e2d56b1f7..4859e3c3ed1c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_documentation.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_documentation.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_email_template.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_email_template.py index 683406ab8542..c23c8798a09e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_email_template.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_email_template.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway.py index e8c73a200e73..fc825ecd2701 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_api.py index 92eee59fa5bf..0b5d95a30e50 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_api.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_api.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_certificate_authority.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_certificate_authority.py index 5dfd6d48d76c..c39349f69bc3 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_certificate_authority.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_certificate_authority.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_hostname_configuration.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_hostname_configuration.py index 3c5cefacfd4a..bd2985e38370 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_hostname_configuration.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_hostname_configuration.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_global_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_global_schema.py index df221d7b2559..73b5e9a755e0 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_global_schema.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_global_schema.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver.py index d017f86adca6..8d3a703f247d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver_policy.py index 68a48b00da7c..b59b6c16f3d6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_group.py index 507d1a2eff3f..09d777bbe89d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_group.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_group_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_group_user.py index fe1f24b1abfe..680f91adbf03 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_group_user.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_group_user.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_identity_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_identity_provider.py index 43167728061a..6f1a1e326fbc 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_identity_provider.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_identity_provider.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_logger.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_logger.py index 6c9520e0ee15..d5df7d5035c9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_logger.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_logger.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_named_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_named_value.py index 4845de1461f6..308ae8c661d9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_named_value.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_named_value.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_notification_recipient_email.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_notification_recipient_email.py index 436e526ae98d..22c3a914e3bc 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_notification_recipient_email.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_notification_recipient_email.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_notification_recipient_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_notification_recipient_user.py index 61ec1ff34059..2d351234745b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_notification_recipient_user.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_notification_recipient_user.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_open_id_connect_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_open_id_connect_provider.py index 6a2f9aca60e7..a2b5a4dd1e7e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_open_id_connect_provider.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_open_id_connect_provider.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy.py index f3bc93e3057d..a0f21c9c33de 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy_fragment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy_fragment.py index 98965d38f1ed..f5199c4e62a8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy_fragment.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy_fragment.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_config.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_config.py index 374abe53354c..d76e767552f6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_config.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_config.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_revision.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_revision.py index 5989b13a4cac..6d5884bf6a1e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_revision.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_revision.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product.py index 051e6364f329..8128364c4409 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_api.py index 3f2ec26f474a..5d2984ffdd3f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_api.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_api.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_group.py index 2ecd925a3493..b5f96211110f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_group.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_policy.py index 995fbb685c35..e0fbf44a6d74 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_policy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_policy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_tag.py index e16c4e1fa672..5b579233fa9e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_tag.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_tag.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_wiki.py index 7ff34f879393..f477a3200d8a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_wiki.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_wiki.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_sign_in_settings.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_sign_in_settings.py index 4b26a849e37c..10568a84d4fb 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_sign_in_settings.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_sign_in_settings.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_sign_up_settings.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_sign_up_settings.py index 63e62f56645d..cf1fe60a58b2 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_sign_up_settings.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_sign_up_settings.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_subscription.py index e7055ec652e9..7483cf7c7da2 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_subscription.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_tag.py index 9c4f84bfadc7..fae18a63cb73 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_tag.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_tag.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_tenant_access.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_tenant_access.py index 1ce265cb23a0..fb0021a39194 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_tenant_access.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_tenant_access.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_user.py index 30b36bd733aa..b0c1433401bd 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_user.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_user.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_identity_provider_list_secrets.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_identity_provider_list_secrets.py index e90e23a822b9..2facc7fa8b1d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_identity_provider_list_secrets.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_identity_provider_list_secrets.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_diagnostics.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_diagnostics.py index e9233dc28006..d6c4afa765b8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_diagnostics.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_diagnostics.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issue_attachments.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issue_attachments.py index 5c22ade28157..028f3e5bb69f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issue_attachments.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issue_attachments.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issue_comments.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issue_comments.py index 010d320189d1..0613ed9f7d33 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issue_comments.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issue_comments.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issues.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issues.py index 27450f00decd..507dd5fb22d6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issues.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issues.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operation_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operation_policies.py index 935631678d41..0a9a739bcd87 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operation_policies.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operation_policies.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operation_tags.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operation_tags.py index fb3eb97062e9..d723bb3acc6c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operation_tags.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operation_tags.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operations.py index 92a727154304..4275c1480ef0 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operations.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operations_by_tags.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operations_by_tags.py index bd91a2e56d6a..2f23352f070a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operations_by_tags.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operations_by_tags.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_policies.py index 106dbc9e10f7..3516735fc869 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_policies.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_policies.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_products.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_products.py index 1a9f3ce93f95..e3a930d3935f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_products.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_products.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_releases.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_releases.py index f3b7e604d000..4b15b94f61f6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_releases.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_releases.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_revisions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_revisions.py index 30c305a60619..2dfa6ea8936e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_revisions.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_revisions.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_schemas.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_schemas.py index e920a7aea449..24d01b4f258e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_schemas.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_schemas.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_tag_descriptions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_tag_descriptions.py index 74d2be8c8f9d..7f53ed059ba6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_tag_descriptions.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_tag_descriptions.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_tags.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_tags.py index 006206d9e155..98a1c2650fcb 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_tags.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_tags.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_version_sets.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_version_sets.py index 26d7a2f8a94f..a2f2e10543f8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_version_sets.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_version_sets.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_wikis.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_wikis.py index ca761388d06c..c7cb321df789 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_wikis.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_wikis.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_apis.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_apis.py index e632fc01bee1..f9ba5a26426c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_apis.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_apis.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_apis_by_tags.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_apis_by_tags.py index 6753273b2a29..f6c0cd1bf76e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_apis_by_tags.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_apis_by_tags.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_access_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_access_policies.py index 18d1454074c0..ba363ea0c34a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_access_policies.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_access_policies.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_providers.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_providers.py index b14b75503202..93418ac79c06 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_providers.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_providers.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_servers.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_servers.py index f1fa7c7091a6..4943108d1217 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_servers.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_servers.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_auth_code.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_auth_code.py index 9db399131515..ad94b6768796 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_auth_code.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_auth_code.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_client_cred.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_client_cred.py index 652d74a41524..b9c47bc05a41 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_client_cred.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_client_cred.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_backends.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_backends.py index 3a8a8a266739..4fc8de14793b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_backends.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_backends.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_caches.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_caches.py index 69ad04bac9db..c864c34d5eb9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_caches.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_caches.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_certificates.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_certificates.py index 90e4a2f5b79a..62fa790b46f6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_certificates.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_certificates.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_content_type_content_items.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_content_type_content_items.py index e7cbcb00e20c..ae309fcc4a3e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_content_type_content_items.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_content_type_content_items.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_content_types.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_content_types.py index 5c86b9c9328b..e142b2f6d775 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_content_types.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_content_types.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_diagnostics.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_diagnostics.py index 9c7e8d5fde15..843a6f2ecaef 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_diagnostics.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_diagnostics.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_documentations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_documentations.py index 3025ab27f4a2..043faf3f6374 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_documentations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_documentations.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_apis.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_apis.py index 3cfa7e4b62e9..b18adfe2501f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_apis.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_apis.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_certificate_authorities.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_certificate_authorities.py index b9a737bd58f2..aecf4e7e8b8c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_certificate_authorities.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_certificate_authorities.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_hostname_configurations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_hostname_configurations.py index 8d9f987a4f3c..560f429c02c4 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_hostname_configurations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_hostname_configurations.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateways.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateways.py index 6ab0b300eb04..9a3f528f6656 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateways.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateways.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_global_schemas.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_global_schemas.py index 7b92757644fb..f5bfb7b8c982 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_global_schemas.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_global_schemas.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolver_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolver_policies.py index 5932847c31e9..6abd7a04e8c6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolver_policies.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolver_policies.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolvers.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolvers.py index 87617f762c73..8897ad268cc5 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolvers.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolvers.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_group_users.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_group_users.py index fda067f5af64..4c021fed8439 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_group_users.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_group_users.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_groups.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_groups.py index db60101580b0..661f1ec95acf 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_groups.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_groups.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_identity_providers.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_identity_providers.py index e0ff482191f0..e9d72323e070 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_identity_providers.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_identity_providers.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_issues.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_issues.py index 028b9195ed80..51f1d04ba246 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_issues.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_issues.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_loggers.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_loggers.py index 586ec0384a4f..f124c45afd6b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_loggers.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_loggers.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_named_values.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_named_values.py index 6820032e047a..667b22252747 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_named_values.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_named_values.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notification_recipient_emails.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notification_recipient_emails.py index 47a000ce2169..a81cefe332df 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notification_recipient_emails.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notification_recipient_emails.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notification_recipient_users.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notification_recipient_users.py index 0dfee09c05b1..857fdde80535 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notification_recipient_users.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notification_recipient_users.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notifications.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notifications.py index 07f4b3f1f1da..c6e56444c48a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notifications.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notifications.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_open_id_connect_providers.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_open_id_connect_providers.py index d2ca904c7c81..dcc745d70599 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_open_id_connect_providers.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_open_id_connect_providers.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_operations.py index 334c9ad40228..8e82f9843f5d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_operations.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policies.py index 2847762299ff..b30b3adebfca 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policies.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policies.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_descriptions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_descriptions.py index c9e1b488bd57..eeec296c3f1d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_descriptions.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_descriptions.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragment_references.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragment_references.py index 458ebc654fb9..6b863fbd68d5 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragment_references.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragment_references.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragments.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragments.py index cff7720f3348..7b8cd130d0fc 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragments.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragments.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_config.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_config.py index eec36b1a63b9..3885112fca62 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_config.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_config.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_revisions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_revisions.py index 17d50f2ffebb..355335282beb 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_revisions.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_revisions.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_settings.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_settings.py index 04909492f7ec..bfc3ef7b3e5b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_settings.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_settings.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_private_endpoint_connections.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_private_endpoint_connections.py index 2f76ad8ec0ea..d722e2f97adf 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_private_endpoint_connections.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_private_endpoint_connections.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_private_link_group_resources.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_private_link_group_resources.py index e134c7bb37b5..8b8351a061ce 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_private_link_group_resources.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_private_link_group_resources.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_apis.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_apis.py index 80bc2538664d..477e31e770f2 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_apis.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_apis.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_groups.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_groups.py index 3580e5aebbfb..01ba6e480e8d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_groups.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_groups.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_policies.py index e347bd5dce93..bff1ec50602a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_policies.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_policies.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_subscriptions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_subscriptions.py index 33b82741e99e..1d807a54e9fe 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_subscriptions.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_subscriptions.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_tags.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_tags.py index 2706dd77b789..710eeb77155e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_tags.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_tags.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_wikis.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_wikis.py index 4561d72abd55..581fc5edceaf 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_wikis.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_wikis.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_products.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_products.py index 6f1f36d17879..22fb48f53ec8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_products.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_products.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_products_by_tags.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_products_by_tags.py index 72fd6a36a6b2..5a9b7fb28701 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_products_by_tags.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_products_by_tags.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_regions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_regions.py index 11b94e6aac3b..4e3232ae12e3 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_regions.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_regions.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_portal_settings_validation_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_portal_settings_validation_key.py index a14c9047c307..75a8d6c38bba 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_portal_settings_validation_key.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_portal_settings_validation_key.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_tenant_access.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_tenant_access.py index 1451741bd992..8682f45bccd8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_tenant_access.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_tenant_access.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_service_by_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_service_by_subscription.py index e0a56998d27d..a9d5afd6db14 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_service_by_subscription.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_service_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_service_by_subscription_and_resource_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_service_by_subscription_and_resource_group.py index 2958214db4ff..3f4c2440800f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_service_by_subscription_and_resource_group.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_service_by_subscription_and_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_consumption.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_consumption.py index 7d854ceb5f05..d06fb654424c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_consumption.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_consumption.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_dedicated.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_dedicated.py index 5202121663a8..b3e7739ec54f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_dedicated.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_dedicated.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sku.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sku.py index 3acfe06bb65b..06fb9533d258 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sku.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sku.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_subscriptions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_subscriptions.py index ebfa1b3e0617..02487b52d022 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_subscriptions.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_subscriptions.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_resources.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_resources.py index 40d99838501e..579d68457051 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_resources.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_resources.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tags.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tags.py index ed3434dab130..91997d0255df 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tags.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tags.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_templates.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_templates.py index 204ee36e7639..234d61d90900 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_templates.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_templates.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tenant_access.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tenant_access.py index bab572fc3ad2..221c8e8cde75 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tenant_access.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tenant_access.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tenant_settings.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tenant_settings.py index a83d11e492e9..85bf6cadb679 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tenant_settings.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tenant_settings.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_groups.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_groups.py index 16faf0b19a45..25d259a6dce7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_groups.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_groups.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_identities.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_identities.py index 5ad428e274fc..5252b1600ef7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_identities.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_identities.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_subscriptions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_subscriptions.py index 54d898e2ecc9..d3dd965a0c6d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_subscriptions.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_subscriptions.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_users.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_users.py index f22a5daac334..9f381fda1fae 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_users.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_users.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_named_value_list_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_named_value_list_value.py index 181e511138ee..ee150813cbe9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_named_value_list_value.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_named_value_list_value.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_openid_connect_provider_list_secrets.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_openid_connect_provider_list_secrets.py index 4c883d34b6ff..bfbd905300d1 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_openid_connect_provider_list_secrets.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_openid_connect_provider_list_secrets.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check.py index f9e6de57dda9..a00b17845dfb 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check_http_connect.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check_http_connect.py index 2e5487f1d464..cffdc12330b1 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check_http_connect.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check_http_connect.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_config.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_config.py index 0cf3ef961fe8..568b208200a4 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_config.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_config.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_delegation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_delegation.py index 0bb7926b93ee..66df4dc06092 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_delegation.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_delegation.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_sign_in.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_sign_in.py index 7a460eeef162..3c9c2cc22fe7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_sign_in.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_sign_in.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_sign_up.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_sign_up.py index bf87af0132e6..86c8505d0d81 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_sign_up.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_sign_up.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_delegation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_delegation.py index 836caa935968..bd3604e4d281 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_delegation.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_delegation.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_in.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_in.py index c4b8ec30d35c..5201e8aeee9f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_in.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_in.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_up.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_up.py index d6af16ac902f..9f5e9b15ff25 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_up.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_up.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_delegation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_delegation.py index fa343331299c..ea3c96d72e5d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_delegation.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_delegation.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ @@ -29,7 +32,7 @@ def main(): subscription_id="subid", ) - response = client.delegation_settings.update( + client.delegation_settings.update( resource_group_name="rg1", service_name="apimService1", if_match="*", @@ -42,7 +45,6 @@ def main(): } }, ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementPortalSettingsUpdateDelegation.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_sign_in.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_sign_in.py index e9c6e7a71313..f913bc93247d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_sign_in.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_sign_in.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ @@ -29,13 +32,12 @@ def main(): subscription_id="subid", ) - response = client.sign_in_settings.update( + client.sign_in_settings.update( resource_group_name="rg1", service_name="apimService1", if_match="*", parameters={"properties": {"enabled": True}}, ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementPortalSettingsUpdateSignIn.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_sign_up.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_sign_up.py index bb38ff1d97bb..69879e9eca16 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_sign_up.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_sign_up.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ @@ -29,7 +32,7 @@ def main(): subscription_id="subid", ) - response = client.sign_up_settings.update( + client.sign_up_settings.update( resource_group_name="rg1", service_name="apimService1", if_match="*", @@ -40,7 +43,6 @@ def main(): } }, ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementPortalSettingsUpdateSignUp.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_post_authorization_confirm_consent_code_request.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_post_authorization_confirm_consent_code_request.py index cb1eeb5d1fdb..328d4118b451 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_post_authorization_confirm_consent_code_request.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_post_authorization_confirm_consent_code_request.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ @@ -29,14 +32,13 @@ def main(): subscription_id="subid", ) - response = client.authorization.confirm_consent_code( + client.authorization.confirm_consent_code( resource_group_name="rg1", service_name="apimService1", authorization_provider_id="aadwithauthcode", authorization_id="authz1", parameters={"consentCode": "theconsentcode"}, ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementPostAuthorizationConfirmConsentCodeRequest.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_certificate.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_certificate.py index 26dcbc69c449..71ef66240ab9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_certificate.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_certificate.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_named_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_named_value.py index f540097f24a9..196df23c39fd 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_named_value.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_named_value.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_restore_with_access_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_restore_with_access_key.py index d3d91a4d2d03..62b9421f8b7b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_restore_with_access_key.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_restore_with_access_key.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_check_name_availability.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_check_name_availability.py index c018027d71c0..785a1a061d70 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_check_name_availability.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_check_name_availability.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_delete_service.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_delete_service.py index 1caa8972fdc1..c32838512adb 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_delete_service.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_delete_service.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_domain_ownership_identifier.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_domain_ownership_identifier.py index b600069da252..cfe6ebb855fd 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_domain_ownership_identifier.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_domain_ownership_identifier.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_multi_region_internal_vnet.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_multi_region_internal_vnet.py index deb63159b553..0286e7688534 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_multi_region_internal_vnet.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_multi_region_internal_vnet.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_network_status.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_network_status.py index 712e80cd0de8..19fb9e874cbe 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_network_status.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_network_status.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_network_status_by_location.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_network_status_by_location.py index a4f104f0038a..db1a19e8aecb 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_network_status_by_location.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_network_status_by_location.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_outbound_network_dependencies_endpoints.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_outbound_network_dependencies_endpoints.py index b8b4673865b8..2ef99964f378 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_outbound_network_dependencies_endpoints.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_outbound_network_dependencies_endpoints.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_service.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_service.py index fc367c2d56d6..4b348f451501 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_service.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_service.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_service_having_msi.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_service_having_msi.py index 60cc541d8120..f71ada140d68 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_service_having_msi.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_service_having_msi.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_sso_token.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_sso_token.py index 9770821a13a5..d18ef5c92432 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_sso_token.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_sso_token.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_migrate_to_stv2.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_migrate_to_stv2.py index 80b0d22d08c3..0e114621f095 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_migrate_to_stv2.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_migrate_to_stv2.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_list_secrets.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_list_secrets.py index 8910b7c11cc0..f5c18fc448cc 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_list_secrets.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_list_secrets.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_regenerate_primary_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_regenerate_primary_key.py index 373a41990c71..fa5212a2d339 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_regenerate_primary_key.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_regenerate_primary_key.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,12 +30,11 @@ def main(): subscription_id="subid", ) - response = client.subscription.regenerate_primary_key( + client.subscription.regenerate_primary_key( resource_group_name="rg1", service_name="apimService1", sid="testsub", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementSubscriptionRegeneratePrimaryKey.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_regenerate_secondary_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_regenerate_secondary_key.py index 0408e6cf0244..7ebcded6051f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_regenerate_secondary_key.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_regenerate_secondary_key.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,12 +30,11 @@ def main(): subscription_id="subid", ) - response = client.subscription.regenerate_secondary_key( + client.subscription.regenerate_secondary_key( resource_group_name="rg1", service_name="apimService1", sid="testsub", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementSubscriptionRegenerateSecondaryKey.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_access_regenerate_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_access_regenerate_key.py index c230d9014d9f..c23d7ebb6c38 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_access_regenerate_key.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_access_regenerate_key.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -29,12 +35,11 @@ def main(): subscription_id="subid", ) - response = client.tenant_access.regenerate_primary_key( + client.tenant_access.regenerate_primary_key( resource_group_name="rg1", service_name="apimService1", access_name="access", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementTenantAccessRegenerateKey.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_access_sync_state.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_access_sync_state.py index 4dbbe0d11dd9..38c4303f235e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_access_sync_state.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_access_sync_state.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_deploy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_deploy.py index 538a36da647c..a17270a566d3 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_deploy.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_deploy.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_save.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_save.py index ad439455703f..df73ed1b62c8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_save.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_save.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_validate.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_validate.py index 27a1ca7059fa..425a450ba2aa 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_validate.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_validate.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_undelete.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_undelete.py index 643644263ef3..93b98fb0578b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_undelete.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_undelete.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api.py index 06a50138df19..b62387ff8821 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_diagnostic.py index c4235628888f..2dec0448301d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_diagnostic.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_diagnostic.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_issue.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_issue.py index 99a8f152c627..0309355512f9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_issue.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_issue.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_operation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_operation.py index 58cbf8513bb7..1cad1761aafe 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_operation.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_operation.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_release.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_release.py index 65b8181ae6b8..a05713216f09 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_release.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_release.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_version_set.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_version_set.py index fc2a38fb5601..f89a94dd896d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_version_set.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_version_set.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_wiki.py index 8da01ef042dc..41b37f6ef724 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_wiki.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_wiki.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_authorization_server.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_authorization_server.py index ab534aec7869..2df826b576f2 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_authorization_server.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_authorization_server.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_backend.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_backend.py index 59c42e08af73..f2fff34cdfe5 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_backend.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_backend.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_cache.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_cache.py index 50cbc523353f..f79f8bddb287 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_cache.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_cache.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_diagnostic.py index 30f3803cc406..63676dc5cf4e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_diagnostic.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_diagnostic.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_time.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_documentation.py similarity index 80% rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_time.py rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_documentation.py index 265f9205ce74..577231e635df 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_time.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_documentation.py @@ -6,9 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import isodate +from typing import Any, IO, Union from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -16,7 +17,7 @@ pip install azure-identity pip install azure-mgmt-apimanagement # USAGE - python api_management_get_reports_by_time.py + python api_management_update_documentation.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, @@ -31,16 +32,16 @@ def main(): subscription_id="subid", ) - response = client.reports.list_by_time( + response = client.documentation.update( resource_group_name="rg1", service_name="apimService1", - filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'", - interval=isodate.parse_duration("PT15M"), + documentation_id="57d1f7558aa04f15146d9d8a", + if_match="*", + parameters={"properties": {"content": "content updated", "title": "Title updated"}}, ) - for item in response: - print(item) + print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsByTime.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateDocumentation.json if __name__ == "__main__": main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_gateway.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_gateway.py index 12d74da6d9e6..053bb01128cf 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_gateway.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_gateway.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_graph_ql_api_resolver.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_graph_ql_api_resolver.py index 5ef0f005bf4f..98a4a2a40682 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_graph_ql_api_resolver.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_graph_ql_api_resolver.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_group.py index dd345ac049ee..f6aad0a5b93a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_group.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_group.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_identity_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_identity_provider.py index 70c3bcd462b3..b809574021ec 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_identity_provider.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_identity_provider.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_logger.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_logger.py index c69c7af8e261..43e8b40b5055 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_logger.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_logger.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_named_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_named_value.py index 98206d0fbfa9..41f520132d27 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_named_value.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_named_value.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_open_id_connect_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_open_id_connect_provider.py index 74b4337436f9..7caf92e028e4 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_open_id_connect_provider.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_open_id_connect_provider.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_config.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_config.py index 5ef974ca315e..a14363c85eef 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_config.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_config.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_revision.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_revision.py index 99cac2b865c4..0db619110fb6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_revision.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_revision.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_product.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_product.py index 452f6e556670..5e850cf34b59 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_product.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_product.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_product_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_product_wiki.py index 11b01b730c7d..cbbb850f1197 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_product_wiki.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_product_wiki.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_quota_counter_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_quota_counter_key.py index c974e955ad4b..ac1e33c817f2 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_quota_counter_key.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_quota_counter_key.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_quota_counter_key_by_quota_period.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_quota_counter_key_by_quota_period.py index 27a0c558654e..5fd6073a3122 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_quota_counter_key_by_quota_period.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_quota_counter_key_by_quota_period.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_disable_tls10.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_disable_tls10.py index 6beed90f631c..1aaa74b23e27 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_disable_tls10.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_disable_tls10.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_publisher_details.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_publisher_details.py index f395cc165bd9..1c62a6e4f282 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_publisher_details.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_publisher_details.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_to_new_vnet_and_azs.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_to_new_vnet_and_azs.py index a0dbc08f4411..7e8ead831050 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_to_new_vnet_and_azs.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_to_new_vnet_and_azs.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_subscription.py index cc00f2191a52..9a90e26e9643 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_subscription.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_subscription.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_tag.py index d2a5cae36cb2..b483ffebed26 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_tag.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_tag.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_template.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_template.py index 53b6a2858fe9..1ab5da896e91 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_template.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_template.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_tenant_access.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_tenant_access.py index ce4ff5932a7e..793ea5bfe6fe 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_tenant_access.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_tenant_access.py @@ -6,9 +6,15 @@ # 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.apimanagement import ApiManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_user.py index 8da61180f776..20dd7fbfd2da 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_user.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_user.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_confirmation_password_send.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_confirmation_password_send.py index 793650579dac..3a602061d599 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_confirmation_password_send.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_confirmation_password_send.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ @@ -29,12 +30,11 @@ def main(): subscription_id="subid", ) - response = client.user_confirmation_password.send( + client.user_confirmation_password.send( resource_group_name="rg1", service_name="apimService1", user_id="57127d485157a511ace86ae7", ) - print(response) # x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUserConfirmationPasswordSend.json diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_generate_sso_url.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_generate_sso_url.py index c7a175e76d53..f5075a26f8f9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_generate_sso_url.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_generate_sso_url.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_token.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_token.py index 76c6feddf22b..83df805dfc9c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_token.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_token.py @@ -6,7 +6,10 @@ # 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.apimanagement import ApiManagementClient """ diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/sdk_packaging.toml b/sdk/apimanagement/azure-mgmt-apimanagement/sdk_packaging.toml index d98bf87212b6..6cecfcf96902 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/sdk_packaging.toml +++ b/sdk/apimanagement/azure-mgmt-apimanagement/sdk_packaging.toml @@ -3,7 +3,7 @@ package_name = "azure-mgmt-apimanagement" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "API Management" package_doc_id = "" -is_stable = false +is_stable = true is_arm = true sample_link = "" title = "ApiManagementClient" diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/setup.py b/sdk/apimanagement/azure-mgmt-apimanagement/setup.py index e7f07d182520..ba273ae4e388 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/setup.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/setup.py @@ -1,10 +1,10 @@ #!/usr/bin/env python -#------------------------------------------------------------------------- +# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import re import os.path @@ -16,64 +16,67 @@ PACKAGE_PPRINT_NAME = "API Management" # a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace('-', '/') +package_folder_path = PACKAGE_NAME.replace("-", "/") # a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace('-', '.') +namespace_name = PACKAGE_NAME.replace("-", ".") # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py') - if os.path.exists(os.path.join(package_folder_path, 'version.py')) - else os.path.join(package_folder_path, '_version.py'), 'r') as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', - fd.read(), re.MULTILINE).group(1) +with open( + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py"), + "r", +) as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) if not version: - raise RuntimeError('Cannot find version information') + raise RuntimeError("Cannot find version information") -with open('README.md', encoding='utf-8') as f: +with open("README.md", encoding="utf-8") as f: readme = f.read() -with open('CHANGELOG.md', encoding='utf-8') as f: +with open("CHANGELOG.md", encoding="utf-8") as f: changelog = f.read() setup( name=PACKAGE_NAME, version=version, - description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), - long_description=readme + '\n\n' + changelog, - long_description_content_type='text/markdown', - license='MIT License', - author='Microsoft Corporation', - author_email='azpysdkhelp@microsoft.com', - url='https://github.com/Azure/azure-sdk-for-python', + description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), + long_description=readme + "\n\n" + changelog, + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python", keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product classifiers=[ - 'Development Status :: 4 - Beta', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'License :: OSI Approved :: MIT License', + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "License :: OSI Approved :: MIT License", ], zip_safe=False, - packages=find_packages(exclude=[ - 'tests', - # Exclude packages that will be covered by PEP420 or nspkg - 'azure', - 'azure.mgmt', - ]), + packages=find_packages( + exclude=[ + "tests", + # Exclude packages that will be covered by PEP420 or nspkg + "azure", + "azure.mgmt", + ] + ), include_package_data=True, package_data={ - 'pytyped': ['py.typed'], + "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", + "isodate>=0.6.1", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], - python_requires=">=3.7" + python_requires=">=3.8", )