From 331a4510bd977904465da99187c6f066219cfe91 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 29 Mar 2023 19:30:57 +0000 Subject: [PATCH] CodeGen from PR 23359 in Azure/azure-rest-api-specs Merge 8b7514972c24d174fd6c07d9318be2822e799a1b into 8e7b7903dd29c80a2f0e4f2ff1e6877de1ebf8de --- .../azure-mgmt-apimanagement/_meta.json | 6 +- .../azure/mgmt/apimanagement/__init__.py | 2 +- .../apimanagement/_api_management_client.py | 89 +- .../mgmt/apimanagement/_configuration.py | 20 +- .../mgmt/apimanagement/_serialization.py | 180 +- .../azure/mgmt/apimanagement/_vendor.py | 5 +- .../azure/mgmt/apimanagement/_version.py | 2 +- .../azure/mgmt/apimanagement/aio/__init__.py | 2 +- .../aio/_api_management_client.py | 82 +- .../mgmt/apimanagement/aio/_configuration.py | 15 +- .../apimanagement/aio/operations/__init__.py | 28 +- .../operations/_api_diagnostic_operations.py | 155 +- .../aio/operations/_api_export_operations.py | 25 +- .../_api_issue_attachment_operations.py | 124 +- .../_api_issue_comment_operations.py | 124 +- .../aio/operations/_api_issue_operations.py | 154 +- .../_api_management_client_operations.py | 59 +- .../_api_management_operations_operations.py | 24 +- .../_api_management_service_operations.py | 599 +- ..._api_management_service_skus_operations.py | 29 +- .../_api_management_skus_operations.py | 24 +- .../operations/_api_operation_operations.py | 156 +- .../_api_operation_policy_operations.py | 120 +- .../aio/operations/_api_operations.py | 203 +- .../aio/operations/_api_policy_operations.py | 124 +- .../aio/operations/_api_product_operations.py | 29 +- .../aio/operations/_api_release_operations.py | 156 +- .../operations/_api_revision_operations.py | 29 +- .../aio/operations/_api_schema_operations.py | 144 +- .../_api_tag_description_operations.py | 124 +- .../operations/_api_version_set_operations.py | 155 +- .../aio/operations/_api_wiki_operations.py | 615 ++ .../aio/operations/_api_wikis_operations.py | 168 + ..._authorization_access_policy_operations.py | 540 ++ .../_authorization_login_links_operations.py | 218 + .../operations/_authorization_operations.py | 683 ++ .../_authorization_provider_operations.py | 487 ++ .../_authorization_server_operations.py | 176 +- .../aio/operations/_backend_operations.py | 198 +- .../aio/operations/_cache_operations.py | 164 +- .../aio/operations/_certificate_operations.py | 160 +- .../operations/_content_item_operations.py | 212 +- .../operations/_content_type_operations.py | 190 +- .../_delegation_settings_operations.py | 127 +- .../_deleted_services_operations.py | 97 +- .../aio/operations/_diagnostic_operations.py | 155 +- .../operations/_documentation_operations.py | 733 ++ .../operations/_email_template_operations.py | 156 +- .../aio/operations/_gateway_api_operations.py | 103 +- ...ateway_certificate_authority_operations.py | 123 +- ...teway_hostname_configuration_operations.py | 124 +- .../aio/operations/_gateway_operations.py | 234 +- .../operations/_global_schema_operations.py | 144 +- .../_graph_ql_api_resolver_operations.py | 778 ++ ...graph_ql_api_resolver_policy_operations.py | 619 ++ .../aio/operations/_group_operations.py | 158 +- .../aio/operations/_group_user_operations.py | 93 +- .../_identity_provider_operations.py | 179 +- .../aio/operations/_issue_operations.py | 49 +- .../aio/operations/_logger_operations.py | 157 +- .../aio/operations/_named_value_operations.py | 264 +- .../operations/_network_status_operations.py | 45 +- .../operations/_notification_operations.py | 69 +- ...notification_recipient_email_operations.py | 89 +- ..._notification_recipient_user_operations.py | 89 +- .../_open_id_connect_provider_operations.py | 175 +- .../aio/operations/_operation_operations.py | 29 +- ...twork_dependencies_endpoints_operations.py | 25 +- .../_policy_description_operations.py | 25 +- .../operations/_policy_fragment_operations.py | 715 ++ .../aio/operations/_policy_operations.py | 120 +- .../operations/_portal_config_operations.py | 594 ++ .../operations/_portal_revision_operations.py | 177 +- .../operations/_portal_settings_operations.py | 25 +- ..._private_endpoint_connection_operations.py | 180 +- .../aio/operations/_product_api_operations.py | 93 +- .../operations/_product_group_operations.py | 93 +- .../aio/operations/_product_operations.py | 179 +- .../operations/_product_policy_operations.py | 120 +- .../_product_subscriptions_operations.py | 29 +- .../operations/_product_wiki_operations.py | 615 ++ .../operations/_product_wikis_operations.py | 168 + .../_quota_by_counter_keys_operations.py | 59 +- .../_quota_by_period_keys_operations.py | 59 +- .../aio/operations/_region_operations.py | 29 +- .../aio/operations/_reports_operations.py | 197 +- .../_sign_in_settings_operations.py | 107 +- .../_sign_up_settings_operations.py | 107 +- .../operations/_subscription_operations.py | 215 +- .../aio/operations/_tag_operations.py | 479 +- .../operations/_tag_resource_operations.py | 29 +- .../_tenant_access_git_operations.py | 45 +- .../operations/_tenant_access_operations.py | 189 +- .../_tenant_configuration_operations.py | 217 +- .../operations/_tenant_settings_operations.py | 49 +- .../_user_confirmation_password_operations.py | 25 +- .../aio/operations/_user_group_operations.py | 29 +- .../operations/_user_identities_operations.py | 29 +- .../aio/operations/_user_operations.py | 207 +- .../_user_subscription_operations.py | 49 +- .../mgmt/apimanagement/models/__init__.py | 100 +- .../models/_api_management_client_enums.py | 323 +- .../mgmt/apimanagement/models/_models_py3.py | 6388 +++++++++++------ .../mgmt/apimanagement/operations/__init__.py | 28 +- .../operations/_api_diagnostic_operations.py | 219 +- .../operations/_api_export_operations.py | 35 +- .../_api_issue_attachment_operations.py | 176 +- .../_api_issue_comment_operations.py | 176 +- .../operations/_api_issue_operations.py | 218 +- .../_api_management_client_operations.py | 71 +- .../_api_management_operations_operations.py | 26 +- .../_api_management_service_operations.py | 758 +- ..._api_management_service_skus_operations.py | 39 +- .../_api_management_skus_operations.py | 30 +- .../operations/_api_operation_operations.py | 220 +- .../_api_operation_policy_operations.py | 172 +- .../operations/_api_operations.py | 277 +- .../operations/_api_policy_operations.py | 176 +- .../operations/_api_product_operations.py | 39 +- .../operations/_api_release_operations.py | 220 +- .../operations/_api_revision_operations.py | 39 +- .../operations/_api_schema_operations.py | 196 +- .../_api_tag_description_operations.py | 176 +- .../operations/_api_version_set_operations.py | 219 +- .../operations/_api_wiki_operations.py | 830 +++ .../operations/_api_wikis_operations.py | 225 + ..._authorization_access_policy_operations.py | 807 +++ .../_authorization_login_links_operations.py | 279 + .../operations/_authorization_operations.py | 976 +++ .../_authorization_provider_operations.py | 698 ++ .../_authorization_server_operations.py | 250 +- .../operations/_backend_operations.py | 274 +- .../operations/_cache_operations.py | 228 +- .../operations/_certificate_operations.py | 222 +- .../operations/_content_item_operations.py | 265 +- .../operations/_content_type_operations.py | 233 +- .../_delegation_settings_operations.py | 181 +- .../_deleted_services_operations.py | 113 +- .../operations/_diagnostic_operations.py | 219 +- .../operations/_documentation_operations.py | 1020 +++ .../operations/_email_template_operations.py | 220 +- .../operations/_gateway_api_operations.py | 145 +- ...ateway_certificate_authority_operations.py | 175 +- ...teway_hostname_configuration_operations.py | 176 +- .../operations/_gateway_operations.py | 332 +- .../operations/_global_schema_operations.py | 196 +- .../_graph_ql_api_resolver_operations.py | 1067 +++ ...graph_ql_api_resolver_policy_operations.py | 865 +++ .../operations/_group_operations.py | 222 +- .../operations/_group_user_operations.py | 133 +- .../_identity_provider_operations.py | 253 +- .../operations/_issue_operations.py | 69 +- .../operations/_logger_operations.py | 221 +- .../operations/_named_value_operations.py | 348 +- .../operations/_network_status_operations.py | 65 +- .../operations/_notification_operations.py | 99 +- ...notification_recipient_email_operations.py | 129 +- ..._notification_recipient_user_operations.py | 129 +- .../_open_id_connect_provider_operations.py | 249 +- .../operations/_operation_operations.py | 39 +- ...twork_dependencies_endpoints_operations.py | 35 +- .../_policy_description_operations.py | 35 +- .../operations/_policy_fragment_operations.py | 999 +++ .../operations/_policy_operations.py | 172 +- .../operations/_portal_config_operations.py | 812 +++ .../operations/_portal_revision_operations.py | 231 +- .../operations/_portal_settings_operations.py | 35 +- ..._private_endpoint_connection_operations.py | 242 +- .../operations/_product_api_operations.py | 133 +- .../operations/_product_group_operations.py | 133 +- .../operations/_product_operations.py | 253 +- .../operations/_product_policy_operations.py | 172 +- .../_product_subscriptions_operations.py | 39 +- .../operations/_product_wiki_operations.py | 830 +++ .../operations/_product_wikis_operations.py | 225 + .../_quota_by_counter_keys_operations.py | 81 +- .../_quota_by_period_keys_operations.py | 81 +- .../operations/_region_operations.py | 39 +- .../operations/_reports_operations.py | 277 +- .../_sign_in_settings_operations.py | 151 +- .../_sign_up_settings_operations.py | 151 +- .../operations/_subscription_operations.py | 309 +- .../operations/_tag_operations.py | 693 +- .../operations/_tag_resource_operations.py | 39 +- .../_tenant_access_git_operations.py | 65 +- .../operations/_tenant_access_operations.py | 273 +- .../_tenant_configuration_operations.py | 263 +- .../operations/_tenant_settings_operations.py | 69 +- .../_user_confirmation_password_operations.py | 35 +- .../operations/_user_group_operations.py | 39 +- .../operations/_user_identities_operations.py | 39 +- .../operations/_user_operations.py | 293 +- .../_user_subscription_operations.py | 69 +- ...ent_apply_network_configuration_updates.py | 2 +- ...e_or_reject_private_endpoint_connection.py | 2 +- ...ement_authorization_server_list_secrets.py | 2 +- .../api_management_backend_reconnect.py | 2 +- .../api_management_backup_with_access_key.py | 2 +- ...ent_backup_with_system_managed_identity.py | 2 +- ...kup_with_user_assigned_managed_identity.py | 2 +- .../api_management_create_ai_logger.py | 2 +- .../api_management_create_api.py | 2 +- .../api_management_create_api_clone.py | 2 +- .../api_management_create_api_diagnostic.py | 2 +- .../api_management_create_api_issue.py | 2 +- ..._management_create_api_issue_attachment.py | 2 +- ...api_management_create_api_issue_comment.py | 2 +- ...eate_api_new_version_using_existing_api.py | 2 +- .../api_management_create_api_operation.py | 2 +- ..._management_create_api_operation_policy.py | 2 +- ...api_management_create_api_operation_tag.py | 2 +- .../api_management_create_api_policy.py | 2 +- ...ement_create_api_policy_non_xml_encoded.py | 2 +- .../api_management_create_api_release.py | 2 +- ...t_create_api_revision_from_existing_api.py | 2 +- .../api_management_create_api_schema.py | 2 +- .../api_management_create_api_tag.py | 2 +- ...i_management_create_api_tag_description.py | 2 +- ...e_api_using_import_override_service_url.py | 2 +- ...management_create_api_using_oai3_import.py | 2 +- ...slate_required_query_parameters_conduct.py | 50 + ...agement_create_api_using_swagger_import.py | 2 +- ...management_create_api_using_wadl_import.py | 2 +- .../api_management_create_api_version_set.py | 2 +- .../api_management_create_api_wiki.py | 43 + ...t_create_api_with_multiple_auth_servers.py | 58 + ...with_multiple_open_id_connect_providers.py | 64 + ...agement_create_api_with_open_id_connect.py | 2 +- ...ment_create_authorization_aad_auth_code.py | 44 + ...nt_create_authorization_aad_client_cred.py | 53 + ...ment_create_authorization_access_policy.py | 50 + ...te_authorization_provider_aad_auth_code.py | 59 + ..._authorization_provider_aad_client_cred.py | 57 + ...e_authorization_provider_generic_oauth2.py | 61 + ...reate_authorization_provider_oob_google.py | 58 + ..._management_create_authorization_server.py | 4 +- ...management_create_backend_proxy_backend.py | 2 +- ...anagement_create_backend_service_fabric.py | 2 +- .../api_management_create_cache.py | 2 +- .../api_management_create_certificate.py | 2 +- ...ement_create_certificate_with_key_vault.py | 2 +- .../api_management_create_content_type.py | 50 +- ...gement_create_content_type_content_item.py | 13 +- .../api_management_create_diagnostic.py | 2 +- .../api_management_create_documentation.py | 43 + .../api_management_create_eh_logger.py | 2 +- .../api_management_create_gateway.py | 2 +- .../api_management_create_gateway_api.py | 2 +- ...nt_create_gateway_certificate_authority.py | 2 +- ...t_create_gateway_hostname_configuration.py | 2 +- ...> api_management_create_global_schema1.py} | 4 +- ...> api_management_create_global_schema2.py} | 4 +- .../api_management_create_graph_ql_api.py | 2 +- ...management_create_graph_ql_api_resolver.py | 50 + ...ent_create_graph_ql_api_resolver_policy.py | 50 + .../api_management_create_group.py | 2 +- .../api_management_create_group_external.py | 2 +- .../api_management_create_group_user.py | 2 +- ...api_management_create_identity_provider.py | 2 +- ...lti_region_service_with_custom_hostname.py | 2 +- .../api_management_create_named_value.py | 2 +- ...ement_create_named_value_with_key_vault.py | 2 +- .../api_management_create_notification.py | 2 +- ...ent_create_notification_recipient_email.py | 2 +- ...ment_create_notification_recipient_user.py | 2 +- ...agement_create_open_id_connect_provider.py | 4 +- .../api_management_create_policy.py | 2 +- .../api_management_create_policy_fragment.py | 49 + .../api_management_create_portal_config.py | 64 + .../api_management_create_portal_revision.py | 2 +- .../api_management_create_product.py | 2 +- .../api_management_create_product_api.py | 2 +- .../api_management_create_product_group.py | 2 +- .../api_management_create_product_policy.py | 2 +- .../api_management_create_product_tag.py | 2 +- .../api_management_create_product_wiki.py | 43 + .../api_management_create_service.py | 2 +- ...pi_management_create_service_having_msi.py | 2 +- ...t_create_service_in_vnet_with_public_ip.py | 2 +- .../api_management_create_service_in_zones.py | 2 +- ..._service_with_custom_hostname_key_vault.py | 2 +- ...create_service_with_nat_gateway_enabled.py | 51 + ...create_service_with_system_certificates.py | 2 +- ...ate_service_with_user_assigned_identity.py | 2 +- ...soap_pass_through_api_using_wsdl_import.py | 2 +- ...eate_soap_to_rest_api_using_wsdl_import.py | 2 +- .../api_management_create_subscription.py | 2 +- .../api_management_create_tag.py | 2 +- .../api_management_create_template.py | 2 +- .../api_management_create_tenant_access.py | 2 +- .../api_management_create_user.py | 2 +- ...=> api_management_create_websocket_api.py} | 4 +- .../api_management_delete_api.py | 2 +- .../api_management_delete_api_diagnostic.py | 2 +- .../api_management_delete_api_issue.py | 2 +- ..._management_delete_api_issue_attachment.py | 2 +- ...api_management_delete_api_issue_comment.py | 2 +- .../api_management_delete_api_operation.py | 2 +- ..._management_delete_api_operation_policy.py | 2 +- ...api_management_delete_api_operation_tag.py | 2 +- .../api_management_delete_api_policy.py | 2 +- .../api_management_delete_api_release.py | 2 +- .../api_management_delete_api_schema.py | 2 +- .../api_management_delete_api_tag.py | 2 +- ...i_management_delete_api_tag_description.py | 2 +- .../api_management_delete_api_version_set.py | 2 +- .../api_management_delete_api_wiki.py | 43 + .../api_management_delete_authorization.py | 44 + ...ment_delete_authorization_access_policy.py | 45 + ...anagement_delete_authorization_provider.py | 43 + ..._management_delete_authorization_server.py | 2 +- .../api_management_delete_backend.py | 2 +- .../api_management_delete_cache.py | 2 +- .../api_management_delete_certificate.py | 2 +- .../api_management_delete_content_type.py | 2 +- ...gement_delete_content_type_content_item.py | 2 +- .../api_management_delete_diagnostic.py | 2 +- .../api_management_delete_gateway.py | 2 +- .../api_management_delete_gateway_api.py | 2 +- ...nt_delete_gateway_certificate_authority.py | 2 +- ...t_delete_gateway_hostname_configuration.py | 2 +- ...=> api_management_delete_global_schema.py} | 4 +- ...management_delete_graph_ql_api_resolver.py | 44 + ...ent_delete_graph_ql_api_resolver_policy.py | 45 + .../api_management_delete_group.py | 2 +- .../api_management_delete_group_user.py | 2 +- ...api_management_delete_identity_provider.py | 2 +- .../api_management_delete_logger.py | 2 +- .../api_management_delete_named_value.py | 2 +- ...ent_delete_notification_recipient_email.py | 2 +- ...ment_delete_notification_recipient_user.py | 2 +- ...agement_delete_open_id_connect_provider.py | 2 +- .../api_management_delete_policy.py | 2 +- .../api_management_delete_policy_fragment.py | 43 + ...ment_delete_private_endpoint_connection.py | 2 +- .../api_management_delete_product.py | 2 +- .../api_management_delete_product_api.py | 2 +- .../api_management_delete_product_group.py | 2 +- .../api_management_delete_product_policy.py | 2 +- .../api_management_delete_product_tag.py | 2 +- .../api_management_delete_product_wiki.py | 43 + .../api_management_delete_subscription.py | 2 +- .../api_management_delete_tag.py | 2 +- .../api_management_delete_template.py | 2 +- .../api_management_delete_user.py | 2 +- ...t_deleted_services_list_by_subscription.py | 2 +- .../api_management_deleted_services_purge.py | 2 +- .../api_management_gateway_generate_token.py | 2 +- .../api_management_gateway_list_keys.py | 2 +- .../api_management_gateway_regenerate_key.py | 2 +- .../api_management_get_api_contract.py | 2 +- .../api_management_get_api_diagnostic.py | 2 +- ...agement_get_api_export_in_open_api2dot0.py | 2 +- ...agement_get_api_export_in_open_api3dot0.py | 2 +- .../api_management_get_api_issue.py | 2 +- ...api_management_get_api_issue_attachment.py | 2 +- .../api_management_get_api_issue_comment.py | 2 +- .../api_management_get_api_operation.py | 2 +- ..._management_get_api_operation_pet_store.py | 2 +- ...api_management_get_api_operation_policy.py | 2 +- .../api_management_get_api_operation_tag.py | 2 +- .../api_management_get_api_policy.py | 2 +- .../api_management_get_api_release.py | 2 +- ....py => api_management_get_api_revision.py} | 4 +- .../api_management_get_api_schema.py | 2 +- .../api_management_get_api_tag.py | 2 +- .../api_management_get_api_tag_description.py | 2 +- .../api_management_get_api_version_set.py | 2 +- .../api_management_get_api_wiki.py | 42 + .../api_management_get_authorization.py | 43 + ...agement_get_authorization_access_policy.py | 44 + ...agement_get_authorization_login_request.py | 44 + ...i_management_get_authorization_provider.py | 42 + ...api_management_get_authorization_server.py | 2 +- .../api_management_get_backend.py | 2 +- .../api_management_get_cache.py | 2 +- .../api_management_get_certificate.py | 2 +- ...nagement_get_certificate_with_key_vault.py | 2 +- .../api_management_get_content_type.py | 2 +- ...anagement_get_content_type_content_item.py | 2 +- ..._management_get_deleted_service_by_name.py | 2 +- .../api_management_get_diagnostic.py | 2 +- .../api_management_get_documentation.py | 42 + .../api_management_get_gateway.py | 2 +- ...ement_get_gateway_certificate_authority.py | 2 +- ...ment_get_gateway_hostname_configuration.py | 2 +- ...y => api_management_get_global_schema1.py} | 4 +- ...y => api_management_get_global_schema2.py} | 4 +- ...pi_management_get_graph_ql_api_resolver.py | 43 + ...gement_get_graph_ql_api_resolver_policy.py | 44 + .../api_management_get_group.py | 2 +- .../api_management_get_identity_provider.py | 2 +- .../api_management_get_issue.py | 2 +- .../api_management_get_logger.py | 2 +- .../api_management_get_named_value.py | 2 +- ...nagement_get_named_value_with_key_vault.py | 2 +- .../api_management_get_notification.py | 2 +- ...management_get_open_id_connect_provider.py | 2 +- .../api_management_get_policy.py | 2 +- .../api_management_get_policy_format.py | 2 +- .../api_management_get_policy_fragment.py | 42 + ...i_management_get_policy_fragment_format.py | 42 + .../api_management_get_portal_revision.py | 2 +- ...agement_get_private_endpoint_connection.py | 2 +- ...agement_get_private_link_group_resource.py | 2 +- .../api_management_get_product.py | 2 +- .../api_management_get_product_policy.py | 2 +- .../api_management_get_product_tag.py | 2 +- .../api_management_get_product_wiki.py | 42 + .../api_management_get_quota_counter_keys.py | 2 +- ..._get_quota_counter_keys_by_quota_period.py | 2 +- .../api_management_get_reports_by_api.py | 2 +- .../api_management_get_reports_by_geo.py | 2 +- ...api_management_get_reports_by_operation.py | 2 +- .../api_management_get_reports_by_product.py | 2 +- .../api_management_get_reports_by_request.py | 2 +- ..._management_get_reports_by_subscription.py | 2 +- .../api_management_get_reports_by_time.py | 6 +- .../api_management_get_reports_by_user.py | 2 +- .../api_management_get_subscription.py | 2 +- .../api_management_get_tag.py | 2 +- .../api_management_get_template.py | 2 +- .../api_management_get_tenant_access.py | 2 +- .../api_management_get_tenant_git_access.py | 2 +- .../api_management_get_tenant_settings.py | 2 +- .../api_management_get_user.py | 2 +- .../api_management_get_user_subscription.py | 2 +- .../api_management_head_api.py | 2 +- .../api_management_head_api_diagnostic.py | 2 +- .../api_management_head_api_issue.py | 2 +- ...pi_management_head_api_issue_attachment.py | 2 +- .../api_management_head_api_issue_comment.py | 2 +- .../api_management_head_api_operation.py | 2 +- ...pi_management_head_api_operation_policy.py | 2 +- .../api_management_head_api_operation_tag.py | 2 +- .../api_management_head_api_policy.py | 2 +- .../api_management_head_api_release.py | 2 +- .../api_management_head_api_schema.py | 2 +- .../api_management_head_api_tag.py | 2 +- ...api_management_head_api_tag_description.py | 2 +- .../api_management_head_api_version_set.py | 2 +- .../api_management_head_api_wiki.py | 42 + ...pi_management_head_authorization_server.py | 2 +- .../api_management_head_backend.py | 2 +- .../api_management_head_cache.py | 2 +- .../api_management_head_certificate.py | 2 +- ...nagement_head_content_type_content_item.py | 2 +- ...api_management_head_delegation_settings.py | 2 +- .../api_management_head_diagnostic.py | 2 +- .../api_management_head_documentation.py | 42 + .../api_management_head_email_template.py | 2 +- .../api_management_head_gateway.py | 2 +- .../api_management_head_gateway_api.py | 2 +- ...ment_head_gateway_certificate_authority.py | 2 +- ...ent_head_gateway_hostname_configuration.py | 2 +- .../api_management_head_global_schema.py | 42 + ...i_management_head_graph_ql_api_resolver.py | 43 + ...ement_head_graph_ql_api_resolver_policy.py | 44 + .../api_management_head_group.py | 2 +- .../api_management_head_group_user.py | 2 +- .../api_management_head_identity_provider.py | 2 +- .../api_management_head_logger.py | 2 +- .../api_management_head_named_value.py | 2 +- ...ement_head_notification_recipient_email.py | 2 +- ...gement_head_notification_recipient_user.py | 2 +- ...anagement_head_open_id_connect_provider.py | 2 +- .../api_management_head_policy.py | 2 +- .../api_management_head_policy_fragment.py | 42 + .../api_management_head_portal_config.py | 42 + .../api_management_head_portal_revision.py | 2 +- .../api_management_head_product.py | 2 +- .../api_management_head_product_api.py | 2 +- .../api_management_head_product_group.py | 2 +- .../api_management_head_product_policy.py | 2 +- .../api_management_head_product_tag.py | 2 +- .../api_management_head_product_wiki.py | 42 + .../api_management_head_sign_in_settings.py | 2 +- .../api_management_head_sign_up_settings.py | 2 +- .../api_management_head_subscription.py | 2 +- .../api_management_head_tag.py | 2 +- .../api_management_head_tenant_access.py | 2 +- .../api_management_head_user.py | 2 +- ...nagement_identity_provider_list_secrets.py | 2 +- .../api_management_list_api_diagnostics.py | 2 +- ...i_management_list_api_issue_attachments.py | 2 +- .../api_management_list_api_issue_comments.py | 2 +- .../api_management_list_api_issues.py | 2 +- ..._management_list_api_operation_policies.py | 2 +- .../api_management_list_api_operation_tags.py | 2 +- .../api_management_list_api_operations.py | 2 +- ..._management_list_api_operations_by_tags.py | 2 +- .../api_management_list_api_policies.py | 2 +- .../api_management_list_api_products.py | 2 +- .../api_management_list_api_releases.py | 2 +- .../api_management_list_api_revisions.py | 2 +- .../api_management_list_api_schemas.py | 2 +- ...pi_management_list_api_tag_descriptions.py | 2 +- .../api_management_list_api_tags.py | 2 +- .../api_management_list_api_version_sets.py | 2 +- .../api_management_list_api_wikis.py | 43 + .../api_management_list_apis.py | 2 +- .../api_management_list_apis_by_tags.py | 2 +- ...ment_list_authorization_access_policies.py | 44 + ...management_list_authorization_providers.py | 42 + ...i_management_list_authorization_servers.py | 2 +- ...anagement_list_authorizations_auth_code.py | 43 + ...agement_list_authorizations_client_cred.py | 43 + .../api_management_list_backends.py | 2 +- .../api_management_list_caches.py | 2 +- .../api_management_list_certificates.py | 2 +- ...agement_list_content_type_content_items.py | 2 +- .../api_management_list_content_types.py | 2 +- .../api_management_list_diagnostics.py | 2 +- .../api_management_list_documentations.py | 42 + .../api_management_list_gateway_apis.py | 2 +- ...t_list_gateway_certificate_authorities.py} | 4 +- ...nt_list_gateway_hostname_configurations.py | 2 +- .../api_management_list_gateways.py | 2 +- ... => api_management_list_global_schemas.py} | 4 +- ...ent_list_graph_ql_api_resolver_policies.py | 44 + ..._management_list_graph_ql_api_resolvers.py | 43 + .../api_management_list_group_users.py | 2 +- .../api_management_list_groups.py | 2 +- .../api_management_list_identity_providers.py | 2 +- .../api_management_list_issues.py | 2 +- .../api_management_list_loggers.py | 2 +- .../api_management_list_named_values.py | 2 +- ...ment_list_notification_recipient_emails.py | 2 +- ...ement_list_notification_recipient_users.py | 2 +- .../api_management_list_notifications.py | 2 +- ...nagement_list_open_id_connect_providers.py | 2 +- .../api_management_list_operations.py | 2 +- .../api_management_list_policies.py | 2 +- ...api_management_list_policy_descriptions.py | 2 +- ...agement_list_policy_fragment_references.py | 42 + .../api_management_list_policy_fragments.py | 41 + .../api_management_list_portal_config.py | 41 + .../api_management_list_portal_revisions.py | 2 +- .../api_management_list_portal_settings.py | 2 +- ...ement_list_private_endpoint_connections.py | 2 +- ...ement_list_private_link_group_resources.py | 2 +- .../api_management_list_product_apis.py | 2 +- .../api_management_list_product_groups.py | 2 +- .../api_management_list_product_policies.py | 2 +- ...i_management_list_product_subscriptions.py | 2 +- .../api_management_list_product_tags.py | 2 +- .../api_management_list_product_wikis.py | 43 + .../api_management_list_products.py | 2 +- .../api_management_list_products_by_tags.py | 2 +- .../api_management_list_regions.py | 2 +- ...secrets_portal_settings_validation_key.py} | 4 +- ...i_management_list_secrets_tenant_access.py | 2 +- ...management_list_service_by_subscription.py | 2 +- ...vice_by_subscription_and_resource_group.py | 2 +- .../api_management_list_sk_us_consumption.py | 2 +- .../api_management_list_sk_us_dedicated.py | 2 +- ...rce_skus.py => api_management_list_sku.py} | 4 +- .../api_management_list_subscriptions.py | 2 +- .../api_management_list_tag_resources.py | 2 +- .../api_management_list_tags.py | 2 +- .../api_management_list_templates.py | 2 +- .../api_management_list_tenant_access.py | 2 +- .../api_management_list_tenant_settings.py | 2 +- .../api_management_list_user_groups.py | 2 +- .../api_management_list_user_identities.py | 2 +- .../api_management_list_user_subscriptions.py | 2 +- .../api_management_list_users.py | 2 +- .../api_management_named_value_list_value.py | 2 +- ...nt_openid_connect_provider_list_secrets.py | 2 +- ..._management_perform_connectivity_check.py} | 4 +- ...erform_connectivity_check_http_connect.py} | 6 +- .../api_management_portal_config.py | 42 + ...nagement_portal_settings_get_delegation.py | 2 +- ..._management_portal_settings_get_sign_in.py | 2 +- ..._management_portal_settings_get_sign_up.py | 2 +- ...nagement_portal_settings_put_delegation.py | 49 + ..._management_portal_settings_put_sign_in.py | 42 + ..._management_portal_settings_put_sign_up.py | 47 + ...ement_portal_settings_update_delegation.py | 2 +- ...nagement_portal_settings_update_sign_in.py | 2 +- ...nagement_portal_settings_update_sign_up.py | 2 +- ...horization_confirm_consent_code_request.py | 44 + .../api_management_refresh_certificate.py | 2 +- .../api_management_refresh_named_value.py | 2 +- ...api_management_restore_with_access_key.py} | 4 +- ...agement_service_check_name_availability.py | 2 +- .../api_management_service_delete_service.py | 2 +- ...service_get_domain_ownership_identifier.py | 2 +- ..._service_get_multi_region_internal_vnet.py | 2 +- ...i_management_service_get_network_status.py | 2 +- ..._service_get_network_status_by_location.py | 2 +- ...outbound_network_dependencies_endpoints.py | 2 +- .../api_management_service_get_service.py | 2 +- ...nagement_service_get_service_having_msi.py | 2 +- .../api_management_service_get_sso_token.py | 2 +- .../api_management_service_migrate_to_stv2.py | 41 + ...pi_management_subscription_list_secrets.py | 2 +- ...ent_subscription_regenerate_primary_key.py | 2 +- ...t_subscription_regenerate_secondary_key.py | 2 +- ...management_tenant_access_regenerate_key.py | 2 +- ...api_management_tenant_access_sync_state.py | 2 +- ..._management_tenant_configuration_deploy.py | 2 +- ...pi_management_tenant_configuration_save.py | 2 +- ...anagement_tenant_configuration_validate.py | 2 +- .../api_management_undelete.py | 2 +- .../api_management_update_api.py | 2 +- .../api_management_update_api_diagnostic.py | 2 +- .../api_management_update_api_issue.py | 2 +- .../api_management_update_api_operation.py | 2 +- .../api_management_update_api_release.py | 2 +- .../api_management_update_api_version_set.py | 2 +- .../api_management_update_api_wiki.py | 44 + ..._management_update_authorization_server.py | 11 +- .../api_management_update_backend.py | 2 +- .../api_management_update_cache.py | 2 +- .../api_management_update_diagnostic.py | 2 +- .../api_management_update_gateway.py | 2 +- ...management_update_graph_ql_api_resolver.py | 51 + .../api_management_update_group.py | 2 +- ...api_management_update_identity_provider.py | 2 +- .../api_management_update_logger.py | 2 +- .../api_management_update_named_value.py | 2 +- ...agement_update_open_id_connect_provider.py | 6 +- .../api_management_update_portal_config.py | 64 + .../api_management_update_portal_revision.py | 2 +- .../api_management_update_product.py | 2 +- .../api_management_update_product_wiki.py | 44 + ...api_management_update_quota_counter_key.py | 2 +- ...pdate_quota_counter_key_by_quota_period.py | 2 +- ...management_update_service_disable_tls10.py | 2 +- ...gement_update_service_publisher_details.py | 2 +- ...ent_update_service_to_new_vnet_and_azs.py} | 4 +- .../api_management_update_subscription.py | 2 +- .../api_management_update_tag.py | 2 +- .../api_management_update_template.py | 2 +- .../api_management_update_tenant_access.py | 2 +- .../api_management_update_user.py | 2 +- ...agement_user_confirmation_password_send.py | 2 +- .../api_management_user_generate_sso_url.py | 2 +- .../api_management_user_token.py | 2 +- 640 files changed, 37513 insertions(+), 12895 deletions(-) create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wiki_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wikis_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_access_policy_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_login_links_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_provider_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_documentation_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_policy_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_fragment_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_config_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wiki_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wikis_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wiki_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wikis_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_access_policy_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_login_links_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_provider_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_documentation_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_policy_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_fragment_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_config_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wiki_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wikis_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_oai3_import_with_translate_required_query_parameters_conduct.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_wiki.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_auth_servers.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_open_id_connect_providers.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_auth_code.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_client_cred.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_access_policy.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_auth_code.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_client_cred.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_generic_oauth2.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_oob_google.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_documentation.py rename sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/{api_management_create_schema1.py => api_management_create_global_schema1.py} (94%) rename sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/{api_management_create_schema2.py => api_management_create_global_schema2.py} (94%) create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver_policy.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy_fragment.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_config.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_wiki.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_nat_gateway_enabled.py rename sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/{api_management_create_web_socket_api.py => api_management_create_websocket_api.py} (92%) create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_wiki.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_access_policy.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_provider.py rename sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/{api_management_delete_schema.py => api_management_delete_global_schema.py} (90%) create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver_policy.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy_fragment.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_wiki.py rename sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/{api_management_get_api_revision_contract.py => api_management_get_api_revision.py} (91%) create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_wiki.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_access_policy.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_login_request.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_provider.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_documentation.py rename sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/{api_management_get_schema1.py => api_management_get_global_schema1.py} (90%) rename sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/{api_management_get_schema2.py => api_management_get_global_schema2.py} (90%) create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver_policy.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment_format.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_wiki.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_wiki.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_documentation.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_global_schema.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver_policy.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy_fragment.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_config.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_wiki.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_wikis.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_access_policies.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_providers.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_auth_code.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_client_cred.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_documentations.py rename sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/{api_management_list_gatewaycertificate_authorities.py => api_management_list_gateway_certificate_authorities.py} (89%) rename sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/{api_management_list_schemas.py => api_management_list_global_schemas.py} (90%) create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolver_policies.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolvers.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragment_references.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragments.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_config.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_wikis.py rename sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/{api_management_list_secrets_portal_settings.py => api_management_list_secrets_portal_settings_validation_key.py} (88%) rename sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/{lists_all_available_resource_skus.py => api_management_list_sku.py} (91%) rename sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/{tcp_connectivity_check.py => api_management_perform_connectivity_check.py} (91%) rename sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/{http_connectivity_check.py => api_management_perform_connectivity_check_http_connect.py} (89%) create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_config.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_delegation.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_in.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_up.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_post_authorization_confirm_consent_code_request.py rename sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/{api_management_restore_service.py => api_management_restore_with_access_key.py} (91%) create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_migrate_to_stv2.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_wiki.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_graph_ql_api_resolver.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_config.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_product_wiki.py rename sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/{api_management_update_service_to_new_vnet_and_availability_zones.py => api_management_update_service_to_new_vnet_and_azs.py} (93%) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json b/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json index acb9ebaf4514..0f4f1fd8f660 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json +++ b/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json @@ -1,11 +1,11 @@ { - "commit": "a2da92ad78961529a087f9d0e65394174ac50794", + "commit": "d4151719930ed21f099921967d34e9bd3a4e3eec", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.1", + "@autorest/python@6.4.6", "@autorest/modelerfour@4.24.3" ], - "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.2.1 --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=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.4.6 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --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/__init__.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/__init__.py index 94b529edf394..707b0d2b220c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/__init__.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk 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 43857dfb3d7f..b4ee2b74c9cf 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 @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import ApiManagementClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -36,6 +36,12 @@ ApiSchemaOperations, ApiTagDescriptionOperations, ApiVersionSetOperations, + ApiWikiOperations, + ApiWikisOperations, + AuthorizationAccessPolicyOperations, + AuthorizationLoginLinksOperations, + AuthorizationOperations, + AuthorizationProviderOperations, AuthorizationServerOperations, BackendOperations, CacheOperations, @@ -45,12 +51,15 @@ DelegationSettingsOperations, DeletedServicesOperations, DiagnosticOperations, + DocumentationOperations, EmailTemplateOperations, GatewayApiOperations, GatewayCertificateAuthorityOperations, GatewayHostnameConfigurationOperations, GatewayOperations, GlobalSchemaOperations, + GraphQLApiResolverOperations, + GraphQLApiResolverPolicyOperations, GroupOperations, GroupUserOperations, IdentityProviderOperations, @@ -65,7 +74,9 @@ OperationOperations, OutboundNetworkDependenciesEndpointsOperations, PolicyDescriptionOperations, + PolicyFragmentOperations, PolicyOperations, + PortalConfigOperations, PortalRevisionOperations, PortalSettingsOperations, PrivateEndpointConnectionOperations, @@ -74,6 +85,8 @@ ProductOperations, ProductPolicyOperations, ProductSubscriptionsOperations, + ProductWikiOperations, + ProductWikisOperations, QuotaByCounterKeysOperations, QuotaByPeriodKeysOperations, RegionOperations, @@ -116,6 +129,12 @@ class ApiManagementClient( :vartype api_operation_policy: azure.mgmt.apimanagement.operations.ApiOperationPolicyOperations :ivar tag: TagOperations operations :vartype tag: azure.mgmt.apimanagement.operations.TagOperations + :ivar graph_ql_api_resolver: GraphQLApiResolverOperations operations + :vartype graph_ql_api_resolver: + azure.mgmt.apimanagement.operations.GraphQLApiResolverOperations + :ivar graph_ql_api_resolver_policy: GraphQLApiResolverPolicyOperations operations + :vartype graph_ql_api_resolver_policy: + azure.mgmt.apimanagement.operations.GraphQLApiResolverPolicyOperations :ivar api_product: ApiProductOperations operations :vartype api_product: azure.mgmt.apimanagement.operations.ApiProductOperations :ivar api_policy: ApiPolicyOperations operations @@ -134,10 +153,25 @@ class ApiManagementClient( :vartype api_tag_description: azure.mgmt.apimanagement.operations.ApiTagDescriptionOperations :ivar operation: OperationOperations operations :vartype operation: azure.mgmt.apimanagement.operations.OperationOperations + :ivar api_wiki: ApiWikiOperations operations + :vartype api_wiki: azure.mgmt.apimanagement.operations.ApiWikiOperations + :ivar api_wikis: ApiWikisOperations operations + :vartype api_wikis: azure.mgmt.apimanagement.operations.ApiWikisOperations :ivar api_export: ApiExportOperations operations :vartype api_export: azure.mgmt.apimanagement.operations.ApiExportOperations :ivar api_version_set: ApiVersionSetOperations operations :vartype api_version_set: azure.mgmt.apimanagement.operations.ApiVersionSetOperations + :ivar authorization_provider: AuthorizationProviderOperations operations + :vartype authorization_provider: + azure.mgmt.apimanagement.operations.AuthorizationProviderOperations + :ivar authorization: AuthorizationOperations operations + :vartype authorization: azure.mgmt.apimanagement.operations.AuthorizationOperations + :ivar authorization_login_links: AuthorizationLoginLinksOperations operations + :vartype authorization_login_links: + azure.mgmt.apimanagement.operations.AuthorizationLoginLinksOperations + :ivar authorization_access_policy: AuthorizationAccessPolicyOperations operations + :vartype authorization_access_policy: + azure.mgmt.apimanagement.operations.AuthorizationAccessPolicyOperations :ivar authorization_server: AuthorizationServerOperations operations :vartype authorization_server: azure.mgmt.apimanagement.operations.AuthorizationServerOperations @@ -164,6 +198,8 @@ class ApiManagementClient( azure.mgmt.apimanagement.operations.ApiManagementServiceOperations :ivar diagnostic: DiagnosticOperations operations :vartype diagnostic: azure.mgmt.apimanagement.operations.DiagnosticOperations + :ivar documentation: DocumentationOperations operations + :vartype documentation: azure.mgmt.apimanagement.operations.DocumentationOperations :ivar email_template: EmailTemplateOperations operations :vartype email_template: azure.mgmt.apimanagement.operations.EmailTemplateOperations :ivar gateway: GatewayOperations operations @@ -209,6 +245,10 @@ class ApiManagementClient( :vartype policy: azure.mgmt.apimanagement.operations.PolicyOperations :ivar policy_description: PolicyDescriptionOperations operations :vartype policy_description: azure.mgmt.apimanagement.operations.PolicyDescriptionOperations + :ivar policy_fragment: PolicyFragmentOperations operations + :vartype policy_fragment: azure.mgmt.apimanagement.operations.PolicyFragmentOperations + :ivar portal_config: PortalConfigOperations operations + :vartype portal_config: azure.mgmt.apimanagement.operations.PortalConfigOperations :ivar portal_revision: PortalRevisionOperations operations :vartype portal_revision: azure.mgmt.apimanagement.operations.PortalRevisionOperations :ivar portal_settings: PortalSettingsOperations operations @@ -233,6 +273,10 @@ class ApiManagementClient( azure.mgmt.apimanagement.operations.ProductSubscriptionsOperations :ivar product_policy: ProductPolicyOperations operations :vartype product_policy: azure.mgmt.apimanagement.operations.ProductPolicyOperations + :ivar product_wiki: ProductWikiOperations operations + :vartype product_wiki: azure.mgmt.apimanagement.operations.ProductWikiOperations + :ivar product_wikis: ProductWikisOperations operations + :vartype product_wikis: azure.mgmt.apimanagement.operations.ProductWikisOperations :ivar quota_by_counter_keys: QuotaByCounterKeysOperations operations :vartype quota_by_counter_keys: azure.mgmt.apimanagement.operations.QuotaByCounterKeysOperations @@ -272,13 +316,12 @@ class ApiManagementClient( azure.mgmt.apimanagement.operations.UserConfirmationPasswordOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2021-08-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -294,9 +337,9 @@ def __init__( self._config = ApiManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -308,6 +351,12 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.tag = TagOperations(self._client, self._config, self._serialize, self._deserialize) + self.graph_ql_api_resolver = GraphQLApiResolverOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.graph_ql_api_resolver_policy = GraphQLApiResolverPolicyOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.api_product = ApiProductOperations(self._client, self._config, self._serialize, self._deserialize) self.api_policy = ApiPolicyOperations(self._client, self._config, self._serialize, self._deserialize) self.api_schema = ApiSchemaOperations(self._client, self._config, self._serialize, self._deserialize) @@ -323,8 +372,20 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.operation = OperationOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_wiki = ApiWikiOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_wikis = ApiWikisOperations(self._client, self._config, self._serialize, self._deserialize) self.api_export = ApiExportOperations(self._client, self._config, self._serialize, self._deserialize) self.api_version_set = ApiVersionSetOperations(self._client, self._config, self._serialize, self._deserialize) + self.authorization_provider = AuthorizationProviderOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.authorization = AuthorizationOperations(self._client, self._config, self._serialize, self._deserialize) + self.authorization_login_links = AuthorizationLoginLinksOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.authorization_access_policy = AuthorizationAccessPolicyOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.authorization_server = AuthorizationServerOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -346,6 +407,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.diagnostic = DiagnosticOperations(self._client, self._config, self._serialize, self._deserialize) + self.documentation = DocumentationOperations(self._client, self._config, self._serialize, self._deserialize) self.email_template = EmailTemplateOperations(self._client, self._config, self._serialize, self._deserialize) self.gateway = GatewayOperations(self._client, self._config, self._serialize, self._deserialize) self.gateway_hostname_configuration = GatewayHostnameConfigurationOperations( @@ -381,6 +443,8 @@ def __init__( self.policy_description = PolicyDescriptionOperations( self._client, self._config, self._serialize, self._deserialize ) + self.policy_fragment = PolicyFragmentOperations(self._client, self._config, self._serialize, self._deserialize) + self.portal_config = PortalConfigOperations(self._client, self._config, self._serialize, self._deserialize) self.portal_revision = PortalRevisionOperations(self._client, self._config, self._serialize, self._deserialize) self.portal_settings = PortalSettingsOperations(self._client, self._config, self._serialize, self._deserialize) self.sign_in_settings = SignInSettingsOperations(self._client, self._config, self._serialize, self._deserialize) @@ -398,6 +462,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.product_policy = ProductPolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.product_wiki = ProductWikiOperations(self._client, self._config, self._serialize, self._deserialize) + self.product_wikis = ProductWikisOperations(self._client, self._config, self._serialize, self._deserialize) self.quota_by_counter_keys = QuotaByCounterKeysOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -452,15 +518,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> ApiManagementClient + def __enter__(self) -> "ApiManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) 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 c0a077dcda90..2c8f74befe2c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_configuration.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -33,17 +27,16 @@ class ApiManagementClientConfiguration(Configuration): # pylint: disable=too-ma :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-08-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ApiManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-08-01") # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", "2022-09-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -57,10 +50,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-apimanagement/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) 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 7c1dedb5133d..842ae727fbbc 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_serialization.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,23 +38,38 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] class RawDeserializer: @@ -65,8 +81,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +147,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +174,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +202,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +233,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,12 +290,12 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -290,27 +304,27 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,13 +333,13 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -339,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -387,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -399,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -412,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -453,7 +477,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -521,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -537,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -605,14 +629,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,23 +645,22 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue @@ -659,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -675,7 +698,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -780,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -843,7 +868,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -1001,10 +1026,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1164,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1245,7 +1271,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1269,7 +1295,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1335,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1355,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1416,7 +1442,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1470,7 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1474,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1489,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1499,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: @@ -1543,7 +1569,7 @@ def _unpack_content(raw_data, content_type=None): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1591,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1773,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1824,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1836,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1852,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1867,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1897,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + 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) @@ -1886,7 +1912,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1927,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1950,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1986,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: 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 170722a50920..c4b00a9e8112 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 TYPE_CHECKING +from typing import List, TYPE_CHECKING, cast from azure.core.pipeline.transport import HttpRequest @@ -33,7 +33,8 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_version.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_version.py index 48b05f9c489c..e5754a47ce68 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 = "3.1.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/__init__.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/__init__.py index c745f7331350..4bf8dbb522dc 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/__init__.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk 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 17e8578d58ca..10e7d9733bd9 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 @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import ApiManagementClientConfiguration from .operations import ( @@ -36,6 +36,12 @@ ApiSchemaOperations, ApiTagDescriptionOperations, ApiVersionSetOperations, + ApiWikiOperations, + ApiWikisOperations, + AuthorizationAccessPolicyOperations, + AuthorizationLoginLinksOperations, + AuthorizationOperations, + AuthorizationProviderOperations, AuthorizationServerOperations, BackendOperations, CacheOperations, @@ -45,12 +51,15 @@ DelegationSettingsOperations, DeletedServicesOperations, DiagnosticOperations, + DocumentationOperations, EmailTemplateOperations, GatewayApiOperations, GatewayCertificateAuthorityOperations, GatewayHostnameConfigurationOperations, GatewayOperations, GlobalSchemaOperations, + GraphQLApiResolverOperations, + GraphQLApiResolverPolicyOperations, GroupOperations, GroupUserOperations, IdentityProviderOperations, @@ -65,7 +74,9 @@ OperationOperations, OutboundNetworkDependenciesEndpointsOperations, PolicyDescriptionOperations, + PolicyFragmentOperations, PolicyOperations, + PortalConfigOperations, PortalRevisionOperations, PortalSettingsOperations, PrivateEndpointConnectionOperations, @@ -74,6 +85,8 @@ ProductOperations, ProductPolicyOperations, ProductSubscriptionsOperations, + ProductWikiOperations, + ProductWikisOperations, QuotaByCounterKeysOperations, QuotaByPeriodKeysOperations, RegionOperations, @@ -117,6 +130,12 @@ class ApiManagementClient( azure.mgmt.apimanagement.aio.operations.ApiOperationPolicyOperations :ivar tag: TagOperations operations :vartype tag: azure.mgmt.apimanagement.aio.operations.TagOperations + :ivar graph_ql_api_resolver: GraphQLApiResolverOperations operations + :vartype graph_ql_api_resolver: + azure.mgmt.apimanagement.aio.operations.GraphQLApiResolverOperations + :ivar graph_ql_api_resolver_policy: GraphQLApiResolverPolicyOperations operations + :vartype graph_ql_api_resolver_policy: + azure.mgmt.apimanagement.aio.operations.GraphQLApiResolverPolicyOperations :ivar api_product: ApiProductOperations operations :vartype api_product: azure.mgmt.apimanagement.aio.operations.ApiProductOperations :ivar api_policy: ApiPolicyOperations operations @@ -137,10 +156,25 @@ class ApiManagementClient( azure.mgmt.apimanagement.aio.operations.ApiTagDescriptionOperations :ivar operation: OperationOperations operations :vartype operation: azure.mgmt.apimanagement.aio.operations.OperationOperations + :ivar api_wiki: ApiWikiOperations operations + :vartype api_wiki: azure.mgmt.apimanagement.aio.operations.ApiWikiOperations + :ivar api_wikis: ApiWikisOperations operations + :vartype api_wikis: azure.mgmt.apimanagement.aio.operations.ApiWikisOperations :ivar api_export: ApiExportOperations operations :vartype api_export: azure.mgmt.apimanagement.aio.operations.ApiExportOperations :ivar api_version_set: ApiVersionSetOperations operations :vartype api_version_set: azure.mgmt.apimanagement.aio.operations.ApiVersionSetOperations + :ivar authorization_provider: AuthorizationProviderOperations operations + :vartype authorization_provider: + azure.mgmt.apimanagement.aio.operations.AuthorizationProviderOperations + :ivar authorization: AuthorizationOperations operations + :vartype authorization: azure.mgmt.apimanagement.aio.operations.AuthorizationOperations + :ivar authorization_login_links: AuthorizationLoginLinksOperations operations + :vartype authorization_login_links: + azure.mgmt.apimanagement.aio.operations.AuthorizationLoginLinksOperations + :ivar authorization_access_policy: AuthorizationAccessPolicyOperations operations + :vartype authorization_access_policy: + azure.mgmt.apimanagement.aio.operations.AuthorizationAccessPolicyOperations :ivar authorization_server: AuthorizationServerOperations operations :vartype authorization_server: azure.mgmt.apimanagement.aio.operations.AuthorizationServerOperations @@ -167,6 +201,8 @@ class ApiManagementClient( azure.mgmt.apimanagement.aio.operations.ApiManagementServiceOperations :ivar diagnostic: DiagnosticOperations operations :vartype diagnostic: azure.mgmt.apimanagement.aio.operations.DiagnosticOperations + :ivar documentation: DocumentationOperations operations + :vartype documentation: azure.mgmt.apimanagement.aio.operations.DocumentationOperations :ivar email_template: EmailTemplateOperations operations :vartype email_template: azure.mgmt.apimanagement.aio.operations.EmailTemplateOperations :ivar gateway: GatewayOperations operations @@ -213,6 +249,10 @@ class ApiManagementClient( :ivar policy_description: PolicyDescriptionOperations operations :vartype policy_description: azure.mgmt.apimanagement.aio.operations.PolicyDescriptionOperations + :ivar policy_fragment: PolicyFragmentOperations operations + :vartype policy_fragment: azure.mgmt.apimanagement.aio.operations.PolicyFragmentOperations + :ivar portal_config: PortalConfigOperations operations + :vartype portal_config: azure.mgmt.apimanagement.aio.operations.PortalConfigOperations :ivar portal_revision: PortalRevisionOperations operations :vartype portal_revision: azure.mgmt.apimanagement.aio.operations.PortalRevisionOperations :ivar portal_settings: PortalSettingsOperations operations @@ -238,6 +278,10 @@ class ApiManagementClient( azure.mgmt.apimanagement.aio.operations.ProductSubscriptionsOperations :ivar product_policy: ProductPolicyOperations operations :vartype product_policy: azure.mgmt.apimanagement.aio.operations.ProductPolicyOperations + :ivar product_wiki: ProductWikiOperations operations + :vartype product_wiki: azure.mgmt.apimanagement.aio.operations.ProductWikiOperations + :ivar product_wikis: ProductWikisOperations operations + :vartype product_wikis: azure.mgmt.apimanagement.aio.operations.ProductWikisOperations :ivar quota_by_counter_keys: QuotaByCounterKeysOperations operations :vartype quota_by_counter_keys: azure.mgmt.apimanagement.aio.operations.QuotaByCounterKeysOperations @@ -279,13 +323,12 @@ class ApiManagementClient( azure.mgmt.apimanagement.aio.operations.UserConfirmationPasswordOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2021-08-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -301,9 +344,9 @@ def __init__( self._config = ApiManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -315,6 +358,12 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.tag = TagOperations(self._client, self._config, self._serialize, self._deserialize) + self.graph_ql_api_resolver = GraphQLApiResolverOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.graph_ql_api_resolver_policy = GraphQLApiResolverPolicyOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.api_product = ApiProductOperations(self._client, self._config, self._serialize, self._deserialize) self.api_policy = ApiPolicyOperations(self._client, self._config, self._serialize, self._deserialize) self.api_schema = ApiSchemaOperations(self._client, self._config, self._serialize, self._deserialize) @@ -330,8 +379,20 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.operation = OperationOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_wiki = ApiWikiOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_wikis = ApiWikisOperations(self._client, self._config, self._serialize, self._deserialize) self.api_export = ApiExportOperations(self._client, self._config, self._serialize, self._deserialize) self.api_version_set = ApiVersionSetOperations(self._client, self._config, self._serialize, self._deserialize) + self.authorization_provider = AuthorizationProviderOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.authorization = AuthorizationOperations(self._client, self._config, self._serialize, self._deserialize) + self.authorization_login_links = AuthorizationLoginLinksOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.authorization_access_policy = AuthorizationAccessPolicyOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.authorization_server = AuthorizationServerOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -353,6 +414,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.diagnostic = DiagnosticOperations(self._client, self._config, self._serialize, self._deserialize) + self.documentation = DocumentationOperations(self._client, self._config, self._serialize, self._deserialize) self.email_template = EmailTemplateOperations(self._client, self._config, self._serialize, self._deserialize) self.gateway = GatewayOperations(self._client, self._config, self._serialize, self._deserialize) self.gateway_hostname_configuration = GatewayHostnameConfigurationOperations( @@ -388,6 +450,8 @@ def __init__( self.policy_description = PolicyDescriptionOperations( self._client, self._config, self._serialize, self._deserialize ) + self.policy_fragment = PolicyFragmentOperations(self._client, self._config, self._serialize, self._deserialize) + self.portal_config = PortalConfigOperations(self._client, self._config, self._serialize, self._deserialize) self.portal_revision = PortalRevisionOperations(self._client, self._config, self._serialize, self._deserialize) self.portal_settings = PortalSettingsOperations(self._client, self._config, self._serialize, self._deserialize) self.sign_in_settings = SignInSettingsOperations(self._client, self._config, self._serialize, self._deserialize) @@ -405,6 +469,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.product_policy = ProductPolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.product_wiki = ProductWikiOperations(self._client, self._config, self._serialize, self._deserialize) + self.product_wikis = ProductWikisOperations(self._client, self._config, self._serialize, self._deserialize) self.quota_by_counter_keys = QuotaByCounterKeysOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -466,5 +532,5 @@ async def __aenter__(self) -> "ApiManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_configuration.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_configuration.py index 5528490fd773..c22860e3bcc8 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 @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -33,17 +27,16 @@ class ApiManagementClientConfiguration(Configuration): # pylint: disable=too-ma :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-08-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ApiManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-08-01") # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", "2022-09-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/__init__.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/__init__.py index 898ea8cdf532..e5a76b36240c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/__init__.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/__init__.py @@ -12,6 +12,8 @@ from ._api_operation_operations import ApiOperationOperations from ._api_operation_policy_operations import ApiOperationPolicyOperations from ._tag_operations import TagOperations +from ._graph_ql_api_resolver_operations import GraphQLApiResolverOperations +from ._graph_ql_api_resolver_policy_operations import GraphQLApiResolverPolicyOperations from ._api_product_operations import ApiProductOperations from ._api_policy_operations import ApiPolicyOperations from ._api_schema_operations import ApiSchemaOperations @@ -21,8 +23,14 @@ from ._api_issue_attachment_operations import ApiIssueAttachmentOperations from ._api_tag_description_operations import ApiTagDescriptionOperations from ._operation_operations import OperationOperations +from ._api_wiki_operations import ApiWikiOperations +from ._api_wikis_operations import ApiWikisOperations from ._api_export_operations import ApiExportOperations from ._api_version_set_operations import ApiVersionSetOperations +from ._authorization_provider_operations import AuthorizationProviderOperations +from ._authorization_operations import AuthorizationOperations +from ._authorization_login_links_operations import AuthorizationLoginLinksOperations +from ._authorization_access_policy_operations import AuthorizationAccessPolicyOperations from ._authorization_server_operations import AuthorizationServerOperations from ._backend_operations import BackendOperations from ._cache_operations import CacheOperations @@ -35,6 +43,7 @@ from ._api_management_service_skus_operations import ApiManagementServiceSkusOperations from ._api_management_service_operations import ApiManagementServiceOperations from ._diagnostic_operations import DiagnosticOperations +from ._documentation_operations import DocumentationOperations from ._email_template_operations import EmailTemplateOperations from ._gateway_operations import GatewayOperations from ._gateway_hostname_configuration_operations import GatewayHostnameConfigurationOperations @@ -54,6 +63,8 @@ from ._outbound_network_dependencies_endpoints_operations import OutboundNetworkDependenciesEndpointsOperations from ._policy_operations import PolicyOperations from ._policy_description_operations import PolicyDescriptionOperations +from ._policy_fragment_operations import PolicyFragmentOperations +from ._portal_config_operations import PortalConfigOperations from ._portal_revision_operations import PortalRevisionOperations from ._portal_settings_operations import PortalSettingsOperations from ._sign_in_settings_operations import SignInSettingsOperations @@ -65,6 +76,8 @@ from ._product_group_operations import ProductGroupOperations from ._product_subscriptions_operations import ProductSubscriptionsOperations from ._product_policy_operations import ProductPolicyOperations +from ._product_wiki_operations import ProductWikiOperations +from ._product_wikis_operations import ProductWikisOperations from ._quota_by_counter_keys_operations import QuotaByCounterKeysOperations from ._quota_by_period_keys_operations import QuotaByPeriodKeysOperations from ._region_operations import RegionOperations @@ -84,7 +97,7 @@ from ._user_confirmation_password_operations import UserConfirmationPasswordOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -94,6 +107,8 @@ "ApiOperationOperations", "ApiOperationPolicyOperations", "TagOperations", + "GraphQLApiResolverOperations", + "GraphQLApiResolverPolicyOperations", "ApiProductOperations", "ApiPolicyOperations", "ApiSchemaOperations", @@ -103,8 +118,14 @@ "ApiIssueAttachmentOperations", "ApiTagDescriptionOperations", "OperationOperations", + "ApiWikiOperations", + "ApiWikisOperations", "ApiExportOperations", "ApiVersionSetOperations", + "AuthorizationProviderOperations", + "AuthorizationOperations", + "AuthorizationLoginLinksOperations", + "AuthorizationAccessPolicyOperations", "AuthorizationServerOperations", "BackendOperations", "CacheOperations", @@ -117,6 +138,7 @@ "ApiManagementServiceSkusOperations", "ApiManagementServiceOperations", "DiagnosticOperations", + "DocumentationOperations", "EmailTemplateOperations", "GatewayOperations", "GatewayHostnameConfigurationOperations", @@ -136,6 +158,8 @@ "OutboundNetworkDependenciesEndpointsOperations", "PolicyOperations", "PolicyDescriptionOperations", + "PolicyFragmentOperations", + "PortalConfigOperations", "PortalRevisionOperations", "PortalSettingsOperations", "SignInSettingsOperations", @@ -147,6 +171,8 @@ "ProductGroupOperations", "ProductSubscriptionsOperations", "ProductPolicyOperations", + "ProductWikiOperations", + "ProductWikisOperations", "QuotaByCounterKeysOperations", "QuotaByPeriodKeysOperations", "RegionOperations", 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 07ddb202e6f6..38d0699bc3ef 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -39,10 +38,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +74,8 @@ def list_by_service( ) -> AsyncIterable["_models.DiagnosticContract"]: """Lists all diagnostics of an API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -104,10 +100,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiagnosticCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DiagnosticCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -134,7 +128,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -150,7 +144,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -158,14 +152,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DiagnosticCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -178,7 +173,9 @@ 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"} # type: ignore + 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( @@ -186,7 +183,8 @@ async def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -212,10 +210,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -229,10 +225,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -249,7 +246,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" + } @distributed_trace_async async def get( @@ -257,7 +256,8 @@ async def get( ) -> _models.DiagnosticContract: """Gets the details of the Diagnostic for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -283,10 +283,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiagnosticContract] + 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( resource_group_name=resource_group_name, @@ -300,10 +298,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -323,7 +322,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" + } @overload async def create_or_update( @@ -340,7 +341,8 @@ async def create_or_update( ) -> _models.DiagnosticContract: """Creates a new Diagnostic for an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -379,7 +381,8 @@ async def create_or_update( ) -> _models.DiagnosticContract: """Creates a new Diagnostic for an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -416,7 +419,8 @@ async def create_or_update( ) -> _models.DiagnosticContract: """Creates a new Diagnostic for an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -426,7 +430,8 @@ 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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a DiagnosticContract type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -450,11 +455,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiagnosticContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -480,10 +483,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -505,11 +509,13 @@ async def create_or_update( deserialized = self._deserialize("DiagnosticContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" + } @overload async def update( @@ -526,7 +532,8 @@ async def update( ) -> _models.DiagnosticContract: """Updates the details of the Diagnostic for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -565,7 +572,8 @@ async def update( ) -> _models.DiagnosticContract: """Updates the details of the Diagnostic for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -602,7 +610,8 @@ async def update( ) -> _models.DiagnosticContract: """Updates the details of the Diagnostic for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -615,7 +624,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: Diagnostic Update parameters. Is either a model type or a IO type. Required. + :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. @@ -636,11 +646,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiagnosticContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -666,10 +674,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -689,7 +698,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -697,7 +708,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified Diagnostic from an API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -726,10 +738,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -744,10 +754,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -760,4 +771,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" + } 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 f3d7a5450fac..f9e4df4f7cc2 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._api_export_operations import build_get_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,7 +64,8 @@ async def get( """Gets the details of the API specified by its identifier in the format specified to the Storage Blob with SAS Key valid for 5 minutes. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -98,10 +94,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiExportResult] + 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( resource_group_name=resource_group_name, @@ -116,10 +110,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -136,4 +131,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" + } 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 b438f7b6593f..0266194f2e5b 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -38,10 +37,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +74,8 @@ def list_by_service( ) -> AsyncIterable["_models.IssueAttachmentContract"]: """Lists all attachments for the Issue associated with the specified API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -109,10 +105,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueAttachmentCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IssueAttachmentCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -140,7 +134,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -156,7 +150,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -164,14 +158,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IssueAttachmentCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -184,7 +179,9 @@ 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"} # type: ignore + 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( @@ -193,7 +190,8 @@ async def get_entity_tag( """Gets the entity state (Etag) version of the issue Attachment for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -222,10 +220,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -240,10 +236,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -260,7 +257,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) 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}"} # type: ignore + 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( @@ -268,7 +267,8 @@ async def get( ) -> _models.IssueAttachmentContract: """Gets the details of the issue Attachment for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -297,10 +297,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueAttachmentContract] + 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( resource_group_name=resource_group_name, @@ -315,10 +313,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -338,7 +337,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}" + } @overload async def create_or_update( @@ -356,7 +357,8 @@ async def create_or_update( ) -> _models.IssueAttachmentContract: """Creates a new Attachment for the Issue in an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -399,7 +401,8 @@ async def create_or_update( ) -> _models.IssueAttachmentContract: """Creates a new Attachment for the Issue in an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -440,7 +443,8 @@ async def create_or_update( ) -> _models.IssueAttachmentContract: """Creates a new Attachment for the Issue in an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -453,7 +457,8 @@ 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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a IssueAttachmentContract type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.IssueAttachmentContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -477,11 +482,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueAttachmentContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IssueAttachmentContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -508,10 +511,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,11 +537,13 @@ async def create_or_update( deserialized = self._deserialize("IssueAttachmentContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}"} # 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 @@ -552,7 +558,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified comment from an Issue. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -584,10 +591,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -603,10 +608,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -619,4 +625,6 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}" + } 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 e9323ad7235f..f6d8db102547 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -38,10 +37,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +74,8 @@ def list_by_service( ) -> AsyncIterable["_models.IssueCommentContract"]: """Lists all comments for the Issue associated with the specified API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -109,10 +105,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueCommentCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IssueCommentCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -140,7 +134,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -156,7 +150,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -164,14 +158,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IssueCommentCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -184,7 +179,9 @@ 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"} # type: ignore + 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( @@ -193,7 +190,8 @@ async def get_entity_tag( """Gets the entity state (Etag) version of the issue Comment for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -222,10 +220,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -240,10 +236,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -260,7 +257,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) 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}"} # type: ignore + 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( @@ -268,7 +267,8 @@ async def get( ) -> _models.IssueCommentContract: """Gets the details of the issue Comment for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -297,10 +297,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueCommentContract] + 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( resource_group_name=resource_group_name, @@ -315,10 +313,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -338,7 +337,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}" + } @overload async def create_or_update( @@ -356,7 +357,8 @@ async def create_or_update( ) -> _models.IssueCommentContract: """Creates a new Comment for the Issue in an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -399,7 +401,8 @@ async def create_or_update( ) -> _models.IssueCommentContract: """Creates a new Comment for the Issue in an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -440,7 +443,8 @@ async def create_or_update( ) -> _models.IssueCommentContract: """Creates a new Comment for the Issue in an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -453,7 +457,8 @@ 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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a IssueCommentContract type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.IssueCommentContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -477,11 +482,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueCommentContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IssueCommentContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -508,10 +511,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,11 +537,13 @@ async def create_or_update( deserialized = self._deserialize("IssueCommentContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}"} # 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 @@ -552,7 +558,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified comment from an Issue. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -584,10 +591,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -603,10 +608,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -619,4 +625,6 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}" + } 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 04cf4a3be996..a5ea994e8b02 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -39,10 +38,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +75,8 @@ def list_by_service( ) -> AsyncIterable["_models.IssueContract"]: """Lists all issues associated with the specified API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -107,10 +103,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IssueCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -138,7 +132,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -154,7 +148,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -162,14 +156,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IssueCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -182,7 +177,9 @@ 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"} # type: ignore + 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( @@ -190,7 +187,8 @@ async def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the Issue for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -216,10 +214,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -233,10 +229,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -253,7 +250,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" + } @distributed_trace_async async def get( @@ -267,7 +266,8 @@ async def get( ) -> _models.IssueContract: """Gets the details of the Issue for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -295,10 +295,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueContract] + 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( resource_group_name=resource_group_name, @@ -313,10 +311,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -336,7 +335,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" + } @overload async def create_or_update( @@ -353,7 +354,8 @@ async def create_or_update( ) -> _models.IssueContract: """Creates a new Issue for an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -392,7 +394,8 @@ async def create_or_update( ) -> _models.IssueContract: """Creates a new Issue for an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -429,7 +432,8 @@ async def create_or_update( ) -> _models.IssueContract: """Creates a new Issue for an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -439,7 +443,7 @@ 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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a IssueContract type or a IO type. Required. :type parameters: ~azure.mgmt.apimanagement.models.IssueContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -463,11 +467,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IssueContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -493,10 +495,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -518,11 +521,13 @@ async def create_or_update( 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 + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" + } @overload async def update( @@ -539,7 +544,8 @@ async def update( ) -> _models.IssueContract: """Updates an existing issue for an API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -578,7 +584,8 @@ async def update( ) -> _models.IssueContract: """Updates an existing issue for an API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -615,7 +622,8 @@ async def update( ) -> _models.IssueContract: """Updates an existing issue for an API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -628,7 +636,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: Update parameters. Is either a model type or a IO type. Required. + :param parameters: Update parameters. Is either a IssueUpdateContract type or a IO 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. @@ -649,11 +658,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IssueContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -679,10 +686,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -702,7 +710,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -710,7 +720,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified Issue from an API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -739,10 +750,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -757,10 +766,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -773,4 +783,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" + } 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 58ab956cb996..e72db83326cb 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -31,10 +30,6 @@ from ...operations._api_management_client_operations import build_perform_connectivity_check_async_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,11 +53,9 @@ async def _perform_connectivity_check_async_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ConnectivityCheckResponse]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ConnectivityCheckResponse]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -85,10 +78,11 @@ async def _perform_connectivity_check_async_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -107,7 +101,9 @@ async def _perform_connectivity_check_async_initial( return deserialized - _perform_connectivity_check_async_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/connectivityCheck"} # type: ignore + _perform_connectivity_check_async_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/connectivityCheck" + } @overload async def begin_perform_connectivity_check_async( @@ -122,7 +118,8 @@ async def begin_perform_connectivity_check_async( """Performs a connectivity check between the API Management service and a given destination, and returns metrics for the connection, as well as errors encountered while trying to establish it. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -160,7 +157,8 @@ async def begin_perform_connectivity_check_async( """Performs a connectivity check between the API Management service and a given destination, and returns metrics for the connection, as well as errors encountered while trying to establish it. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -195,12 +193,13 @@ async def begin_perform_connectivity_check_async( """Performs a connectivity check between the API Management service and a given destination, and returns metrics for the connection, as well as errors encountered while trying to establish it. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :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 - model type or a IO type. Required. + ConnectivityCheckRequest type or a IO 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'. @@ -223,16 +222,14 @@ async def begin_perform_connectivity_check_async( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectivityCheckResponse] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectivityCheckResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._perform_connectivity_check_async_initial( # type: ignore + raw_result = await self._perform_connectivity_check_async_initial( resource_group_name=resource_group_name, service_name=service_name, connectivity_check_request_params=connectivity_check_request_params, @@ -252,9 +249,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -266,6 +263,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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"} # type: ignore + begin_perform_connectivity_check_async.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/connectivityCheck" + } 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 a0fab23e341c..926a6ed0c2b9 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ...operations._api_management_operations_operations import build_list_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,10 +65,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -93,7 +86,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -109,7 +102,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,14 +110,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -137,4 +131,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.ApiManagement/operations"} # type: ignore + 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 1a73d522826c..38d50b1d8696 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -42,15 +41,12 @@ build_get_sso_token_request, build_list_by_resource_group_request, build_list_request, + build_migrate_to_stv2_request, build_restore_request, build_update_request, ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -92,11 +88,9 @@ async def _restore_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ApiManagementServiceResource]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -119,10 +113,11 @@ async def _restore_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -133,15 +128,21 @@ async def _restore_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _restore_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore"} # type: ignore + _restore_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore" + } @overload async def begin_restore( @@ -157,7 +158,8 @@ async def begin_restore( operation on the current service. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -196,7 +198,8 @@ async def begin_restore( operation on the current service. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -233,12 +236,13 @@ async def begin_restore( operation on the current service. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :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 model type or a IO type. Required. + operation. Is either a ApiManagementServiceBackupRestoreParameters type or a IO type. Required. :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceBackupRestoreParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -261,16 +265,14 @@ async def begin_restore( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_initial( # type: ignore + raw_result = await self._restore_initial( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, @@ -290,9 +292,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -304,9 +306,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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"} # type: ignore + begin_restore.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore" + } async def _backup_initial( self, @@ -326,11 +330,9 @@ async def _backup_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ApiManagementServiceResource]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -353,10 +355,11 @@ async def _backup_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -367,15 +370,21 @@ async def _backup_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _backup_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup"} # type: ignore + _backup_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup" + } @overload async def begin_backup( @@ -390,7 +399,8 @@ async def begin_backup( """Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -427,7 +437,8 @@ async def begin_backup( """Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -462,12 +473,13 @@ async def begin_backup( """Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :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 model type or a IO type. Required. + a ApiManagementServiceBackupRestoreParameters type or a IO type. Required. :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceBackupRestoreParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -490,16 +502,14 @@ async def begin_backup( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._backup_initial( # type: ignore + raw_result = await self._backup_initial( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, @@ -519,9 +529,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -533,9 +543,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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"} # type: ignore + begin_backup.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup" + } async def _create_or_update_initial( self, @@ -543,7 +555,7 @@ async def _create_or_update_initial( service_name: str, parameters: Union[_models.ApiManagementServiceResource, IO], **kwargs: Any - ) -> Optional[_models.ApiManagementServiceResource]: + ) -> _models.ApiManagementServiceResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -555,11 +567,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ApiManagementServiceResource]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -582,20 +592,20 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) @@ -603,11 +613,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" + } @overload async def begin_create_or_update( @@ -622,7 +634,8 @@ async def begin_create_or_update( """Creates or updates an API Management service. This is long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -660,7 +673,8 @@ async def begin_create_or_update( """Creates or updates an API Management service. This is long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -696,12 +710,13 @@ async def begin_create_or_update( """Creates or updates an API Management service. This is long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :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 model type or a IO type. Required. + 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. @@ -723,16 +738,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, @@ -752,7 +765,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -764,9 +777,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" + } async def _update_initial( self, @@ -786,11 +801,9 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ApiManagementServiceResource]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -813,10 +826,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -835,7 +849,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" + } @overload async def begin_update( @@ -849,7 +865,8 @@ async def begin_update( ) -> AsyncLROPoller[_models.ApiManagementServiceResource]: """Updates an existing API Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -886,7 +903,8 @@ async def begin_update( ) -> AsyncLROPoller[_models.ApiManagementServiceResource]: """Updates an existing API Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -921,12 +939,13 @@ async def begin_update( ) -> AsyncLROPoller[_models.ApiManagementServiceResource]: """Updates an existing API Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :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 model type or a IO type. Required. + 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. @@ -948,16 +967,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, @@ -977,7 +994,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -989,9 +1006,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" + } @distributed_trace_async async def get( @@ -999,7 +1018,8 @@ async def get( ) -> _models.ApiManagementServiceResource: """Gets an API Management service resource description. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1019,10 +1039,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceResource] + 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( resource_group_name=resource_group_name, @@ -1034,10 +1052,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1054,7 +1073,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" + } async def _delete_initial( self, resource_group_name: str, service_name: str, **kwargs: Any @@ -1070,10 +1091,8 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ApiManagementServiceResource]] + 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( resource_group_name=resource_group_name, @@ -1085,10 +1104,11 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1107,13 +1127,148 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" + } @distributed_trace_async - async def begin_delete(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ApiManagementServiceResource]: """Deletes an existing API Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :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: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" + } + + async def _migrate_to_stv2_initial( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Optional[_models.ApiManagementServiceResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _migrate_to_stv2_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/migrateToStv2" + } + + @distributed_trace_async + async def begin_migrate_to_stv2( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ApiManagementServiceResource]: + """Upgrades an API Management service to the Stv2 platform. For details refer to + https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation + and could take several minutes to complete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1134,15 +1289,13 @@ async def begin_delete(self, resource_group_name: str, service_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._migrate_to_stv2_initial( resource_group_name=resource_group_name, service_name=service_name, api_version=api_version, @@ -1160,7 +1313,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1172,9 +1327,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_migrate_to_stv2.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/migrateToStv2" + } @distributed_trace def list_by_resource_group( @@ -1182,7 +1339,8 @@ def list_by_resource_group( ) -> AsyncIterable["_models.ApiManagementServiceResource"]: """List all API Management services within a resource group. - :param resource_group_name: The name of the resource group. Required. + :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 @@ -1194,10 +1352,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiManagementServiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1219,7 +1375,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1235,7 +1391,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1243,14 +1399,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ApiManagementServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1263,7 +1420,9 @@ 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"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service" + } @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.ApiManagementServiceResource"]: @@ -1279,10 +1438,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ApiManagementServiceReso _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiManagementServiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1303,7 +1460,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1319,7 +1476,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1327,14 +1484,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ApiManagementServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1347,7 +1505,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service"} @distributed_trace_async async def get_sso_token( @@ -1355,7 +1513,8 @@ async def get_sso_token( ) -> _models.ApiManagementServiceGetSsoTokenResult: """Gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1375,10 +1534,8 @@ async def get_sso_token( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceGetSsoTokenResult] + 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( resource_group_name=resource_group_name, @@ -1390,10 +1547,11 @@ async def get_sso_token( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1410,7 +1568,9 @@ async def get_sso_token( return deserialized - get_sso_token.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/getssotoken"} # type: ignore + get_sso_token.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/getssotoken" + } @overload async def check_name_availability( @@ -1458,7 +1618,7 @@ async def check_name_availability( """Checks availability and correctness of a name for an API Management service. :param parameters: Parameters supplied to the CheckNameAvailability operation. Is either a - model type or a IO type. Required. + ApiManagementServiceCheckNameAvailabilityParameters type or a IO type. Required. :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceCheckNameAvailabilityParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1480,11 +1640,9 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceNameAvailabilityResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiManagementServiceNameAvailabilityResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1505,10 +1663,11 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1525,7 +1684,9 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability" + } @distributed_trace_async async def get_domain_ownership_identifier( @@ -1549,10 +1710,8 @@ async def get_domain_ownership_identifier( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceGetDomainOwnershipIdentifierResult] + 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( subscription_id=self._config.subscription_id, @@ -1562,10 +1721,11 @@ async def get_domain_ownership_identifier( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1582,7 +1742,9 @@ async def get_domain_ownership_identifier( return deserialized - get_domain_ownership_identifier.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier"} # type: ignore + get_domain_ownership_identifier.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier" + } async def _apply_network_configuration_updates_initial( self, @@ -1602,11 +1764,9 @@ async def _apply_network_configuration_updates_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ApiManagementServiceResource]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1632,10 +1792,11 @@ async def _apply_network_configuration_updates_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1646,15 +1807,21 @@ async def _apply_network_configuration_updates_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _apply_network_configuration_updates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates"} # type: ignore + _apply_network_configuration_updates_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates" + } @overload async def begin_apply_network_configuration_updates( @@ -1669,7 +1836,8 @@ async def begin_apply_network_configuration_updates( """Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated DNS changes. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1709,7 +1877,8 @@ async def begin_apply_network_configuration_updates( """Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated DNS changes. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1746,14 +1915,16 @@ async def begin_apply_network_configuration_updates( """Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated DNS changes. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO - type. Default value is None. + updated sequentially without incurring downtime in the region. Is either a + ApiManagementServiceApplyNetworkConfigurationParameters type or a IO 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'. @@ -1776,16 +1947,14 @@ async def begin_apply_network_configuration_updates( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._apply_network_configuration_updates_initial( # type: ignore + raw_result = await self._apply_network_configuration_updates_initial( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, @@ -1805,9 +1974,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1819,6 +1988,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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"} # type: ignore + begin_apply_network_configuration_updates.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates" + } 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 55543d977547..6929dcdc3ec5 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ...operations._api_management_service_skus_operations import build_list_available_service_skus_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,7 +61,8 @@ def list_available_service_skus( Gets all available SKU for a given API Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -79,10 +75,8 @@ def list_available_service_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceSkuResults] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceSkuResults] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -105,7 +99,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -121,7 +115,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -129,14 +123,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ResourceSkuResults", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -149,4 +144,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_available_service_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/skus"} # type: ignore + 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 23aa77bfc44f..109f61cd8b2e 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ...operations._api_management_skus_operations import build_list_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,10 +66,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ApiManagementSku"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementSkusResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiManagementSkusResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -95,7 +88,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -111,7 +104,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -119,14 +112,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ApiManagementSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -139,4 +133,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/skus"} # type: ignore + 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 12ebe51e6486..df25ee3a6ea0 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -39,10 +38,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +75,8 @@ def list_by_api( ) -> AsyncIterable["_models.OperationContract"]: """Lists a collection of the operations for the specified API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -111,10 +107,8 @@ def list_by_api( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -142,7 +136,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -158,7 +152,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -166,14 +160,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,7 +181,9 @@ 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"} # type: ignore + 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( @@ -194,7 +191,8 @@ async def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the API operation specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -220,10 +218,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -237,10 +233,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -257,7 +254,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" + } @distributed_trace_async async def get( @@ -265,7 +264,8 @@ async def get( ) -> _models.OperationContract: """Gets the details of the API Operation specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -291,10 +291,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationContract] + 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( resource_group_name=resource_group_name, @@ -308,10 +306,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -331,7 +330,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" + } @overload async def create_or_update( @@ -348,7 +349,8 @@ async def create_or_update( ) -> _models.OperationContract: """Creates a new operation in the API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -387,7 +389,8 @@ async def create_or_update( ) -> _models.OperationContract: """Creates a new operation in the API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -424,7 +427,8 @@ async def create_or_update( ) -> _models.OperationContract: """Creates a new operation in the API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -434,7 +438,8 @@ 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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a OperationContract type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.OperationContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -458,11 +463,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -488,10 +491,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -513,11 +517,13 @@ async def create_or_update( deserialized = self._deserialize("OperationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" + } @overload async def update( @@ -534,7 +540,8 @@ async def update( ) -> _models.OperationContract: """Updates the details of the operation in the API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -573,7 +580,8 @@ async def update( ) -> _models.OperationContract: """Updates the details of the operation in the API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -610,7 +618,8 @@ async def update( ) -> _models.OperationContract: """Updates the details of the operation in the API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -623,8 +632,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: API Operation Update parameters. Is either a model type or a IO type. - Required. + :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. @@ -645,11 +654,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -675,10 +682,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -698,7 +706,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -706,7 +716,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified operation in the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -735,10 +746,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -753,10 +762,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -769,4 +779,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" + } 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 cc9452116ce8..e0211678c102 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -35,10 +34,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +63,8 @@ async def list_by_operation( ) -> _models.PolicyCollection: """Get the list of policy configuration at the API Operation level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -94,10 +90,8 @@ async def list_by_operation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyCollection] + 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( resource_group_name=resource_group_name, @@ -111,10 +105,11 @@ async def list_by_operation( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -131,7 +126,9 @@ async def list_by_operation( return deserialized - list_by_operation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies"} # type: ignore + list_by_operation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies" + } @distributed_trace_async async def get_entity_tag( @@ -145,7 +142,8 @@ async def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the API operation policy specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -173,10 +171,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -191,10 +187,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -211,7 +208,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) 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}"} # type: ignore + 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( @@ -226,7 +225,8 @@ async def get( ) -> _models.PolicyContract: """Get the policy configuration at the API Operation level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -257,10 +257,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyContract] + 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( resource_group_name=resource_group_name, @@ -276,10 +274,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -299,7 +298,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}" + } @overload async def create_or_update( @@ -317,7 +318,8 @@ async def create_or_update( ) -> _models.PolicyContract: """Creates or updates policy configuration for the API Operation level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -359,7 +361,8 @@ async def create_or_update( ) -> _models.PolicyContract: """Creates or updates policy configuration for the API Operation level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -399,7 +402,8 @@ async def create_or_update( ) -> _models.PolicyContract: """Creates or updates policy configuration for the API Operation level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -411,7 +415,8 @@ 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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -435,11 +440,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -466,10 +469,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -491,11 +495,13 @@ async def create_or_update( deserialized = self._deserialize("PolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}"} # 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 @@ -510,7 +516,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the policy configuration at the Api Operation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -541,10 +548,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -560,10 +565,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -576,4 +582,6 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}" + } 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 74e07181c1c7..900226c8a735 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -42,10 +41,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +78,11 @@ def list_by_service( ) -> AsyncIterable["_models.ApiContract"]: """Lists all APIs of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-create-apis + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -113,10 +112,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -144,7 +141,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -160,7 +157,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -168,14 +165,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ApiCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,13 +186,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -217,10 +218,8 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, api_ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -233,10 +232,11 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, api_ params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -253,13 +253,16 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, api_ return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -282,10 +285,8 @@ async def get(self, resource_group_name: str, service_name: str, api_id: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiContract] + 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( resource_group_name=resource_group_name, @@ -298,10 +299,11 @@ async def get(self, resource_group_name: str, service_name: str, api_id: str, ** params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -321,7 +323,9 @@ async def get(self, resource_group_name: str, service_name: str, api_id: str, ** return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" + } async def _create_or_update_initial( self, @@ -343,11 +347,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ApiContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ApiContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -372,10 +374,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -402,7 +405,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" + } @overload async def begin_create_or_update( @@ -418,7 +423,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.ApiContract]: """Creates new or updates existing specified API of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -461,7 +467,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.ApiContract]: """Creates new or updates existing specified API of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -502,14 +509,16 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.ApiContract]: """Creates new or updates existing specified API of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: 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 - :param parameters: Create or update parameters. Is either a model type or a IO type. Required. + :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 :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -533,16 +542,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiContract] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiContract] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -568,9 +575,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -582,9 +589,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" + } @overload async def update( @@ -600,7 +609,8 @@ async def update( ) -> _models.ApiContract: """Updates the specified API of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -635,7 +645,8 @@ async def update( ) -> _models.ApiContract: """Updates the specified API of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -668,7 +679,8 @@ async def update( ) -> _models.ApiContract: """Updates the specified API of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -678,8 +690,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: API Update Contract parameters. Is either a model type or a IO type. - Required. + :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. @@ -700,11 +712,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -729,10 +739,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -752,7 +763,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -766,7 +779,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified API of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -794,10 +808,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -812,10 +824,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -828,7 +841,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" + } @distributed_trace def list_by_tags( @@ -843,7 +858,8 @@ def list_by_tags( ) -> AsyncIterable["_models.TagResourceContract"]: """Lists a collection of apis associated with tags. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -873,10 +889,8 @@ def list_by_tags( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagResourceCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TagResourceCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -903,7 +917,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -919,7 +933,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -927,14 +941,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TagResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -947,4 +962,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apisByTags"} # type: ignore + 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 eff1bcd22ce5..e5b286250df2 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -35,10 +34,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +63,8 @@ async def list_by_api( ) -> _models.PolicyCollection: """Get the policy configuration at the API level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -91,10 +87,8 @@ async def list_by_api( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyCollection] + 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( resource_group_name=resource_group_name, @@ -107,10 +101,11 @@ async def list_by_api( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -127,7 +122,9 @@ async def list_by_api( return deserialized - list_by_api.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies"} # type: ignore + list_by_api.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies" + } @distributed_trace_async async def get_entity_tag( @@ -140,7 +137,8 @@ async def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the API policy specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -165,10 +163,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -182,10 +178,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -202,7 +199,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}" + } @distributed_trace_async async def get( @@ -216,7 +215,8 @@ async def get( ) -> _models.PolicyContract: """Get the policy configuration at the API level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -244,10 +244,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyContract] + 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( resource_group_name=resource_group_name, @@ -262,10 +260,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -287,11 +286,13 @@ async def get( deserialized = self._deserialize("PolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}" + } @overload async def create_or_update( @@ -308,7 +309,8 @@ async def create_or_update( ) -> _models.PolicyContract: """Creates or updates policy configuration for the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -346,7 +348,8 @@ async def create_or_update( ) -> _models.PolicyContract: """Creates or updates policy configuration for the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -382,7 +385,8 @@ async def create_or_update( ) -> _models.PolicyContract: """Creates or updates policy configuration for the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -391,7 +395,8 @@ 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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -415,11 +420,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -445,10 +448,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -470,11 +474,13 @@ async def create_or_update( deserialized = self._deserialize("PolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}"} # 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 @@ -488,7 +494,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the policy configuration at the Api. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -516,10 +523,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -534,10 +539,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -550,4 +556,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}" + } 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 9519acf7c512..0140e7637b02 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ...operations._api_product_operations import build_list_by_apis_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +66,8 @@ def list_by_apis( ) -> AsyncIterable["_models.ProductContract"]: """Lists all Products, which the API is part of. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -96,10 +92,8 @@ def list_by_apis( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProductCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProductCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -126,7 +120,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -142,7 +136,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -150,14 +144,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProductCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -170,4 +165,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_apis.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/products"} # type: ignore + 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 09c6b002899d..edfefbee6838 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -39,10 +38,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +76,8 @@ def list_by_service( Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -106,10 +102,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiReleaseCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiReleaseCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -136,7 +130,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -152,7 +146,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -160,14 +154,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ApiReleaseCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -180,7 +175,9 @@ 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"} # type: ignore + 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( @@ -188,7 +185,8 @@ async def get_entity_tag( ) -> bool: """Returns the etag of an API release. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -214,10 +212,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -231,10 +227,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,7 +248,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" + } @distributed_trace_async async def get( @@ -259,7 +258,8 @@ async def get( ) -> _models.ApiReleaseContract: """Returns the details of an API release. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -285,10 +285,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiReleaseContract] + 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( resource_group_name=resource_group_name, @@ -302,10 +300,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -325,7 +324,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" + } @overload async def create_or_update( @@ -342,7 +343,8 @@ async def create_or_update( ) -> _models.ApiReleaseContract: """Creates a new Release for the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -381,7 +383,8 @@ async def create_or_update( ) -> _models.ApiReleaseContract: """Creates a new Release for the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -418,7 +421,8 @@ async def create_or_update( ) -> _models.ApiReleaseContract: """Creates a new Release for the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -428,7 +432,8 @@ 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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a ApiReleaseContract type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -452,11 +457,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiReleaseContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiReleaseContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -482,10 +485,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -507,11 +511,13 @@ async def create_or_update( deserialized = self._deserialize("ApiReleaseContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" + } @overload async def update( @@ -528,7 +534,8 @@ async def update( ) -> _models.ApiReleaseContract: """Updates the details of the release of the API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -567,7 +574,8 @@ async def update( ) -> _models.ApiReleaseContract: """Updates the details of the release of the API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -604,7 +612,8 @@ async def update( ) -> _models.ApiReleaseContract: """Updates the details of the release of the API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -617,8 +626,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: API Release Update parameters. Is either a model type or a IO type. - Required. + :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. @@ -639,11 +648,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiReleaseContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiReleaseContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -669,10 +676,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -692,7 +700,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -700,7 +710,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified release in the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -729,10 +740,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -747,10 +756,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -763,4 +773,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" + } 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 f2d3a0e416f3..643aa10cf83f 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ...operations._api_revision_operations import build_list_by_service_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +66,8 @@ def list_by_service( ) -> AsyncIterable["_models.ApiRevisionContract"]: """Lists all revisions of an API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -96,10 +92,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiRevisionCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiRevisionCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -126,7 +120,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -142,7 +136,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -150,14 +144,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ApiRevisionCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -170,4 +165,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}/revisions"} # type: ignore + 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 a7d722335536..b14450787de4 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +39,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +75,8 @@ def list_by_api( ) -> AsyncIterable["_models.SchemaContract"]: """Get the schema configuration at the API level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -105,10 +101,8 @@ def list_by_api( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SchemaCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SchemaCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -135,7 +129,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -151,7 +145,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -159,14 +153,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SchemaCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -179,7 +174,9 @@ 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"} # type: ignore + 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( @@ -187,7 +184,8 @@ async def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the schema specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -213,10 +211,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -230,10 +226,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -250,7 +247,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" + } @distributed_trace_async async def get( @@ -258,7 +257,8 @@ async def get( ) -> _models.SchemaContract: """Get the schema configuration at the API level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -284,10 +284,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SchemaContract] + 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( resource_group_name=resource_group_name, @@ -301,10 +299,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -324,7 +323,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" + } async def _create_or_update_initial( self, @@ -347,11 +348,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SchemaContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SchemaContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -377,10 +376,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -407,7 +407,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" + } @overload async def begin_create_or_update( @@ -424,7 +426,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.SchemaContract]: """Creates or updates schema configuration for the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -471,7 +474,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.SchemaContract]: """Creates or updates schema configuration for the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -516,7 +520,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.SchemaContract]: """Creates or updates schema configuration for the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -526,7 +531,8 @@ 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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -550,16 +556,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SchemaContract] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SchemaContract] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -586,9 +590,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -600,9 +604,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -617,7 +623,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the schema configuration at the Api. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -649,10 +656,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -668,10 +673,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -684,4 +690,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" + } 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 dbf794de78c0..b8585a855624 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -38,10 +37,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +74,8 @@ def list_by_service( """Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -106,10 +102,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagDescriptionCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TagDescriptionCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -136,7 +130,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -152,7 +146,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -160,14 +154,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TagDescriptionCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -180,7 +175,9 @@ 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"} # type: ignore + 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( @@ -188,7 +185,8 @@ async def get_entity_tag( ) -> bool: """Gets the entity state version of the tag specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -214,10 +212,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -231,10 +227,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,7 +248,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}" + } @distributed_trace_async async def get( @@ -259,7 +258,8 @@ async def get( ) -> _models.TagDescriptionContract: """Get Tag description in scope of API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -285,10 +285,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagDescriptionContract] + 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( resource_group_name=resource_group_name, @@ -302,10 +300,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -325,7 +324,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}" + } @overload async def create_or_update( @@ -342,7 +343,8 @@ async def create_or_update( ) -> _models.TagDescriptionContract: """Create/Update tag description in scope of the Api. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -381,7 +383,8 @@ async def create_or_update( ) -> _models.TagDescriptionContract: """Create/Update tag description in scope of the Api. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -418,7 +421,8 @@ async def create_or_update( ) -> _models.TagDescriptionContract: """Create/Update tag description in scope of the Api. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -428,7 +432,8 @@ 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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a TagDescriptionCreateParameters type or a IO + type. Required. :type parameters: ~azure.mgmt.apimanagement.models.TagDescriptionCreateParameters or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -452,11 +457,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagDescriptionContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TagDescriptionContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -482,10 +485,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -507,11 +511,13 @@ async def create_or_update( deserialized = self._deserialize("TagDescriptionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}"} # 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 @@ -525,7 +531,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete tag description for the Api. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -554,10 +561,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -572,10 +577,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -588,4 +594,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}" + } 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 e61db53b5f45..03f4a831e192 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -39,10 +38,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +73,8 @@ def list_by_service( ) -> AsyncIterable["_models.ApiVersionSetContract"]: """Lists a collection of API Version Sets in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -100,10 +96,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiVersionSetCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiVersionSetCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -129,7 +123,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -145,7 +139,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -153,14 +147,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ApiVersionSetCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -173,7 +168,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets" + } @distributed_trace_async async def get_entity_tag( @@ -181,7 +178,8 @@ async def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the Api Version Set specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -204,10 +202,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -220,10 +216,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,7 +237,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" + } @distributed_trace_async async def get( @@ -248,7 +247,8 @@ async def get( ) -> _models.ApiVersionSetContract: """Gets the details of the Api Version Set specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -271,10 +271,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiVersionSetContract] + 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( resource_group_name=resource_group_name, @@ -287,10 +285,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -310,7 +309,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" + } @overload async def create_or_update( @@ -326,7 +327,8 @@ async def create_or_update( ) -> _models.ApiVersionSetContract: """Creates or Updates a Api Version Set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -361,7 +363,8 @@ async def create_or_update( ) -> _models.ApiVersionSetContract: """Creates or Updates a Api Version Set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -394,14 +397,16 @@ async def create_or_update( ) -> _models.ApiVersionSetContract: """Creates or Updates a Api Version Set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -425,11 +430,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiVersionSetContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiVersionSetContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -454,10 +457,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -479,11 +483,13 @@ async def create_or_update( deserialized = self._deserialize("ApiVersionSetContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" + } @overload async def update( @@ -499,7 +505,8 @@ async def update( ) -> _models.ApiVersionSetContract: """Updates the details of the Api VersionSet specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -534,7 +541,8 @@ async def update( ) -> _models.ApiVersionSetContract: """Updates the details of the Api VersionSet specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -567,7 +575,8 @@ async def update( ) -> _models.ApiVersionSetContract: """Updates the details of the Api VersionSet specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -577,7 +586,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -598,11 +608,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiVersionSetContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiVersionSetContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -627,10 +635,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -650,7 +659,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -658,7 +669,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific Api Version Set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -684,10 +696,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -701,10 +711,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -717,4 +728,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" + } 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 new file mode 100644 index 000000000000..7e7f81c9ed49 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wiki_operations.py @@ -0,0 +1,615 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._api_wiki_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_entity_tag_request, + build_get_request, + build_update_request, +) +from .._vendor import ApiManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ApiWikiOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s + :attr:`api_wiki` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get_entity_tag(self, resource_group_name: str, service_name: str, api_id: str, **kwargs: Any) -> bool: + """Gets the entity state (Etag) version of the Wiki for an API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if cls: + return cls(pipeline_response, None, response_headers) + 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 + ) -> _models.WikiContract: + """Gets the details of the Wiki for an API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WikiContract] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("WikiContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + parameters: _models.WikiContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WikiContract: + """Creates a new Wiki for an API or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param api_id: API identifier. Must be unique in the current API Management service instance. + Required. + :type api_id: str + :param parameters: Create parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.WikiContract + :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 JSON body. + Default 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: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WikiContract: + """Creates a new Wiki for an API or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param api_id: API identifier. Must be unique in the current API Management service instance. + Required. + :type api_id: str + :param parameters: Create parameters. Required. + :type parameters: IO + :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: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + parameters: Union[_models.WikiContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> _models.WikiContract: + """Creates a new Wiki for an API or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WikiContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "WikiContract", is_xml=True) + + request = build_create_or_update_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, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("WikiContract", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("WikiContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + 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, + resource_group_name: str, + service_name: str, + api_id: str, + if_match: str, + parameters: _models.WikiUpdateContract, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WikiContract: + """Updates the details of the Wiki for an API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param api_id: API identifier. Must be unique in the current API Management service instance. + Required. + :type api_id: str + :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. Required. + :type parameters: ~azure.mgmt.apimanagement.models.WikiUpdateContract + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default 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: + """ + + @overload + async def update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + if_match: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WikiContract: + """Updates the details of the Wiki for an API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param api_id: API identifier. Must be unique in the current API Management service instance. + Required. + :type api_id: str + :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. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WikiContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.WikiContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + if_match: str, + parameters: Union[_models.WikiUpdateContract, IO], + **kwargs: Any + ) -> _models.WikiContract: + """Updates the details of the Wiki for an API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param api_id: API identifier. Must be unique in the current API Management service instance. + Required. + :type api_id: str + :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 + :return: WikiContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.WikiContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WikiContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "WikiUpdateContract") + + request = build_update_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, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("WikiContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, api_id: str, if_match: str, **kwargs: Any + ) -> None: + """Deletes the specified Wiki from an API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param api_id: API identifier. Must be unique in the current API Management service instance. + Required. + :type api_id: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" + } 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 new file mode 100644 index 000000000000..7fd8aac8c7db --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wikis_operations.py @@ -0,0 +1,168 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._api_wikis_operations import build_list_request +from .._vendor import ApiManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ApiWikisOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s + :attr:`api_wikis` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + api_id: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.WikiContract"]: + """Gets the wikis for an API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param api_id: API identifier. Must be unique in the current API Management service instance. + Required. + :type api_id: str + :param filter: | Field | Usage | Supported operators | Supported + functions |
|-------------|-------------|-------------|-------------|
| name | + filter | eq | contains |
. Default value is None. + :type filter: str + :param top: Number of records to return. Default value is None. + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WikiCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WikiCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 new file mode 100644 index 000000000000..33f362f9ee5b --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_access_policy_operations.py @@ -0,0 +1,540 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._authorization_access_policy_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_authorization_request, +) +from .._vendor import ApiManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AuthorizationAccessPolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s + :attr:`authorization_access_policy` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_authorization( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AuthorizationAccessPolicyContract"]: + """Lists a collection of authorization access policy defined within a authorization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :param filter: | Field | Usage | Supported operators | Supported + functions |
|-------------|-------------|-------------|-------------|
| name | + filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
| + displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith + |
. Default value is None. + :type filter: str + :param top: Number of records to return. Default value is None. + :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: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AuthorizationAccessPolicyCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_authorization_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, + filter=filter, + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AuthorizationAccessPolicyCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_authorization.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + authorization_access_policy_id: str, + **kwargs: Any + ) -> _models.AuthorizationAccessPolicyContract: + """Gets the details of the authorization access policy specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AuthorizationAccessPolicyContract] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + authorization_provider_id=authorization_provider_id, + authorization_id=authorization_id, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationAccessPolicyContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + authorization_access_policy_id: str, + parameters: _models.AuthorizationAccessPolicyContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AuthorizationAccessPolicyContract: + """Creates or updates Authorization Access Policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :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: ~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract + :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 JSON body. + Default 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: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + authorization_access_policy_id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AuthorizationAccessPolicyContract: + """Creates or updates Authorization Access Policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :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 + :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: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + authorization_access_policy_id: str, + parameters: Union[_models.AuthorizationAccessPolicyContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> _models.AuthorizationAccessPolicyContract: + """Creates or updates Authorization Access Policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :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 + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AuthorizationAccessPolicyContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AuthorizationAccessPolicyContract", is_xml=True) + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + authorization_provider_id=authorization_provider_id, + authorization_id=authorization_id, + authorization_access_policy_id=authorization_access_policy_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationAccessPolicyContract", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationAccessPolicyContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + 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, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + authorization_access_policy_id: str, + if_match: str, + **kwargs: Any + ) -> None: + """Deletes specific access policy from the Authorization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :param authorization_access_policy_id: Identifier of the authorization access policy. Required. + :type authorization_access_policy_id: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + authorization_provider_id=authorization_provider_id, + authorization_id=authorization_id, + authorization_access_policy_id=authorization_access_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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId}" + } 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 new file mode 100644 index 000000000000..7689d35a7822 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_login_links_operations.py @@ -0,0 +1,218 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._authorization_login_links_operations import build_post_request +from .._vendor import ApiManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AuthorizationLoginLinksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s + :attr:`authorization_login_links` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def post( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + parameters: _models.AuthorizationLoginRequestContract, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AuthorizationLoginResponseContract: + """Gets authorization login links. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :param parameters: Create parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationLoginRequestContract + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default 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: + """ + + @overload + async def post( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AuthorizationLoginResponseContract: + """Gets authorization login links. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :param parameters: Create parameters. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AuthorizationLoginResponseContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.AuthorizationLoginResponseContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + parameters: Union[_models.AuthorizationLoginRequestContract, IO], + **kwargs: Any + ) -> _models.AuthorizationLoginResponseContract: + """Gets authorization login links. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :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 + :return: AuthorizationLoginResponseContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.AuthorizationLoginResponseContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AuthorizationLoginResponseContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AuthorizationLoginRequestContract") + + request = build_post_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, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationLoginResponseContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + post.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/getLoginLinks" + } 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 new file mode 100644 index 000000000000..377e90e14e12 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_operations.py @@ -0,0 +1,683 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._authorization_operations import ( + build_confirm_consent_code_request, + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_authorization_provider_request, +) +from .._vendor import ApiManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AuthorizationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s + :attr:`authorization` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_authorization_provider( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AuthorizationContract"]: + """Lists a collection of authorization providers defined within a authorization provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param filter: | Field | Usage | Supported operators | Supported + functions |
|-------------|-------------|-------------|-------------|
| name | + filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
| + displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith + |
. Default value is None. + :type filter: str + :param top: Number of records to return. Default value is None. + :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.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.AuthorizationContract] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AuthorizationCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_authorization_provider_request( + resource_group_name=resource_group_name, + service_name=service_name, + authorization_provider_id=authorization_provider_id, + subscription_id=self._config.subscription_id, + filter=filter, + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AuthorizationCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_authorization_provider.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + **kwargs: Any + ) -> _models.AuthorizationContract: + """Gets the details of the authorization specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AuthorizationContract] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + parameters: _models.AuthorizationContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AuthorizationContract: + """Creates or updates authorization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :param parameters: Create parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationContract + :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 JSON body. + Default 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: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AuthorizationContract: + """Creates or updates authorization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :param parameters: Create parameters. Required. + :type parameters: IO + :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: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + parameters: Union[_models.AuthorizationContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> _models.AuthorizationContract: + """Creates or updates authorization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :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 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AuthorizationContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AuthorizationContract", is_xml=True) + + request = build_create_or_update_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, + if_match=if_match, + api_version=api_version, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationContract", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + 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, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + if_match: str, + **kwargs: Any + ) -> None: + """Deletes specific Authorization from the Authorization provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + authorization_provider_id=authorization_provider_id, + authorization_id=authorization_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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}" + } + + @overload + async def confirm_consent_code( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + parameters: _models.AuthorizationConfirmConsentCodeRequestContract, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Confirm valid consent code to suppress Authorizations anti-phishing page. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :param parameters: Create parameters. Required. + :type parameters: + ~azure.mgmt.apimanagement.models.AuthorizationConfirmConsentCodeRequestContract + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default 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: + """ + + @overload + async def confirm_consent_code( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Confirm valid consent code to suppress Authorizations anti-phishing page. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :param parameters: Create parameters. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def confirm_consent_code( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + parameters: Union[_models.AuthorizationConfirmConsentCodeRequestContract, IO], + **kwargs: Any + ) -> None: + """Confirm valid consent code to suppress Authorizations anti-phishing page. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :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. + :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 + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AuthorizationConfirmConsentCodeRequestContract") + + request = build_confirm_consent_code_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, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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" + } 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 new file mode 100644 index 000000000000..30b68f767675 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_provider_operations.py @@ -0,0 +1,487 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._authorization_provider_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_service_request, +) +from .._vendor import ApiManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AuthorizationProviderOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s + :attr:`authorization_provider` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_service( + self, + resource_group_name: str, + service_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AuthorizationProviderContract"]: + """Lists a collection of authorization providers defined within a service instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param filter: | Field | Usage | Supported operators | Supported + functions |
|-------------|-------------|-------------|-------------|
| name | + filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
| + displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith + |
. Default value is None. + :type filter: str + :param top: Number of records to return. Default value is None. + :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: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.AuthorizationProviderContract] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AuthorizationProviderCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AuthorizationProviderCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_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 + ) -> _models.AuthorizationProviderContract: + """Gets the details of the authorization provider specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AuthorizationProviderContract] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationProviderContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + parameters: _models.AuthorizationProviderContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AuthorizationProviderContract: + """Creates or updates authorization provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param parameters: Create parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationProviderContract + :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 JSON body. + Default 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: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AuthorizationProviderContract: + """Creates or updates authorization provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param parameters: Create parameters. Required. + :type parameters: IO + :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: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + parameters: Union[_models.AuthorizationProviderContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> _models.AuthorizationProviderContract: + """Creates or updates authorization provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :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 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AuthorizationProviderContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AuthorizationProviderContract", is_xml=True) + + request = build_create_or_update_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, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationProviderContract", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationProviderContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + 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 + ) -> None: + """Deletes specific authorization provider from the API Management service instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}" + } 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 bf9c30e72d5f..13088281ac92 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -40,10 +39,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +74,8 @@ def list_by_service( ) -> AsyncIterable["_models.AuthorizationServerContract"]: """Lists a collection of authorization servers defined within a service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -103,10 +99,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AuthorizationServerCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AuthorizationServerCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -132,7 +126,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -148,7 +142,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -156,14 +150,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AuthorizationServerCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,13 +171,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -204,10 +202,8 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, auth _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -220,10 +216,11 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, auth params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,7 +237,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, auth return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" + } @distributed_trace_async async def get( @@ -248,7 +247,8 @@ async def get( ) -> _models.AuthorizationServerContract: """Gets the details of the authorization server specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -270,10 +270,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AuthorizationServerContract] + 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( resource_group_name=resource_group_name, @@ -286,10 +284,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -309,7 +308,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" + } @overload async def create_or_update( @@ -325,7 +326,8 @@ async def create_or_update( ) -> _models.AuthorizationServerContract: """Creates new authorization server or updates an existing authorization server. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -359,7 +361,8 @@ async def create_or_update( ) -> _models.AuthorizationServerContract: """Creates new authorization server or updates an existing authorization server. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -391,13 +394,15 @@ async def create_or_update( ) -> _models.AuthorizationServerContract: """Creates new authorization server or updates an existing authorization server. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :param authsid: Identifier of the authorization server. Required. :type authsid: str - :param parameters: Create or update parameters. Is either a model type or a IO type. Required. + :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 :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -421,11 +426,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AuthorizationServerContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AuthorizationServerContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -450,10 +453,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -475,11 +479,13 @@ async def create_or_update( deserialized = self._deserialize("AuthorizationServerContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" + } @overload async def update( @@ -495,7 +501,8 @@ async def update( ) -> _models.AuthorizationServerContract: """Updates the details of the authorization server specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -529,7 +536,8 @@ async def update( ) -> _models.AuthorizationServerContract: """Updates the details of the authorization server specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -561,7 +569,8 @@ async def update( ) -> _models.AuthorizationServerContract: """Updates the details of the authorization server specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -570,8 +579,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: OAuth2 Server settings Update parameters. Is either a model type or a IO - type. Required. + :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. @@ -592,11 +601,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AuthorizationServerContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AuthorizationServerContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -621,10 +628,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -644,7 +652,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -652,7 +662,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific authorization server instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -677,10 +688,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -694,10 +703,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -710,7 +720,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" + } @distributed_trace_async async def list_secrets( @@ -718,7 +730,8 @@ async def list_secrets( ) -> _models.AuthorizationServerSecretsContract: """Gets the client secret details of the authorization server. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -740,10 +753,8 @@ async def list_secrets( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AuthorizationServerSecretsContract] + 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( resource_group_name=resource_group_name, @@ -756,10 +767,11 @@ async def list_secrets( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -779,4 +791,6 @@ async def list_secrets( return deserialized - list_secrets.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}/listSecrets"} # type: ignore + list_secrets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}/listSecrets" + } 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 d9db19622a66..15a595c9d041 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -40,10 +39,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +74,8 @@ def list_by_service( ) -> AsyncIterable["_models.BackendContract"]: """Lists a collection of backends in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -103,10 +99,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackendCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BackendCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -132,7 +126,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -148,7 +142,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -156,14 +150,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BackendCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,13 +171,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -205,10 +203,8 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, back _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -221,10 +217,11 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, back params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -241,7 +238,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, back return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" + } @distributed_trace_async async def get( @@ -249,7 +248,8 @@ async def get( ) -> _models.BackendContract: """Gets the details of the backend specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -272,10 +272,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackendContract] + 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( resource_group_name=resource_group_name, @@ -288,10 +286,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -311,7 +310,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" + } @overload async def create_or_update( @@ -327,7 +328,8 @@ async def create_or_update( ) -> _models.BackendContract: """Creates or Updates a backend. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -362,7 +364,8 @@ async def create_or_update( ) -> _models.BackendContract: """Creates or Updates a backend. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -395,14 +398,15 @@ async def create_or_update( ) -> _models.BackendContract: """Creates or Updates a backend. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a BackendContract type or a IO type. Required. :type parameters: ~azure.mgmt.apimanagement.models.BackendContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -426,11 +430,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackendContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackendContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -455,10 +457,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -480,11 +483,13 @@ async def create_or_update( deserialized = self._deserialize("BackendContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" + } @overload async def update( @@ -500,7 +505,8 @@ async def update( ) -> _models.BackendContract: """Updates an existing backend. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -535,7 +541,8 @@ async def update( ) -> _models.BackendContract: """Updates an existing backend. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -568,7 +575,8 @@ async def update( ) -> _models.BackendContract: """Updates an existing backend. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -578,7 +586,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -599,11 +608,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackendContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackendContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -628,10 +635,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -651,7 +659,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -659,7 +669,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified backend. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -685,10 +696,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -702,10 +711,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -718,7 +728,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" + } @overload async def reconnect( # pylint: disable=inconsistent-return-statements @@ -731,10 +743,11 @@ async def reconnect( # pylint: disable=inconsistent-return-statements content_type: str = "application/json", **kwargs: Any ) -> None: - """Notifies the APIM proxy to create a new connection to the backend after the specified timeout. - If no timeout was specified, timeout of 2 minutes is used. + """Notifies the API Management gateway to create a new connection to the backend after the + specified timeout. If no timeout was specified, timeout of 2 minutes is used. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -763,10 +776,11 @@ async def reconnect( # pylint: disable=inconsistent-return-statements content_type: str = "application/json", **kwargs: Any ) -> None: - """Notifies the APIM proxy to create a new connection to the backend after the specified timeout. - If no timeout was specified, timeout of 2 minutes is used. + """Notifies the API Management gateway to create a new connection to the backend after the + specified timeout. If no timeout was specified, timeout of 2 minutes is used. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -793,18 +807,19 @@ async def reconnect( # pylint: disable=inconsistent-return-statements parameters: Optional[Union[_models.BackendReconnectContract, IO]] = None, **kwargs: Any ) -> None: - """Notifies the APIM proxy to create a new connection to the backend after the specified timeout. - If no timeout was specified, timeout of 2 minutes is used. + """Notifies the API Management gateway to create a new connection to the backend after the + specified timeout. If no timeout was specified, timeout of 2 minutes is used. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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: Reconnect request parameters. Is either a model type or a IO type. Default - value is None. + :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. @@ -825,11 +840,9 @@ async def reconnect( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -856,10 +869,11 @@ async def reconnect( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -872,4 +886,6 @@ async def reconnect( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - reconnect.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}/reconnect"} # type: ignore + reconnect.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}/reconnect" + } 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 58fc2f639530..74922b065f04 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -39,10 +38,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +72,8 @@ def list_by_service( ) -> AsyncIterable["_models.CacheContract"]: """Lists a collection of all external Caches in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -93,10 +89,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CacheCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CacheCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -121,7 +115,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -137,7 +131,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -145,14 +139,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CacheCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -165,13 +160,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -194,10 +192,8 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, cach _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -210,10 +206,11 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, cach params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -230,7 +227,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, cach return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" + } @distributed_trace_async async def get( @@ -238,7 +237,8 @@ async def get( ) -> _models.CacheContract: """Gets the details of the Cache specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -261,10 +261,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CacheContract] + 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( resource_group_name=resource_group_name, @@ -277,10 +275,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -300,7 +299,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" + } @overload async def create_or_update( @@ -316,7 +317,11 @@ async def create_or_update( ) -> _models.CacheContract: """Creates or updates an External Cache to be used in Api Management instance. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-cache-external + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -351,7 +356,11 @@ async def create_or_update( ) -> _models.CacheContract: """Creates or updates an External Cache to be used in Api Management instance. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-cache-external + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -384,14 +393,19 @@ async def create_or_update( ) -> _models.CacheContract: """Creates or updates an External Cache to be used in Api Management instance. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-cache-external + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -415,11 +429,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CacheContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CacheContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -444,10 +456,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -469,11 +482,13 @@ async def create_or_update( deserialized = self._deserialize("CacheContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" + } @overload async def update( @@ -489,7 +504,8 @@ async def update( ) -> _models.CacheContract: """Updates the details of the cache specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -524,7 +540,8 @@ async def update( ) -> _models.CacheContract: """Updates the details of the cache specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -557,7 +574,8 @@ async def update( ) -> _models.CacheContract: """Updates the details of the cache specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -567,7 +585,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -588,11 +607,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CacheContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CacheContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -617,10 +634,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -640,7 +658,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -648,7 +668,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific Cache. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -674,10 +695,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -691,10 +710,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -707,4 +727,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" + } 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 cb12c9d7a910..6d093b06041b 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -39,10 +38,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +74,8 @@ def list_by_service( ) -> AsyncIterable["_models.CertificateContract"]: """Lists a collection of all certificates in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -106,10 +102,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CertificateCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -136,7 +130,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -152,7 +146,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -160,14 +154,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CertificateCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -180,7 +175,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates" + } @distributed_trace_async async def get_entity_tag( @@ -188,7 +185,8 @@ async def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the certificate specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -211,10 +209,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -227,10 +223,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -247,7 +244,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}" + } @distributed_trace_async async def get( @@ -255,7 +254,8 @@ async def get( ) -> _models.CertificateContract: """Gets the details of the certificate specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -278,10 +278,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateContract] + 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( resource_group_name=resource_group_name, @@ -294,10 +292,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -317,7 +316,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}" + } @overload async def create_or_update( @@ -333,7 +334,12 @@ async def create_or_update( ) -> _models.CertificateContract: """Creates or updates the certificate being used for authentication with the backend. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-howto-mutual-certificates/ + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -368,7 +374,12 @@ async def create_or_update( ) -> _models.CertificateContract: """Creates or updates the certificate being used for authentication with the backend. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-howto-mutual-certificates/ + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -401,14 +412,20 @@ async def create_or_update( ) -> _models.CertificateContract: """Creates or updates the certificate being used for authentication with the backend. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-howto-mutual-certificates/ + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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: Create or Update parameters. Is either a model type or a IO type. Required. + :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 :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -432,11 +449,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -461,10 +476,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -486,11 +502,13 @@ async def create_or_update( deserialized = self._deserialize("CertificateContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}"} # 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 @@ -498,7 +516,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific certificate. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -524,10 +543,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -541,10 +558,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -557,7 +575,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}" + } @distributed_trace_async async def refresh_secret( @@ -565,7 +585,12 @@ async def refresh_secret( ) -> _models.CertificateContract: """From KeyVault, Refresh the certificate being used for authentication with the backend. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-howto-mutual-certificates/ + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -588,10 +613,8 @@ async def refresh_secret( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateContract] + 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( resource_group_name=resource_group_name, @@ -604,10 +627,11 @@ async def refresh_secret( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -627,4 +651,6 @@ async def refresh_secret( return deserialized - refresh_secret.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}/refreshSecret"} # type: ignore + refresh_secret.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}/refreshSecret" + } 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 65c49458aff2..415ca98a5ed8 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 @@ -6,8 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,10 +37,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +66,8 @@ def list_by_service( ) -> AsyncIterable["_models.ContentItemContract"]: """Lists developer portal's content items specified by the provided content type. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -86,10 +82,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentItemCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContentItemCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -113,7 +107,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -129,7 +123,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -137,14 +131,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ContentItemCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -157,7 +152,9 @@ 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"} # type: ignore + 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( @@ -166,7 +163,8 @@ async def get_entity_tag( """Returns the entity state (ETag) version of the developer portal's content item specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -190,10 +188,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -207,10 +203,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -227,7 +224,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}" + } @distributed_trace_async async def get( @@ -235,7 +234,8 @@ async def get( ) -> _models.ContentItemContract: """Returns the developer portal's content item specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -259,10 +259,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentItemContract] + 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( resource_group_name=resource_group_name, @@ -276,10 +274,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -299,7 +298,85 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + content_type_id: str, + content_item_id: str, + parameters: _models.ContentItemContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ContentItemContract: + """Creates a new developer portal's content item specified by the provided content type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param content_type_id: Content type identifier. Required. + :type content_type_id: str + :param content_item_id: Content item identifier. Required. + :type content_item_id: str + :param parameters: Create or update parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ContentItemContract + :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 JSON body. + Default 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: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + content_type_id: str, + content_item_id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ContentItemContract: + """Creates a new developer portal's content item specified by the provided content type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param content_type_id: Content type identifier. Required. + :type content_type_id: str + :param content_item_id: Content item identifier. Required. + :type content_item_id: str + :param parameters: Create or update parameters. Required. + :type parameters: IO + :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: + """ @distributed_trace_async async def create_or_update( @@ -308,12 +385,14 @@ async def create_or_update( service_name: str, content_type_id: str, content_item_id: str, + parameters: Union[_models.ContentItemContract, IO], if_match: Optional[str] = None, **kwargs: Any ) -> _models.ContentItemContract: """Creates a new developer portal's content item specified by the provided content type. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -321,9 +400,15 @@ 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 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 @@ -337,13 +422,20 @@ async def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentItemContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ContentItemContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ContentItemContract", is_xml=True) request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -353,15 +445,19 @@ async def create_or_update( subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, + 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) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -383,11 +479,13 @@ async def create_or_update( deserialized = self._deserialize("ContentItemContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}"} # 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 @@ -401,7 +499,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Removes the specified developer portal's content item. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -428,10 +527,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -446,10 +543,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -462,4 +560,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}" + } 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 97129fe55868..c866b2463952 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 @@ -6,8 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,10 +36,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +66,8 @@ def list_by_service( """Lists the developer portal's content types. Content types describe content items' properties, validation rules, and constraints. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -84,10 +80,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentTypeCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContentTypeCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -110,7 +104,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -126,7 +120,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -134,14 +128,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ContentTypeCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -154,7 +149,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes" + } @distributed_trace_async async def get( @@ -163,7 +160,8 @@ async def get( """Gets the details of the developer portal's content type. Content types describe content items' properties, validation rules, and constraints. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -185,10 +183,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentTypeContract] + 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( resource_group_name=resource_group_name, @@ -201,10 +197,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -224,7 +221,83 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + content_type_id: str, + parameters: _models.ContentTypeContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ContentTypeContract: + """Creates or updates the developer portal's content type. Content types describe content items' + properties, validation rules, and constraints. Custom content types' identifiers need to start + with the ``c-`` prefix. Built-in content types can't be modified. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param content_type_id: Content type identifier. Required. + :type content_type_id: str + :param parameters: Create or update parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ContentTypeContract + :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 JSON body. + Default 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: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + content_type_id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ContentTypeContract: + """Creates or updates the developer portal's content type. Content types describe content items' + properties, validation rules, and constraints. Custom content types' identifiers need to start + with the ``c-`` prefix. Built-in content types can't be modified. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param content_type_id: Content type identifier. Required. + :type content_type_id: str + :param parameters: Create or update parameters. Required. + :type parameters: IO + :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: + """ @distributed_trace_async async def create_or_update( @@ -232,6 +305,7 @@ async def create_or_update( resource_group_name: str, service_name: str, content_type_id: str, + parameters: Union[_models.ContentTypeContract, IO], if_match: Optional[str] = None, **kwargs: Any ) -> _models.ContentTypeContract: @@ -239,15 +313,22 @@ async def create_or_update( properties, validation rules, and constraints. Custom content types' identifiers need to start with the ``c-`` prefix. Built-in content types can't be modified. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :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 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 @@ -261,13 +342,20 @@ async def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentTypeContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ContentTypeContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ContentTypeContract", is_xml=True) request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -276,15 +364,19 @@ async def create_or_update( subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, + 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) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -306,11 +398,13 @@ async def create_or_update( deserialized = self._deserialize("ContentTypeContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}"} # 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 @@ -320,7 +414,8 @@ async def delete( # pylint: disable=inconsistent-return-statements properties, validation rules, and constraints. Built-in content types (with identifiers starting with the ``c-`` prefix) can't be removed. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -345,10 +440,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -362,10 +455,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -378,4 +472,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}" + } 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 803c7bb51a0a..b17400fbeb9d 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -35,10 +34,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,7 +61,8 @@ def __init__(self, *args, **kwargs) -> None: async def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the DelegationSettings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -86,10 +82,8 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -101,10 +95,11 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -121,13 +116,16 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -147,10 +145,8 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalDelegationSettings] + 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( resource_group_name=resource_group_name, @@ -162,10 +158,11 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,7 +182,9 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation" + } @overload async def update( # pylint: disable=inconsistent-return-statements @@ -200,7 +199,8 @@ async def update( # pylint: disable=inconsistent-return-statements ) -> None: """Update Delegation settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -231,7 +231,8 @@ async def update( # pylint: disable=inconsistent-return-statements ) -> None: """Update Delegation settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -260,14 +261,16 @@ async def update( # pylint: disable=inconsistent-return-statements ) -> None: """Update Delegation settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 Delegation settings. Is either a model type or a IO type. Required. + :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. @@ -288,11 +291,9 @@ async def update( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -316,10 +317,11 @@ async def update( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -332,7 +334,9 @@ async def update( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation" + } @overload async def create_or_update( @@ -347,7 +351,8 @@ async def create_or_update( ) -> _models.PortalDelegationSettings: """Create or Update Delegation settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -378,7 +383,8 @@ async def create_or_update( ) -> _models.PortalDelegationSettings: """Create or Update Delegation settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -407,11 +413,13 @@ async def create_or_update( ) -> _models.PortalDelegationSettings: """Create or Update Delegation settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :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 model type or a IO type. Required. + :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 :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -435,11 +443,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalDelegationSettings] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PortalDelegationSettings] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -463,10 +469,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -483,7 +490,9 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation" + } @distributed_trace_async async def list_secrets( @@ -491,7 +500,8 @@ async def list_secrets( ) -> _models.PortalSettingValidationKeyContract: """Gets the secret validation key of the DelegationSettings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -511,10 +521,8 @@ async def list_secrets( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalSettingValidationKeyContract] + 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( resource_group_name=resource_group_name, @@ -526,10 +534,11 @@ async def list_secrets( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -546,4 +555,6 @@ async def list_secrets( return deserialized - list_secrets.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation/listSecrets"} # type: ignore + list_secrets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation/listSecrets" + } 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 014db8f16fac..34b438ae9398 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast import urllib.parse @@ -38,10 +37,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,10 +74,8 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.DeletedS _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedServicesCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DeletedServicesCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +96,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +112,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,14 +120,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DeletedServicesCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -147,7 +141,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/deletedservices"} # type: ignore + 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: @@ -173,10 +169,8 @@ async def get_by_name(self, service_name: str, location: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedServiceContract] + 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( service_name=service_name, @@ -188,10 +182,11 @@ async def get_by_name(self, service_name: str, location: str, **kwargs: Any) -> params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -208,7 +203,9 @@ async def get_by_name(self, service_name: str, location: str, **kwargs: Any) -> return deserialized - get_by_name.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}"} # type: ignore + get_by_name.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}" + } async def _purge_initial( self, service_name: str, location: str, **kwargs: Any @@ -224,10 +221,8 @@ async def _purge_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.DeletedServiceContract]] + 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( service_name=service_name, @@ -239,10 +234,11 @@ async def _purge_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -253,18 +249,25 @@ async def _purge_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("DeletedServiceContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _purge_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}"} # type: ignore + _purge_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}" + } @distributed_trace_async - async def begin_purge(self, service_name: str, location: str, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_purge( + self, service_name: str, location: str, **kwargs: Any + ) -> AsyncLROPoller[_models.DeletedServiceContract]: """Purges Api Management Service (deletes it with no option to undelete). :param service_name: The name of the API Management service. Required. @@ -288,15 +291,13 @@ async def begin_purge(self, service_name: str, location: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._purge_initial( # type: ignore + raw_result = await self._purge_initial( service_name=service_name, location=location, api_version=api_version, @@ -308,15 +309,19 @@ async def begin_purge(self, service_name: str, location: str, **kwargs: Any) -> kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("DeletedServiceContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -328,6 +333,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_purge.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}" + } 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 4dafa4f201d5..1c237ab1a023 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -39,10 +38,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +73,8 @@ def list_by_service( ) -> AsyncIterable["_models.DiagnosticContract"]: """Lists all diagnostics of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -100,10 +96,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiagnosticCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DiagnosticCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -129,7 +123,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -145,7 +139,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -153,14 +147,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DiagnosticCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -173,7 +168,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics" + } @distributed_trace_async async def get_entity_tag( @@ -181,7 +178,8 @@ async def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the Diagnostic specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -204,10 +202,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -220,10 +216,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,7 +237,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" + } @distributed_trace_async async def get( @@ -248,7 +247,8 @@ async def get( ) -> _models.DiagnosticContract: """Gets the details of the Diagnostic specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -271,10 +271,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiagnosticContract] + 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( resource_group_name=resource_group_name, @@ -287,10 +285,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -310,7 +309,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" + } @overload async def create_or_update( @@ -326,7 +327,8 @@ async def create_or_update( ) -> _models.DiagnosticContract: """Creates a new Diagnostic or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -361,7 +363,8 @@ async def create_or_update( ) -> _models.DiagnosticContract: """Creates a new Diagnostic or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -394,14 +397,16 @@ async def create_or_update( ) -> _models.DiagnosticContract: """Creates a new Diagnostic or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a DiagnosticContract type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -425,11 +430,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiagnosticContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -454,10 +457,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -479,11 +483,13 @@ async def create_or_update( deserialized = self._deserialize("DiagnosticContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" + } @overload async def update( @@ -499,7 +505,8 @@ async def update( ) -> _models.DiagnosticContract: """Updates the details of the Diagnostic specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -534,7 +541,8 @@ async def update( ) -> _models.DiagnosticContract: """Updates the details of the Diagnostic specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -567,7 +575,8 @@ async def update( ) -> _models.DiagnosticContract: """Updates the details of the Diagnostic specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -577,7 +586,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: Diagnostic Update parameters. Is either a model type or a IO type. Required. + :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. @@ -598,11 +608,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiagnosticContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -627,10 +635,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -650,7 +659,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -658,7 +669,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified Diagnostic. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -684,10 +696,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -701,10 +711,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -717,4 +728,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" + } 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 new file mode 100644 index 000000000000..ca6409b34574 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_documentation_operations.py @@ -0,0 +1,733 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._documentation_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_entity_tag_request, + build_get_request, + build_list_by_service_request, + build_update_request, +) +from .._vendor import ApiManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DocumentationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s + :attr:`documentation` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_service( + self, + resource_group_name: str, + service_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DocumentationContract"]: + """Lists all Documentations of the API Management service instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param filter: | Field | Usage | Supported operators | Supported + functions |
|-------------|-------------|-------------|-------------|
| name | + filter | eq | contains |
. Default value is None. + :type filter: str + :param top: Number of records to return. Default value is None. + :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.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.DocumentationContract] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DocumentationCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DocumentationCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_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 + ) -> bool: + """Gets the entity state (Etag) version of the Documentation by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if cls: + return cls(pipeline_response, None, response_headers) + 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 + ) -> _models.DocumentationContract: + """Gets the details of the Documentation specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DocumentationContract] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("DocumentationContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + documentation_id: str, + parameters: _models.DocumentationContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DocumentationContract: + """Creates a new Documentation or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param documentation_id: Documentation identifier. Must be unique in the current API Management + service instance. Required. + :type documentation_id: str + :param parameters: Create parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.DocumentationContract + :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 JSON body. + Default 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: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + documentation_id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DocumentationContract: + """Creates a new Documentation or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param documentation_id: Documentation identifier. Must be unique in the current API Management + service instance. Required. + :type documentation_id: str + :param parameters: Create parameters. Required. + :type parameters: IO + :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: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + documentation_id: str, + parameters: Union[_models.DocumentationContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> _models.DocumentationContract: + """Creates a new Documentation or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DocumentationContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "DocumentationContract", is_xml=True) + + request = build_create_or_update_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, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("DocumentationContract", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("DocumentationContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + 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, + resource_group_name: str, + service_name: str, + documentation_id: str, + if_match: str, + parameters: _models.DocumentationUpdateContract, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DocumentationContract: + """Updates the details of the Documentation for an API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param documentation_id: Documentation identifier. Must be unique in the current API Management + service instance. Required. + :type documentation_id: str + :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: Documentation Update parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.DocumentationUpdateContract + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default 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: + """ + + @overload + async def update( + self, + resource_group_name: str, + service_name: str, + documentation_id: str, + if_match: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DocumentationContract: + """Updates the details of the Documentation for an API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param documentation_id: Documentation identifier. Must be unique in the current API Management + service instance. Required. + :type documentation_id: str + :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: Documentation Update parameters. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DocumentationContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.DocumentationContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + service_name: str, + documentation_id: str, + if_match: str, + parameters: Union[_models.DocumentationUpdateContract, IO], + **kwargs: Any + ) -> _models.DocumentationContract: + """Updates the details of the Documentation for an API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param documentation_id: Documentation identifier. Must be unique in the current API Management + service instance. Required. + :type documentation_id: str + :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: 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 + :return: DocumentationContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.DocumentationContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DocumentationContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "DocumentationUpdateContract") + + request = build_update_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, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("DocumentationContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, documentation_id: str, if_match: str, **kwargs: Any + ) -> None: + """Deletes the specified Documentation from an API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param documentation_id: Documentation identifier. Must be unique in the current API Management + service instance. Required. + :type documentation_id: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" + } 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 82575edf5cb2..21bbb49b633e 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -39,10 +38,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +73,8 @@ def list_by_service( ) -> AsyncIterable["_models.EmailTemplateContract"]: """Gets all email templates. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -101,10 +97,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmailTemplateCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EmailTemplateCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -130,7 +124,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -146,7 +140,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -154,14 +148,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EmailTemplateCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -174,7 +169,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates" + } @distributed_trace_async async def get_entity_tag( @@ -186,7 +183,8 @@ async def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the email template specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -215,10 +213,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -231,10 +227,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,7 +248,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" + } @distributed_trace_async async def get( @@ -263,7 +262,8 @@ async def get( ) -> _models.EmailTemplateContract: """Gets the details of the email template specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -292,10 +292,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmailTemplateContract] + 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( resource_group_name=resource_group_name, @@ -308,10 +306,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -331,7 +330,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" + } @overload async def create_or_update( @@ -347,7 +348,8 @@ async def create_or_update( ) -> _models.EmailTemplateContract: """Updates an Email Template. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -388,7 +390,8 @@ async def create_or_update( ) -> _models.EmailTemplateContract: """Updates an Email Template. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -427,7 +430,8 @@ async def create_or_update( ) -> _models.EmailTemplateContract: """Updates an Email Template. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -440,8 +444,8 @@ async def create_or_update( "passwordResetByAdminNotificationMessage", "rejectDeveloperNotificationMessage", and "requestDeveloperNotificationMessage". Required. :type template_name: str or ~azure.mgmt.apimanagement.models.TemplateName - :param parameters: Email Template update parameters. Is either a model type or a IO type. - Required. + :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 :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -465,11 +469,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmailTemplateContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EmailTemplateContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -494,10 +496,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -514,11 +517,13 @@ async def create_or_update( deserialized = self._deserialize("EmailTemplateContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" + } @overload async def update( @@ -534,7 +539,8 @@ async def update( ) -> _models.EmailTemplateContract: """Updates API Management email template. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -575,7 +581,8 @@ async def update( ) -> _models.EmailTemplateContract: """Updates API Management email template. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -614,7 +621,8 @@ async def update( ) -> _models.EmailTemplateContract: """Updates API Management email template. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -630,7 +638,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -651,11 +660,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmailTemplateContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EmailTemplateContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -680,10 +687,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -703,7 +711,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -716,7 +726,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Reset the Email Template to default template provided by the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -748,10 +759,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -765,10 +774,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -781,4 +791,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" + } 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 4d366560e39c..b460e66f9fdf 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -37,10 +36,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +72,8 @@ def list_by_service( ) -> AsyncIterable["_models.ApiContract"]: """Lists a collection of the APIs associated with a gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -101,10 +97,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -131,7 +125,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -147,7 +141,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -155,14 +149,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ApiCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -175,7 +170,9 @@ 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"} # type: ignore + 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( @@ -183,7 +180,8 @@ async def get_entity_tag( ) -> bool: """Checks that API entity specified by identifier is associated with the Gateway entity. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -209,10 +207,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -226,10 +222,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,7 +243,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}" + } @overload async def create_or_update( @@ -262,7 +261,8 @@ async def create_or_update( ) -> _models.ApiContract: """Adds an API to the specified Gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -297,7 +297,8 @@ async def create_or_update( ) -> _models.ApiContract: """Adds an API to the specified Gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -330,7 +331,8 @@ async def create_or_update( ) -> _models.ApiContract: """Adds an API to the specified Gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -340,7 +342,7 @@ 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 model type or a IO type. Default value is None. + :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. @@ -361,11 +363,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -393,10 +393,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -413,11 +414,13 @@ async def create_or_update( deserialized = self._deserialize("ApiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}"} # 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 @@ -425,7 +428,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified API from the specified Gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -451,10 +455,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -468,10 +470,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -484,4 +487,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}" + } 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 3ee0fe8f7048..0721dcbafb70 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -38,10 +37,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +73,8 @@ def list_by_service( ) -> AsyncIterable["_models.GatewayCertificateAuthorityContract"]: """Lists the collection of Certificate Authorities for the specified Gateway entity. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -103,10 +99,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayCertificateAuthorityCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GatewayCertificateAuthorityCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -133,7 +127,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -149,7 +143,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -157,14 +151,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("GatewayCertificateAuthorityCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -177,7 +172,9 @@ 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"} # type: ignore + 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( @@ -185,7 +182,8 @@ async def get_entity_tag( ) -> bool: """Checks if Certificate entity is assigned to Gateway entity as Certificate Authority. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -211,10 +209,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -228,10 +224,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -248,7 +245,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}" + } @distributed_trace_async async def get( @@ -256,7 +255,8 @@ async def get( ) -> _models.GatewayCertificateAuthorityContract: """Get assigned Gateway Certificate Authority details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -282,10 +282,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayCertificateAuthorityContract] + 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( resource_group_name=resource_group_name, @@ -299,10 +297,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -322,7 +321,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}" + } @overload async def create_or_update( @@ -339,7 +340,8 @@ async def create_or_update( ) -> _models.GatewayCertificateAuthorityContract: """Assign Certificate entity to Gateway entity as Certificate Authority. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -378,7 +380,8 @@ async def create_or_update( ) -> _models.GatewayCertificateAuthorityContract: """Assign Certificate entity to Gateway entity as Certificate Authority. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -415,7 +418,8 @@ async def create_or_update( ) -> _models.GatewayCertificateAuthorityContract: """Assign Certificate entity to Gateway entity as Certificate Authority. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -425,7 +429,7 @@ 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 model type or a IO type. Required. + :param parameters: Is either a GatewayCertificateAuthorityContract type or a IO type. Required. :type parameters: ~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -449,11 +453,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayCertificateAuthorityContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayCertificateAuthorityContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -479,10 +481,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -504,11 +507,13 @@ async def create_or_update( deserialized = self._deserialize("GatewayCertificateAuthorityContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}"} # 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 @@ -522,7 +527,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Remove relationship between Certificate Authority and Gateway entity. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -551,10 +557,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -569,10 +573,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -585,4 +590,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}" + } 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 2ca2f35b1abc..b879e7a403f7 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -38,10 +37,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +73,8 @@ def list_by_service( ) -> AsyncIterable["_models.GatewayHostnameConfigurationContract"]: """Lists the collection of hostname configurations for the specified gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -105,10 +101,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayHostnameConfigurationCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GatewayHostnameConfigurationCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -135,7 +129,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -151,7 +145,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -159,14 +153,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("GatewayHostnameConfigurationCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -179,7 +174,9 @@ 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"} # type: ignore + 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( @@ -188,7 +185,8 @@ async def get_entity_tag( """Checks that hostname configuration entity specified by identifier exists for specified Gateway entity. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -214,10 +212,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -231,10 +227,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,7 +248,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}" + } @distributed_trace_async async def get( @@ -259,7 +258,8 @@ async def get( ) -> _models.GatewayHostnameConfigurationContract: """Get details of a hostname configuration. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -285,10 +285,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayHostnameConfigurationContract] + 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( resource_group_name=resource_group_name, @@ -302,10 +300,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -325,7 +324,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}" + } @overload async def create_or_update( @@ -342,7 +343,8 @@ async def create_or_update( ) -> _models.GatewayHostnameConfigurationContract: """Creates of updates hostname configuration for a Gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -381,7 +383,8 @@ async def create_or_update( ) -> _models.GatewayHostnameConfigurationContract: """Creates of updates hostname configuration for a Gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -418,7 +421,8 @@ async def create_or_update( ) -> _models.GatewayHostnameConfigurationContract: """Creates of updates hostname configuration for a Gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -428,7 +432,8 @@ 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 model type or a IO type. Required. + :param parameters: Is either a GatewayHostnameConfigurationContract type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -452,11 +457,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayHostnameConfigurationContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayHostnameConfigurationContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -482,10 +485,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -507,11 +511,13 @@ async def create_or_update( deserialized = self._deserialize("GatewayHostnameConfigurationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}"} # 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 @@ -519,7 +525,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified hostname configuration from the specified Gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -548,10 +555,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -566,10 +571,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -582,4 +588,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}" + } 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 b379a41b445f..58919f1d2ccb 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -42,10 +41,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +76,8 @@ def list_by_service( ) -> AsyncIterable["_models.GatewayContract"]: """Lists a collection of gateways registered with service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -105,10 +101,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GatewayCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -134,7 +128,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -150,7 +144,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -158,14 +152,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("GatewayCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -178,13 +173,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -207,10 +205,8 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, gate _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -223,10 +219,11 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, gate params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -243,7 +240,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, gate return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" + } @distributed_trace_async async def get( @@ -251,7 +250,8 @@ async def get( ) -> _models.GatewayContract: """Gets the details of the Gateway specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -274,10 +274,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayContract] + 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( resource_group_name=resource_group_name, @@ -290,10 +288,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +312,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" + } @overload async def create_or_update( @@ -329,7 +330,8 @@ async def create_or_update( ) -> _models.GatewayContract: """Creates or updates a Gateway to be used in Api Management instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -364,7 +366,8 @@ async def create_or_update( ) -> _models.GatewayContract: """Creates or updates a Gateway to be used in Api Management instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -397,14 +400,15 @@ async def create_or_update( ) -> _models.GatewayContract: """Creates or updates a Gateway to be used in Api Management instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param parameters: Is either a GatewayContract type or a IO type. Required. :type parameters: ~azure.mgmt.apimanagement.models.GatewayContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -428,11 +432,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -457,10 +459,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -482,11 +485,13 @@ async def create_or_update( deserialized = self._deserialize("GatewayContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" + } @overload async def update( @@ -502,7 +507,8 @@ async def update( ) -> _models.GatewayContract: """Updates the details of the gateway specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -537,7 +543,8 @@ async def update( ) -> _models.GatewayContract: """Updates the details of the gateway specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -570,7 +577,8 @@ async def update( ) -> _models.GatewayContract: """Updates the details of the gateway specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -580,7 +588,7 @@ 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 model type or a IO type. Required. + :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. @@ -601,11 +609,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -630,10 +636,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -653,7 +660,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -661,7 +670,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific Gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -687,10 +697,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -704,10 +712,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -720,7 +729,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" + } @distributed_trace_async async def list_keys( @@ -728,7 +739,8 @@ async def list_keys( ) -> _models.GatewayKeysContract: """Retrieves gateway keys. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -751,10 +763,8 @@ async def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayKeysContract] + 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( resource_group_name=resource_group_name, @@ -767,10 +777,11 @@ async def list_keys( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -790,7 +801,9 @@ async def list_keys( return deserialized - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listKeys" + } @overload async def regenerate_key( # pylint: disable=inconsistent-return-statements @@ -805,7 +818,8 @@ async def regenerate_key( # pylint: disable=inconsistent-return-statements ) -> None: """Regenerates specified gateway key invalidating any tokens created with it. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -836,7 +850,8 @@ async def regenerate_key( # pylint: disable=inconsistent-return-statements ) -> None: """Regenerates specified gateway key invalidating any tokens created with it. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -865,14 +880,16 @@ async def regenerate_key( # pylint: disable=inconsistent-return-statements ) -> None: """Regenerates specified gateway key invalidating any tokens created with it. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param parameters: Is either a GatewayKeyRegenerationRequestContract type or a IO 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. @@ -893,11 +910,9 @@ async def regenerate_key( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -921,10 +936,11 @@ async def regenerate_key( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -937,7 +953,9 @@ async def regenerate_key( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - regenerate_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/regenerateKey"} # type: ignore + regenerate_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/regenerateKey" + } @overload async def generate_token( @@ -952,7 +970,8 @@ async def generate_token( ) -> _models.GatewayTokenContract: """Gets the Shared Access Authorization Token for the gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -983,7 +1002,8 @@ async def generate_token( ) -> _models.GatewayTokenContract: """Gets the Shared Access Authorization Token for the gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1012,14 +1032,15 @@ async def generate_token( ) -> _models.GatewayTokenContract: """Gets the Shared Access Authorization Token for the gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :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. @@ -1040,11 +1061,9 @@ async def generate_token( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayTokenContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayTokenContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1068,10 +1087,11 @@ async def generate_token( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1088,4 +1108,6 @@ async def generate_token( return deserialized - generate_token.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/generateToken"} # type: ignore + generate_token.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/generateToken" + } 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 fce05b35d317..67ea48ce1d13 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +39,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +74,8 @@ def list_by_service( ) -> AsyncIterable["_models.GlobalSchemaContract"]: """Lists a collection of schemas registered with service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -102,10 +98,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GlobalSchemaCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GlobalSchemaCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -131,7 +125,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -147,7 +141,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -155,14 +149,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("GlobalSchemaCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -175,13 +170,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -204,10 +202,8 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, sche _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -220,10 +216,11 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, sche params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,7 +237,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, sche return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" + } @distributed_trace_async async def get( @@ -248,7 +247,8 @@ async def get( ) -> _models.GlobalSchemaContract: """Gets the details of the Schema specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -271,10 +271,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GlobalSchemaContract] + 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( resource_group_name=resource_group_name, @@ -287,10 +285,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -310,7 +309,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" + } async def _create_or_update_initial( self, @@ -332,11 +333,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.GlobalSchemaContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.GlobalSchemaContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -361,10 +360,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -391,7 +391,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" + } @overload async def begin_create_or_update( @@ -407,7 +409,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.GlobalSchemaContract]: """Creates new or updates existing specified Schema of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -451,7 +454,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.GlobalSchemaContract]: """Creates new or updates existing specified Schema of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -493,14 +497,16 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.GlobalSchemaContract]: """Creates new or updates existing specified Schema of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -525,16 +531,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GlobalSchemaContract] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GlobalSchemaContract] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, schema_id=schema_id, @@ -560,9 +564,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -574,9 +578,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -584,7 +590,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific Schema. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -610,10 +617,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -627,10 +632,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -643,4 +649,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" + } 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 new file mode 100644 index 000000000000..568368cbcedc --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_operations.py @@ -0,0 +1,778 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._graph_ql_api_resolver_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_entity_tag_request, + build_get_request, + build_list_by_api_request, + build_update_request, +) +from .._vendor import ApiManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GraphQLApiResolverOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s + :attr:`graph_ql_api_resolver` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_api( + self, + resource_group_name: str, + service_name: str, + api_id: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ResolverContract"]: + """Lists a collection of the resolvers for the specified GraphQL API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :param filter: | Field | Usage | Supported operators | Supported + functions |
|-------------|-------------|-------------|-------------|
| name | + filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
| + displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith + |
| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, + endswith |
| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, + endswith |
. Default value is None. + :type filter: str + :param top: Number of records to return. Default value is None. + :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] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResolverCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ResolverCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_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 + ) -> bool: + """Gets the entity state (Etag) version of the GraphQL API resolver specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if cls: + return cls(pipeline_response, None, response_headers) + 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 + ) -> _models.ResolverContract: + """Gets the details of the GraphQL API Resolver specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResolverContract] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ResolverContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + parameters: _models.ResolverContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResolverContract: + """Creates a new resolver in the GraphQL API or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ResolverContract + :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 JSON body. + Default 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: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResolverContract: + """Creates a new resolver in the GraphQL API or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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. Required. + :type parameters: IO + :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: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + parameters: Union[_models.ResolverContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> _models.ResolverContract: + """Creates a new resolver in the GraphQL API or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResolverContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResolverContract", is_xml=True) + + request = build_create_or_update_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, + if_match=if_match, + api_version=api_version, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ResolverContract", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ResolverContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + 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, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + if_match: str, + parameters: _models.ResolverUpdateContract, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResolverContract: + """Updates the details of the resolver in the GraphQL API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 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: GraphQL API Resolver Update parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ResolverUpdateContract + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default 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: + """ + + @overload + async def update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + if_match: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResolverContract: + """Updates the details of the resolver in the GraphQL API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 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: GraphQL API Resolver Update parameters. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResolverContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.ResolverContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + if_match: str, + parameters: Union[_models.ResolverUpdateContract, IO], + **kwargs: Any + ) -> _models.ResolverContract: + """Updates the details of the resolver in the GraphQL API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 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: 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 + :return: ResolverContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.ResolverContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResolverContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResolverUpdateContract") + + request = build_update_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, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ResolverContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, api_id: str, resolver_id: str, if_match: str, **kwargs: Any + ) -> None: + """Deletes the specified resolver in the GraphQL API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + resolver_id=resolver_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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" + } 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 new file mode 100644 index 000000000000..4c6972b14c81 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_policy_operations.py @@ -0,0 +1,619 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._graph_ql_api_resolver_policy_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_entity_tag_request, + build_get_request, + build_list_by_resolver_request, +) +from .._vendor import ApiManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GraphQLApiResolverPolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s + :attr:`graph_ql_api_resolver_policy` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resolver( + self, resource_group_name: str, service_name: str, api_id: str, resolver_id: str, **kwargs: Any + ) -> AsyncIterable["_models.PolicyContract"]: + """Get the list of policy configuration at the GraphQL API Resolver level. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PolicyCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_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, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + policy_id: Union[str, _models.PolicyIdName], + **kwargs: Any + ) -> bool: + """Gets the entity state (Etag) version of the GraphQL API resolver policy specified by its + identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + resolver_id=resolver_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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if cls: + return cls(pipeline_response, None, response_headers) + 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, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + policy_id: Union[str, _models.PolicyIdName], + format: Union[str, _models.PolicyExportFormat] = "xml", + **kwargs: Any + ) -> _models.PolicyContract: + """Get the policy configuration at the GraphQL API Resolver level. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 policy_id: The identifier of the Policy. "policy" Required. + :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + resolver_id=resolver_id, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("PolicyContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + policy_id: Union[str, _models.PolicyIdName], + parameters: _models.PolicyContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PolicyContract: + """Creates or updates policy configuration for the GraphQL API Resolver level. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 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: ~azure.mgmt.apimanagement.models.PolicyContract + :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 JSON body. + Default 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: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + policy_id: Union[str, _models.PolicyIdName], + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PolicyContract: + """Creates or updates policy configuration for the GraphQL API Resolver level. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 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 + :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: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + policy_id: Union[str, _models.PolicyIdName], + parameters: Union[_models.PolicyContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> _models.PolicyContract: + """Creates or updates policy configuration for the GraphQL API Resolver level. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 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 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PolicyContract", is_xml=True) + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + resolver_id=resolver_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("PolicyContract", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("PolicyContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + 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, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + policy_id: Union[str, _models.PolicyIdName], + if_match: str, + **kwargs: Any + ) -> None: + """Deletes the policy configuration at the GraphQL Api Resolver. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 policy_id: The identifier of the Policy. "policy" Required. + :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + resolver_id=resolver_id, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}" + } 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 399f7308a3e1..c332578e9abe 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -39,10 +38,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +73,11 @@ def list_by_service( ) -> AsyncIterable["_models.GroupContract"]: """Lists a collection of groups defined within a service instance. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-create-groups + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -101,10 +100,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GroupCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -130,7 +127,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -146,7 +143,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -154,14 +151,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("GroupCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -174,13 +172,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -203,10 +204,8 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, grou _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -219,10 +218,11 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, grou params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -239,7 +239,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, grou return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" + } @distributed_trace_async async def get( @@ -247,7 +249,8 @@ async def get( ) -> _models.GroupContract: """Gets the details of the group specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -270,10 +273,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupContract] + 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( resource_group_name=resource_group_name, @@ -286,10 +287,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -309,7 +311,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" + } @overload async def create_or_update( @@ -325,7 +329,8 @@ async def create_or_update( ) -> _models.GroupContract: """Creates or Updates a group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -360,7 +365,8 @@ async def create_or_update( ) -> _models.GroupContract: """Creates or Updates a group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -393,14 +399,16 @@ async def create_or_update( ) -> _models.GroupContract: """Creates or Updates a group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a GroupCreateParameters type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.GroupCreateParameters or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -424,11 +432,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GroupContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -453,10 +459,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -478,11 +485,13 @@ async def create_or_update( deserialized = self._deserialize("GroupContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" + } @overload async def update( @@ -498,7 +507,8 @@ async def update( ) -> _models.GroupContract: """Updates the details of the group specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -533,7 +543,8 @@ async def update( ) -> _models.GroupContract: """Updates the details of the group specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -566,7 +577,8 @@ async def update( ) -> _models.GroupContract: """Updates the details of the group specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -576,7 +588,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -597,11 +610,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GroupContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -626,10 +637,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -649,7 +661,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -657,7 +671,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific group of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -683,10 +698,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -700,10 +713,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -716,4 +730,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" + } 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 975dede3c193..25d7e69b499d 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -37,10 +36,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +72,8 @@ def list( ) -> AsyncIterable["_models.UserContract"]: """Lists a collection of user entities associated with the group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -105,10 +101,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UserCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -135,7 +129,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -151,7 +145,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -159,14 +153,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("UserCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -179,7 +174,9 @@ 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"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users" + } @distributed_trace_async async def check_entity_exists( @@ -187,7 +184,8 @@ async def check_entity_exists( ) -> bool: """Checks that user entity specified by identifier is associated with the group entity. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -213,10 +211,8 @@ async def check_entity_exists( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -230,10 +226,11 @@ async def check_entity_exists( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -247,7 +244,9 @@ async def check_entity_exists( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - check_entity_exists.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}"} # type: ignore + check_entity_exists.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}" + } @distributed_trace_async async def create( @@ -255,7 +254,8 @@ async def create( ) -> _models.UserContract: """Add existing user to existing group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -281,10 +281,8 @@ async def create( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserContract] + 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( resource_group_name=resource_group_name, @@ -298,10 +296,11 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -318,11 +317,13 @@ async def create( deserialized = self._deserialize("UserContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}"} # 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 @@ -330,7 +331,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Remove existing user from existing group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -356,10 +358,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -373,10 +373,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,4 +390,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}" + } 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 aa4b19f40e25..c841753078f1 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -40,10 +39,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +68,12 @@ def list_by_service( ) -> AsyncIterable["_models.IdentityProviderContract"]: """Lists a collection of Identity Provider configured in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-aad#how-to-authorize-developer-accounts-using-azure-active-directory + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -87,10 +87,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IdentityProviderList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IdentityProviderList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -113,7 +111,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -129,7 +127,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -137,14 +135,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IdentityProviderList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -157,7 +156,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders" + } @distributed_trace_async async def get_entity_tag( @@ -169,7 +170,8 @@ async def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the identityProvider specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -192,10 +194,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -208,10 +208,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -228,7 +229,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" + } @distributed_trace_async async def get( @@ -241,7 +244,8 @@ async def get( """Gets the configuration details of the identity Provider configured in specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -264,10 +268,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IdentityProviderContract] + 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( resource_group_name=resource_group_name, @@ -280,10 +282,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -303,7 +306,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" + } @overload async def create_or_update( @@ -319,7 +324,8 @@ async def create_or_update( ) -> _models.IdentityProviderContract: """Creates or Updates the IdentityProvider configuration. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -354,7 +360,8 @@ async def create_or_update( ) -> _models.IdentityProviderContract: """Creates or Updates the IdentityProvider configuration. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -387,14 +394,16 @@ async def create_or_update( ) -> _models.IdentityProviderContract: """Creates or Updates the IdentityProvider configuration. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a IdentityProviderCreateContract type or a IO + type. Required. :type parameters: ~azure.mgmt.apimanagement.models.IdentityProviderCreateContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -418,11 +427,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IdentityProviderContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IdentityProviderContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -447,10 +454,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -472,11 +480,13 @@ async def create_or_update( deserialized = self._deserialize("IdentityProviderContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" + } @overload async def update( @@ -492,7 +502,8 @@ async def update( ) -> _models.IdentityProviderContract: """Updates an existing IdentityProvider configuration. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -527,7 +538,8 @@ async def update( ) -> _models.IdentityProviderContract: """Updates an existing IdentityProvider configuration. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -560,7 +572,8 @@ async def update( ) -> _models.IdentityProviderContract: """Updates an existing IdentityProvider configuration. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -570,7 +583,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -591,11 +605,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IdentityProviderContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IdentityProviderContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -620,10 +632,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -643,7 +656,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -656,7 +671,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified identity provider configuration. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -682,10 +698,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -699,10 +713,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -715,7 +730,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" + } @distributed_trace_async async def list_secrets( @@ -727,7 +744,8 @@ async def list_secrets( ) -> _models.ClientSecretContract: """Gets the client secret details of the Identity Provider. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -750,10 +768,8 @@ async def list_secrets( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClientSecretContract] + 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( resource_group_name=resource_group_name, @@ -766,10 +782,11 @@ async def list_secrets( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -789,4 +806,6 @@ async def list_secrets( return deserialized - list_secrets.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}/listSecrets"} # type: ignore + list_secrets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}/listSecrets" + } 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 67d003757d63..6f44336414f7 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -32,10 +31,6 @@ from ...operations._issue_operations import build_get_request, build_list_by_service_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +66,8 @@ def list_by_service( ) -> AsyncIterable["_models.IssueContract"]: """Lists a collection of issues in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -96,10 +92,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IssueCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -125,7 +119,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -141,7 +135,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -149,14 +143,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IssueCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -169,7 +164,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues" + } @distributed_trace_async async def get( @@ -177,7 +174,8 @@ async def get( ) -> _models.IssueContract: """Gets API Management issue details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -200,10 +198,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueContract] + 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( resource_group_name=resource_group_name, @@ -216,10 +212,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -239,4 +236,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues/{issueId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues/{issueId}" + } 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 7dc3c7669185..13e67ff36a6e 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -39,10 +38,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +73,11 @@ def list_by_service( ) -> AsyncIterable["_models.LoggerContract"]: """Lists a collection of loggers in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-log-event-hubs + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -102,10 +101,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LoggerCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LoggerCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -131,7 +128,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -147,7 +144,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -155,14 +152,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("LoggerCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -175,13 +173,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -204,10 +205,8 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, logg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -220,10 +219,11 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, logg params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,7 +240,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, logg return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" + } @distributed_trace_async async def get( @@ -248,7 +250,8 @@ async def get( ) -> _models.LoggerContract: """Gets the details of the logger specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -271,10 +274,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LoggerContract] + 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( resource_group_name=resource_group_name, @@ -287,10 +288,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -310,7 +312,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" + } @overload async def create_or_update( @@ -326,7 +330,8 @@ async def create_or_update( ) -> _models.LoggerContract: """Creates or Updates a logger. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -361,7 +366,8 @@ async def create_or_update( ) -> _models.LoggerContract: """Creates or Updates a logger. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -394,14 +400,15 @@ async def create_or_update( ) -> _models.LoggerContract: """Creates or Updates a logger. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a LoggerContract type or a IO type. Required. :type parameters: ~azure.mgmt.apimanagement.models.LoggerContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -425,11 +432,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LoggerContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LoggerContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -454,10 +459,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -479,11 +485,13 @@ async def create_or_update( deserialized = self._deserialize("LoggerContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" + } @overload async def update( @@ -499,7 +507,8 @@ async def update( ) -> _models.LoggerContract: """Updates an existing logger. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -534,7 +543,8 @@ async def update( ) -> _models.LoggerContract: """Updates an existing logger. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -567,7 +577,8 @@ async def update( ) -> _models.LoggerContract: """Updates an existing logger. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -577,7 +588,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -598,11 +610,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LoggerContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LoggerContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -627,10 +637,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -650,7 +661,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -658,7 +671,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified logger. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -684,10 +698,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -701,10 +713,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -717,4 +730,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" + } 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 6c6af5a8c43e..917ed33d9373 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -43,10 +42,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +78,11 @@ def list_by_service( ) -> AsyncIterable["_models.NamedValueContract"]: """Lists a collection of named values defined within a service instance. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-properties + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -109,10 +108,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NamedValueCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NamedValueCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -139,7 +136,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -155,7 +152,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -163,14 +160,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("NamedValueCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,7 +181,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues" + } @distributed_trace_async async def get_entity_tag( @@ -191,7 +191,8 @@ async def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the named value specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -213,10 +214,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -229,10 +228,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -249,7 +249,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" + } @distributed_trace_async async def get( @@ -257,7 +259,8 @@ async def get( ) -> _models.NamedValueContract: """Gets the details of the named value specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -279,10 +282,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NamedValueContract] + 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( resource_group_name=resource_group_name, @@ -295,10 +296,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -318,7 +320,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" + } async def _create_or_update_initial( self, @@ -340,11 +344,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.NamedValueContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.NamedValueContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -369,10 +371,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -399,7 +402,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" + } @overload async def begin_create_or_update( @@ -415,7 +420,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.NamedValueContract]: """Creates or updates named value. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -457,7 +463,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.NamedValueContract]: """Creates or updates named value. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -497,13 +504,15 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.NamedValueContract]: """Creates or updates named value. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a NamedValueCreateContract type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.NamedValueCreateContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -527,16 +536,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NamedValueContract] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NamedValueContract] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, @@ -562,9 +569,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -576,9 +583,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" + } async def _update_initial( self, @@ -600,11 +609,9 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.NamedValueContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.NamedValueContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -629,10 +636,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -654,7 +662,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" + } @overload async def begin_update( @@ -670,7 +680,8 @@ async def begin_update( ) -> AsyncLROPoller[_models.NamedValueContract]: """Updates the specific named value. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -712,7 +723,8 @@ async def begin_update( ) -> AsyncLROPoller[_models.NamedValueContract]: """Updates the specific named value. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -752,7 +764,8 @@ async def begin_update( ) -> AsyncLROPoller[_models.NamedValueContract]: """Updates the specific named value. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -761,7 +774,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -782,16 +796,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NamedValueContract] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NamedValueContract] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, @@ -817,9 +829,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -831,9 +843,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -841,7 +855,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific named value from the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -866,10 +881,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -883,10 +896,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -899,7 +913,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" + } @distributed_trace_async async def list_value( @@ -907,7 +923,8 @@ async def list_value( ) -> _models.NamedValueSecretContract: """Gets the secret of the named value specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -929,10 +946,8 @@ async def list_value( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NamedValueSecretContract] + 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( resource_group_name=resource_group_name, @@ -945,10 +960,11 @@ async def list_value( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -968,7 +984,9 @@ async def list_value( return deserialized - list_value.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/listValue"} # type: ignore + list_value.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/listValue" + } async def _refresh_secret_initial( self, resource_group_name: str, service_name: str, named_value_id: str, **kwargs: Any @@ -984,10 +1002,8 @@ async def _refresh_secret_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.NamedValueContract]] + 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( resource_group_name=resource_group_name, @@ -1000,10 +1016,11 @@ async def _refresh_secret_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1025,7 +1042,9 @@ async def _refresh_secret_initial( return deserialized - _refresh_secret_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/refreshSecret"} # type: ignore + _refresh_secret_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/refreshSecret" + } @distributed_trace_async async def begin_refresh_secret( @@ -1033,7 +1052,8 @@ async def begin_refresh_secret( ) -> AsyncLROPoller[_models.NamedValueContract]: """Refresh the secret of the named value specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1055,15 +1075,13 @@ async def begin_refresh_secret( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NamedValueContract] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NamedValueContract] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._refresh_secret_initial( # type: ignore + raw_result = await self._refresh_secret_initial( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, @@ -1086,9 +1104,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1100,6 +1118,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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"} # type: ignore + begin_refresh_secret.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/refreshSecret" + } 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 6e7dfd0a3417..e4bf6b5fdc89 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, List, Optional, TypeVar from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._network_status_operations import build_list_by_location_request, build_list_by_service_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +59,8 @@ async def list_by_service( depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -84,10 +80,8 @@ async def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.NetworkStatusContractByLocation]] + 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( resource_group_name=resource_group_name, @@ -99,10 +93,11 @@ async def list_by_service( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -119,7 +114,9 @@ async def list_by_service( return deserialized - list_by_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/networkstatus"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/networkstatus" + } @distributed_trace_async async def list_by_location( @@ -129,7 +126,8 @@ async def list_by_location( depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -152,10 +150,8 @@ async def list_by_location( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NetworkStatusContract] + 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( resource_group_name=resource_group_name, @@ -168,10 +164,11 @@ async def list_by_location( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,4 +185,6 @@ async def list_by_location( return deserialized - list_by_location.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/locations/{locationName}/networkstatus"} # type: ignore + list_by_location.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/locations/{locationName}/networkstatus" + } 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 cb81eb8f2746..e6b6339466e0 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union import urllib.parse @@ -36,10 +35,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +69,8 @@ def list_by_service( ) -> AsyncIterable["_models.NotificationContract"]: """Lists a collection of properties defined within a service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -92,10 +88,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotificationCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NotificationCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -120,7 +114,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -136,7 +130,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -144,14 +138,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("NotificationCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -164,7 +159,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications" + } @distributed_trace_async async def get( @@ -176,7 +173,8 @@ async def get( ) -> _models.NotificationContract: """Gets the details of the Notification specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -201,10 +199,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotificationContract] + 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( resource_group_name=resource_group_name, @@ -217,10 +213,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,7 +234,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}" + } @distributed_trace_async async def create_or_update( @@ -250,7 +249,8 @@ async def create_or_update( ) -> _models.NotificationContract: """Create or Update API Management publisher notification. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -278,10 +278,8 @@ async def create_or_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotificationContract] + 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( resource_group_name=resource_group_name, @@ -295,10 +293,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -315,4 +314,6 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}" + } 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 c31724b845fe..50e06047b3ce 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -34,10 +33,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +66,8 @@ async def list_by_notification( ) -> _models.RecipientEmailCollection: """Gets the list of the Notification Recipient Emails subscribed to a notification. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -96,10 +92,8 @@ async def list_by_notification( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RecipientEmailCollection] + 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( resource_group_name=resource_group_name, @@ -112,10 +106,11 @@ async def list_by_notification( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,7 +127,9 @@ async def list_by_notification( return deserialized - list_by_notification.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails"} # type: ignore + list_by_notification.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails" + } @distributed_trace_async async def check_entity_exists( @@ -145,7 +142,8 @@ async def check_entity_exists( ) -> bool: """Determine if Notification Recipient Email subscribed to the notification. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -172,10 +170,8 @@ async def check_entity_exists( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -189,10 +185,11 @@ async def check_entity_exists( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -206,7 +203,9 @@ async def check_entity_exists( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - check_entity_exists.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}"} # type: ignore + 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( @@ -219,7 +218,8 @@ async def create_or_update( ) -> _models.RecipientEmailContract: """Adds the Email address to the list of Recipients for the Notification. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -246,10 +246,8 @@ async def create_or_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RecipientEmailContract] + 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( resource_group_name=resource_group_name, @@ -263,10 +261,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -283,11 +282,13 @@ async def create_or_update( deserialized = self._deserialize("RecipientEmailContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}"} # 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 @@ -300,7 +301,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Removes the email from the list of Notification. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -327,10 +329,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -344,10 +344,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -360,4 +361,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}" + } 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 4aabf5efb231..8abfd5f3717d 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -34,10 +33,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +66,8 @@ async def list_by_notification( ) -> _models.RecipientUserCollection: """Gets the list of the Notification Recipient User subscribed to the notification. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -96,10 +92,8 @@ async def list_by_notification( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RecipientUserCollection] + 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( resource_group_name=resource_group_name, @@ -112,10 +106,11 @@ async def list_by_notification( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,7 +127,9 @@ async def list_by_notification( return deserialized - list_by_notification.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers"} # type: ignore + list_by_notification.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers" + } @distributed_trace_async async def check_entity_exists( @@ -145,7 +142,8 @@ async def check_entity_exists( ) -> bool: """Determine if the Notification Recipient User is subscribed to the notification. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -173,10 +171,8 @@ async def check_entity_exists( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -190,10 +186,11 @@ async def check_entity_exists( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -207,7 +204,9 @@ async def check_entity_exists( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - check_entity_exists.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}"} # type: ignore + 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( @@ -220,7 +219,8 @@ async def create_or_update( ) -> _models.RecipientUserContract: """Adds the API Management User to the list of Recipients for the Notification. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -248,10 +248,8 @@ async def create_or_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RecipientUserContract] + 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( resource_group_name=resource_group_name, @@ -265,10 +263,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -285,11 +284,13 @@ async def create_or_update( deserialized = self._deserialize("RecipientUserContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}"} # 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 @@ -302,7 +303,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Removes the API Management user from the list of Notification. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -330,10 +332,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -347,10 +347,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -363,4 +364,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}" + } 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 69846f30c3bc..71e64e65b75e 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -40,10 +39,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +74,8 @@ def list_by_service( ) -> AsyncIterable["_models.OpenidConnectProviderContract"]: """Lists of all the OpenId Connect Providers. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -103,10 +99,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenIdConnectProviderCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OpenIdConnectProviderCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -132,7 +126,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -148,7 +142,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -156,14 +150,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OpenIdConnectProviderCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,13 +171,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -204,10 +202,8 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, opid _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -220,10 +216,11 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, opid params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,7 +237,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, opid return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" + } @distributed_trace_async async def get( @@ -248,7 +247,8 @@ async def get( ) -> _models.OpenidConnectProviderContract: """Gets specific OpenID Connect Provider without secrets. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -270,10 +270,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenidConnectProviderContract] + 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( resource_group_name=resource_group_name, @@ -286,10 +284,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -309,7 +308,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" + } @overload async def create_or_update( @@ -325,7 +326,8 @@ async def create_or_update( ) -> _models.OpenidConnectProviderContract: """Creates or updates the OpenID Connect Provider. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -359,7 +361,8 @@ async def create_or_update( ) -> _models.OpenidConnectProviderContract: """Creates or updates the OpenID Connect Provider. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -391,13 +394,15 @@ async def create_or_update( ) -> _models.OpenidConnectProviderContract: """Creates or updates the OpenID Connect Provider. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :param opid: Identifier of the OpenID Connect Provider. Required. :type opid: str - :param parameters: Create parameters. Is either a model type or a IO type. Required. + :param parameters: Create parameters. Is either a OpenidConnectProviderContract type or a IO + type. Required. :type parameters: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -421,11 +426,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenidConnectProviderContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OpenidConnectProviderContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -450,10 +453,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -475,11 +479,13 @@ async def create_or_update( deserialized = self._deserialize("OpenidConnectProviderContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" + } @overload async def update( @@ -495,7 +501,8 @@ async def update( ) -> _models.OpenidConnectProviderContract: """Updates the specific OpenID Connect Provider. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -529,7 +536,8 @@ async def update( ) -> _models.OpenidConnectProviderContract: """Updates the specific OpenID Connect Provider. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -561,7 +569,8 @@ async def update( ) -> _models.OpenidConnectProviderContract: """Updates the specific OpenID Connect Provider. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -570,7 +579,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -591,11 +601,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenidConnectProviderContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OpenidConnectProviderContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -620,10 +628,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -643,7 +652,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -651,7 +662,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific OpenID Connect Provider of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -676,10 +688,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -693,10 +703,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -709,7 +720,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" + } @distributed_trace_async async def list_secrets( @@ -717,7 +730,8 @@ async def list_secrets( ) -> _models.ClientSecretContract: """Gets the client secret details of the OpenID Connect Provider. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -739,10 +753,8 @@ async def list_secrets( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClientSecretContract] + 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( resource_group_name=resource_group_name, @@ -755,10 +767,11 @@ async def list_secrets( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -778,4 +791,6 @@ async def list_secrets( return deserialized - list_secrets.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}/listSecrets"} # type: ignore + list_secrets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}/listSecrets" + } 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 fd7aaed0835c..6949bbe89ffe 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ...operations._operation_operations import build_list_by_tags_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +67,8 @@ def list_by_tags( ) -> AsyncIterable["_models.TagResourceContract"]: """Lists a collection of operations associated with tags. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -104,10 +100,8 @@ def list_by_tags( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagResourceCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TagResourceCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -135,7 +129,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -151,7 +145,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -159,14 +153,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TagResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -179,4 +174,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operationsByTags"} # type: ignore + 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 37cba885856e..7390ab261d1f 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._outbound_network_dependencies_endpoints_operations import build_list_by_service_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,7 +57,8 @@ async def list_by_service( ) -> _models.OutboundEnvironmentEndpointList: """Gets the network endpoints of all outbound dependencies of a ApiManagement service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -82,10 +78,8 @@ async def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointList] + 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( resource_group_name=resource_group_name, @@ -97,10 +91,11 @@ async def list_by_service( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -117,4 +112,6 @@ async def list_by_service( return deserialized - list_by_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/outboundNetworkDependenciesEndpoints" + } 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 6b2690dcd2ab..032f5020c0b1 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._policy_description_operations import build_list_by_service_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,7 +61,8 @@ async def list_by_service( ) -> _models.PolicyDescriptionCollection: """Lists all policy descriptions. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -89,10 +85,8 @@ async def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyDescriptionCollection] + 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( resource_group_name=resource_group_name, @@ -105,10 +99,11 @@ async def list_by_service( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -125,4 +120,6 @@ async def list_by_service( return deserialized - list_by_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyDescriptions"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyDescriptions" + } 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 new file mode 100644 index 000000000000..d733ba457e7a --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_fragment_operations.py @@ -0,0 +1,715 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._policy_fragment_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_entity_tag_request, + build_get_request, + build_list_by_service_request, + build_list_references_request, +) +from .._vendor import ApiManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PolicyFragmentOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s + :attr:`policy_fragment` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list_by_service( + self, + resource_group_name: str, + service_name: str, + filter: Optional[str] = None, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> _models.PolicyFragmentCollection: + """Gets all policy fragments. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param filter: | Field | Usage | Supported operators | Supported + functions |
|-------------|-------------|-------------|-------------|
| name | + filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
| + description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith + |
| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith + |
. Default value is None. + :type filter: str + :param orderby: OData order by query option. Default value is None. + :type orderby: str + :param top: Number of records to return. Default value is None. + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PolicyFragmentCollection] = kwargs.pop("cls", None) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + orderby=orderby, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PolicyFragmentCollection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments" + } + + @distributed_trace_async + async def get_entity_tag(self, resource_group_name: str, service_name: str, id: str, **kwargs: Any) -> bool: + """Gets the entity state (Etag) version of a policy fragment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if cls: + return cls(pipeline_response, None, response_headers) + 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, + resource_group_name: str, + service_name: str, + id: str, + format: Optional[Union[str, _models.PolicyFragmentContentFormat]] = None, + **kwargs: Any + ) -> _models.PolicyFragmentContract: + """Gets a policy fragment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param id: A resource identifier. Required. + :type id: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PolicyFragmentContract] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("PolicyFragmentContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + id: str, + parameters: Union[_models.PolicyFragmentContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.PolicyFragmentContract]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.PolicyFragmentContract]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PolicyFragmentContract", is_xml=True) + + request = build_create_or_update_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, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("PolicyFragmentContract", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("PolicyFragmentContract", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + id: str, + parameters: _models.PolicyFragmentContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PolicyFragmentContract]: + """Creates or updates a policy fragment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param id: A resource identifier. Required. + :type id: str + :param parameters: The policy fragment contents to apply. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PolicyFragmentContract + :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 JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.PolicyFragmentContract] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PolicyFragmentContract]: + """Creates or updates a policy fragment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param id: A resource identifier. Required. + :type id: str + :param parameters: The policy fragment contents to apply. Required. + :type parameters: IO + :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: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.PolicyFragmentContract] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + id: str, + parameters: Union[_models.PolicyFragmentContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.PolicyFragmentContract]: + """Creates or updates a policy fragment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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 + :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: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.PolicyFragmentContract] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PolicyFragmentContract] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + id=id, + parameters=parameters, + if_match=if_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("PolicyFragmentContract", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, id: str, if_match: str, **kwargs: Any + ) -> None: + """Deletes a policy fragment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param id: A resource identifier. Required. + :type id: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" + } + + @distributed_trace_async + async def list_references( + self, + resource_group_name: str, + service_name: str, + id: str, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> _models.ResourceCollection: + """Lists policy resources that reference the policy fragment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param id: A resource identifier. Required. + :type id: str + :param top: Number of records to return. Default value is None. + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceCollection] = kwargs.pop("cls", None) + + request = build_list_references_request( + resource_group_name=resource_group_name, + service_name=service_name, + id=id, + subscription_id=self._config.subscription_id, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ResourceCollection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_references.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}/listReferences" + } 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 1631ec0dc98d..68436f241096 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -35,10 +34,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +63,8 @@ async def list_by_service( ) -> _models.PolicyCollection: """Lists all the Global Policy definitions of the Api Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -88,10 +84,8 @@ async def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyCollection] + 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( resource_group_name=resource_group_name, @@ -103,10 +97,11 @@ async def list_by_service( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -123,7 +118,9 @@ async def list_by_service( return deserialized - list_by_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies" + } @distributed_trace_async async def get_entity_tag( @@ -132,7 +129,8 @@ async def get_entity_tag( """Gets the entity state (Etag) version of the Global policy definition in the Api Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -154,10 +152,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -170,10 +166,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -190,7 +187,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}" + } @distributed_trace_async async def get( @@ -203,7 +202,8 @@ async def get( ) -> _models.PolicyContract: """Get the Global policy definition of the Api Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -228,10 +228,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyContract] + 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( resource_group_name=resource_group_name, @@ -245,10 +243,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -268,7 +267,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}" + } @overload async def create_or_update( @@ -284,7 +285,8 @@ async def create_or_update( ) -> _models.PolicyContract: """Creates or updates the global policy configuration of the Api Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -318,7 +320,8 @@ async def create_or_update( ) -> _models.PolicyContract: """Creates or updates the global policy configuration of the Api Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -350,13 +353,15 @@ async def create_or_update( ) -> _models.PolicyContract: """Creates or updates the global policy configuration of the Api Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -380,11 +385,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -409,10 +412,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -434,11 +438,13 @@ async def create_or_update( deserialized = self._deserialize("PolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}"} # 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 @@ -451,7 +457,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the global policy configuration of the Api Management Service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -476,10 +483,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -493,10 +498,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -509,4 +515,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}" + } 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 new file mode 100644 index 000000000000..a00b64cd32da --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_config_operations.py @@ -0,0 +1,594 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._portal_config_operations import ( + build_create_or_update_request, + build_get_entity_tag_request, + build_get_request, + build_list_by_service_request, + build_update_request, +) +from .._vendor import ApiManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PortalConfigOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s + :attr:`portal_config` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list_by_service( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> _models.PortalConfigCollection: + """Lists the developer portal configurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PortalConfigCollection] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PortalConfigCollection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs" + } + + @distributed_trace_async + async def get_entity_tag( + self, resource_group_name: str, service_name: str, portal_config_id: str, **kwargs: Any + ) -> bool: + """Gets the entity state (Etag) version of the developer portal configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if cls: + return cls(pipeline_response, None, response_headers) + 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 + ) -> _models.PortalConfigContract: + """Get the developer portal configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PortalConfigContract] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("PortalConfigContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}" + } + + @overload + async def update( + self, + resource_group_name: str, + service_name: str, + portal_config_id: str, + if_match: str, + parameters: _models.PortalConfigContract, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PortalConfigContract: + """Update the developer portal configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param portal_config_id: Portal configuration identifier. Required. + :type portal_config_id: str + :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 the developer portal configuration. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalConfigContract + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default 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: + """ + + @overload + async def update( + self, + resource_group_name: str, + service_name: str, + portal_config_id: str, + if_match: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PortalConfigContract: + """Update the developer portal configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param portal_config_id: Portal configuration identifier. Required. + :type portal_config_id: str + :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 the developer portal configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PortalConfigContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + service_name: str, + portal_config_id: str, + if_match: str, + parameters: Union[_models.PortalConfigContract, IO], + **kwargs: Any + ) -> _models.PortalConfigContract: + """Update the developer portal configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param portal_config_id: Portal configuration identifier. Required. + :type portal_config_id: str + :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 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 + :return: PortalConfigContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PortalConfigContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PortalConfigContract", is_xml=True) + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + portal_config_id=portal_config_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PortalConfigContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + portal_config_id: str, + if_match: str, + parameters: _models.PortalConfigContract, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PortalConfigContract: + """Create or update the developer portal configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param portal_config_id: Portal configuration identifier. Required. + :type portal_config_id: str + :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 the developer portal configuration. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalConfigContract + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default 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: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + portal_config_id: str, + if_match: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PortalConfigContract: + """Create or update the developer portal configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param portal_config_id: Portal configuration identifier. Required. + :type portal_config_id: str + :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 the developer portal configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PortalConfigContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + portal_config_id: str, + if_match: str, + parameters: Union[_models.PortalConfigContract, IO], + **kwargs: Any + ) -> _models.PortalConfigContract: + """Create or update the developer portal configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param portal_config_id: Portal configuration identifier. Required. + :type portal_config_id: str + :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 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 + :return: PortalConfigContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PortalConfigContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PortalConfigContract", is_xml=True) + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + portal_config_id=portal_config_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PortalConfigContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}" + } 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 b7c4ac85d9d8..8d5055481328 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +39,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +74,8 @@ def list_by_service( ) -> AsyncIterable["_models.PortalRevisionContract"]: """Lists developer portal's revisions. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -110,10 +106,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalRevisionCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PortalRevisionCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -139,7 +133,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -155,7 +149,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -163,14 +157,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PortalRevisionCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,7 +178,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions" + } @distributed_trace_async async def get_entity_tag( @@ -191,7 +188,8 @@ async def get_entity_tag( ) -> bool: """Gets the developer portal revision specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -214,10 +212,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -230,10 +226,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -250,7 +247,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" + } @distributed_trace_async async def get( @@ -258,7 +257,8 @@ async def get( ) -> _models.PortalRevisionContract: """Gets the developer portal's revision specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -281,10 +281,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalRevisionContract] + 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( resource_group_name=resource_group_name, @@ -297,10 +295,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -320,7 +319,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" + } async def _create_or_update_initial( self, @@ -341,11 +342,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PortalRevisionContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.PortalRevisionContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -369,10 +368,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -394,7 +394,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" + } @overload async def begin_create_or_update( @@ -410,7 +412,8 @@ async def begin_create_or_update( """Creates a new developer portal's revision by running the portal's publishing. The ``isCurrent`` property indicates if the revision is publicly accessible. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -451,7 +454,8 @@ async def begin_create_or_update( """Creates a new developer portal's revision by running the portal's publishing. The ``isCurrent`` property indicates if the revision is publicly accessible. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -490,14 +494,15 @@ async def begin_create_or_update( """Creates a new developer portal's revision by running the portal's publishing. The ``isCurrent`` property indicates if the revision is publicly accessible. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :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. @@ -519,16 +524,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalRevisionContract] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PortalRevisionContract] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, portal_revision_id=portal_revision_id, @@ -553,9 +556,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -567,9 +570,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" + } async def _update_initial( self, @@ -591,11 +596,9 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PortalRevisionContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.PortalRevisionContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -620,10 +623,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -645,7 +649,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" + } @overload async def begin_update( @@ -661,7 +667,8 @@ async def begin_update( ) -> AsyncLROPoller[_models.PortalRevisionContract]: """Updates the description of specified portal revision or makes it current. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -705,7 +712,8 @@ async def begin_update( ) -> AsyncLROPoller[_models.PortalRevisionContract]: """Updates the description of specified portal revision or makes it current. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -747,7 +755,8 @@ async def begin_update( ) -> AsyncLROPoller[_models.PortalRevisionContract]: """Updates the description of specified portal revision or makes it current. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -757,7 +766,7 @@ 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 model type or a IO type. Required. + :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. @@ -779,16 +788,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalRevisionContract] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PortalRevisionContract] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, service_name=service_name, portal_revision_id=portal_revision_id, @@ -814,9 +821,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -828,6 +835,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" + } 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 479e581ad91c..5e4f4d6718ee 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._portal_settings_operations import build_list_by_service_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,7 +57,8 @@ async def list_by_service( ) -> _models.PortalSettingsCollection: """Lists a collection of portalsettings defined within a service instance.. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -82,10 +78,8 @@ async def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalSettingsCollection] + 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( resource_group_name=resource_group_name, @@ -97,10 +91,11 @@ async def list_by_service( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -117,4 +112,6 @@ async def list_by_service( return deserialized - list_by_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings" + } 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 425680d06485..2908d03a1f91 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -41,10 +40,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +69,8 @@ def list_by_service( ) -> AsyncIterable["_models.PrivateEndpointConnection"]: """Lists all private endpoint connections of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -88,10 +84,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -114,7 +108,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -130,7 +124,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -138,14 +132,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -158,7 +153,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections" + } @distributed_trace_async async def get_by_name( @@ -166,7 +163,8 @@ async def get_by_name( ) -> _models.PrivateEndpointConnection: """Gets the details of the Private Endpoint Connection specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -188,10 +186,8 @@ async def get_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + 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( resource_group_name=resource_group_name, @@ -204,10 +200,11 @@ async def get_by_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -224,7 +221,9 @@ async def get_by_name( return deserialized - get_by_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get_by_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _create_or_update_initial( self, @@ -245,11 +244,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -273,10 +270,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -295,7 +293,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload async def begin_create_or_update( @@ -310,7 +310,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Creates a new Private Endpoint Connection or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -350,7 +351,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Creates a new Private Endpoint Connection or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -387,13 +389,15 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Creates a new Private Endpoint Connection or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param private_endpoint_connection_request: Is either a PrivateEndpointConnectionRequest type + or a IO 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'. @@ -416,16 +420,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -446,7 +448,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -458,9 +460,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -476,10 +480,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -492,10 +494,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -508,7 +511,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def begin_delete( @@ -516,7 +521,8 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Deletes the specified Private Endpoint Connection. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -537,13 +543,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -562,7 +566,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -574,9 +578,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def list_private_link_resources( @@ -584,7 +590,8 @@ async def list_private_link_resources( ) -> _models.PrivateLinkResourceListResult: """Gets the private link resources. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -604,10 +611,8 @@ async def list_private_link_resources( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourceListResult] + 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( resource_group_name=resource_group_name, @@ -619,10 +624,11 @@ async def list_private_link_resources( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -639,7 +645,9 @@ async def list_private_link_resources( return deserialized - list_private_link_resources.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources"} # type: ignore + list_private_link_resources.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources" + } @distributed_trace_async async def get_private_link_resource( @@ -647,7 +655,8 @@ async def get_private_link_resource( ) -> _models.PrivateLinkResource: """Gets the private link resources. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -669,10 +678,8 @@ async def get_private_link_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] + 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( resource_group_name=resource_group_name, @@ -685,10 +692,11 @@ async def get_private_link_resource( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -705,4 +713,6 @@ async def get_private_link_resource( return deserialized - get_private_link_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources/{privateLinkSubResourceName}"} # type: ignore + get_private_link_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources/{privateLinkSubResourceName}" + } 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 54e8c00fabab..2ca42cfa626a 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -37,10 +36,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +72,8 @@ def list_by_product( ) -> AsyncIterable["_models.ApiContract"]: """Lists a collection of the APIs associated with a product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -105,10 +101,8 @@ def list_by_product( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -135,7 +129,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -151,7 +145,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -159,14 +153,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ApiCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -179,7 +174,9 @@ 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"} # type: ignore + 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( @@ -187,7 +184,8 @@ async def check_entity_exists( ) -> bool: """Checks that API entity specified by identifier is associated with the Product entity. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -213,10 +211,8 @@ async def check_entity_exists( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -230,10 +226,11 @@ async def check_entity_exists( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -247,7 +244,9 @@ async def check_entity_exists( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - check_entity_exists.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}"} # type: ignore + 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( @@ -255,7 +254,8 @@ async def create_or_update( ) -> _models.ApiContract: """Adds an API to the specified product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -281,10 +281,8 @@ async def create_or_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiContract] + 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( resource_group_name=resource_group_name, @@ -298,10 +296,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -318,11 +317,13 @@ async def create_or_update( deserialized = self._deserialize("ApiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}"} # 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 @@ -330,7 +331,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified API from the specified product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -356,10 +358,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -373,10 +373,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,4 +390,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}" + } 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 3afa3d8a8d3c..a2c0cb5547e2 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -37,10 +36,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +72,8 @@ def list_by_product( ) -> AsyncIterable["_models.GroupContract"]: """Lists the collection of developer groups associated with the specified product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -101,10 +97,8 @@ def list_by_product( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GroupCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -131,7 +125,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -147,7 +141,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -155,14 +149,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("GroupCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -175,7 +170,9 @@ 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"} # type: ignore + 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( @@ -183,7 +180,8 @@ async def check_entity_exists( ) -> bool: """Checks that Group entity specified by identifier is associated with the Product entity. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -209,10 +207,8 @@ async def check_entity_exists( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -226,10 +222,11 @@ async def check_entity_exists( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -243,7 +240,9 @@ async def check_entity_exists( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - check_entity_exists.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}"} # type: ignore + 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( @@ -251,7 +250,8 @@ async def create_or_update( ) -> _models.GroupContract: """Adds the association between the specified developer group with the specified product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -277,10 +277,8 @@ async def create_or_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupContract] + 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( resource_group_name=resource_group_name, @@ -294,10 +292,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -314,11 +313,13 @@ async def create_or_update( deserialized = self._deserialize("GroupContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}"} # 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 @@ -326,7 +327,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the association between the specified group and product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -352,10 +354,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -369,10 +369,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -385,4 +386,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}" + } 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 c0fbec4e5b42..2153abeb7fe1 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -40,10 +39,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +76,8 @@ def list_by_service( ) -> AsyncIterable["_models.ProductContract"]: """Lists a collection of products in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -112,10 +108,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProductCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProductCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -143,7 +137,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -159,7 +153,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -167,14 +161,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProductCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,13 +182,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -216,10 +214,8 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, prod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -232,10 +228,11 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, prod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -252,7 +249,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, prod return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" + } @distributed_trace_async async def get( @@ -260,7 +259,8 @@ async def get( ) -> _models.ProductContract: """Gets the details of the product specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -283,10 +283,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProductContract] + 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( resource_group_name=resource_group_name, @@ -299,10 +297,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -322,7 +321,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" + } @overload async def create_or_update( @@ -338,7 +339,8 @@ async def create_or_update( ) -> _models.ProductContract: """Creates or Updates a product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -373,7 +375,8 @@ async def create_or_update( ) -> _models.ProductContract: """Creates or Updates a product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -406,14 +409,16 @@ async def create_or_update( ) -> _models.ProductContract: """Creates or Updates a product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -437,11 +442,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProductContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ProductContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -466,10 +469,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -491,11 +495,13 @@ async def create_or_update( deserialized = self._deserialize("ProductContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" + } @overload async def update( @@ -511,7 +517,8 @@ async def update( ) -> _models.ProductContract: """Update existing product details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -546,7 +553,8 @@ async def update( ) -> _models.ProductContract: """Update existing product details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -579,7 +587,8 @@ async def update( ) -> _models.ProductContract: """Update existing product details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -589,7 +598,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -610,11 +620,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProductContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ProductContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -639,10 +647,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -662,7 +671,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -676,7 +687,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -705,10 +717,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -723,10 +733,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -739,7 +750,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" + } @distributed_trace def list_by_tags( @@ -754,7 +767,8 @@ def list_by_tags( ) -> AsyncIterable["_models.TagResourceContract"]: """Lists a collection of products associated with tags. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -782,10 +796,8 @@ def list_by_tags( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagResourceCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TagResourceCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -812,7 +824,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -828,7 +840,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -836,14 +848,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TagResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -856,4 +869,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/productsByTags"} # type: ignore + 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 e8319abde59f..3a10b32a589b 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -35,10 +34,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +63,8 @@ async def list_by_product( ) -> _models.PolicyCollection: """Get the policy configuration at the Product level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -91,10 +87,8 @@ async def list_by_product( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyCollection] + 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( resource_group_name=resource_group_name, @@ -107,10 +101,11 @@ async def list_by_product( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -127,7 +122,9 @@ async def list_by_product( return deserialized - list_by_product.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies"} # type: ignore + list_by_product.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies" + } @distributed_trace_async async def get_entity_tag( @@ -140,7 +137,8 @@ async def get_entity_tag( ) -> bool: """Get the ETag of the policy configuration at the Product level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -165,10 +163,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -182,10 +178,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -202,7 +199,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}" + } @distributed_trace_async async def get( @@ -216,7 +215,8 @@ async def get( ) -> _models.PolicyContract: """Get the policy configuration at the Product level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -244,10 +244,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyContract] + 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( resource_group_name=resource_group_name, @@ -262,10 +260,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -285,7 +284,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}" + } @overload async def create_or_update( @@ -302,7 +303,8 @@ async def create_or_update( ) -> _models.PolicyContract: """Creates or updates policy configuration for the Product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -340,7 +342,8 @@ async def create_or_update( ) -> _models.PolicyContract: """Creates or updates policy configuration for the Product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -376,7 +379,8 @@ async def create_or_update( ) -> _models.PolicyContract: """Creates or updates policy configuration for the Product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -385,7 +389,8 @@ 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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -409,11 +414,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -439,10 +442,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -464,11 +468,13 @@ async def create_or_update( deserialized = self._deserialize("PolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}"} # 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 @@ -482,7 +488,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the policy configuration at the Product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -510,10 +517,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -528,10 +533,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -544,4 +550,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}" + } 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 672463cf8491..e350e8396346 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ...operations._product_subscriptions_operations import build_list_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +66,8 @@ def list( ) -> AsyncIterable["_models.SubscriptionContract"]: """Lists the collection of subscriptions to the specified product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -104,10 +100,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SubscriptionCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -134,7 +128,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -150,7 +144,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -158,14 +152,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SubscriptionCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -178,4 +173,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}/products/{productId}/subscriptions"} # type: ignore + 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 new file mode 100644 index 000000000000..4970f8d2d686 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wiki_operations.py @@ -0,0 +1,615 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._product_wiki_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_entity_tag_request, + build_get_request, + build_update_request, +) +from .._vendor import ApiManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ProductWikiOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s + :attr:`product_wiki` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get_entity_tag(self, resource_group_name: str, service_name: str, product_id: str, **kwargs: Any) -> bool: + """Gets the entity state (Etag) version of the Wiki for a Product specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if cls: + return cls(pipeline_response, None, response_headers) + 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 + ) -> _models.WikiContract: + """Gets the details of the Wiki for a Product specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WikiContract] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("WikiContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + product_id: str, + parameters: _models.WikiContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WikiContract: + """Creates a new Wiki for a Product or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param product_id: Product identifier. Must be unique in the current API Management service + instance. Required. + :type product_id: str + :param parameters: Create parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.WikiContract + :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 JSON body. + Default 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: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + product_id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WikiContract: + """Creates a new Wiki for a Product or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param product_id: Product identifier. Must be unique in the current API Management service + instance. Required. + :type product_id: str + :param parameters: Create parameters. Required. + :type parameters: IO + :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: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + product_id: str, + parameters: Union[_models.WikiContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> _models.WikiContract: + """Creates a new Wiki for a Product or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WikiContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "WikiContract", is_xml=True) + + request = build_create_or_update_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, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("WikiContract", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("WikiContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + 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, + resource_group_name: str, + service_name: str, + product_id: str, + if_match: str, + parameters: _models.WikiUpdateContract, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WikiContract: + """Updates the details of the Wiki for a Product specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param product_id: Product identifier. Must be unique in the current API Management service + instance. Required. + :type product_id: str + :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. Required. + :type parameters: ~azure.mgmt.apimanagement.models.WikiUpdateContract + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default 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: + """ + + @overload + async def update( + self, + resource_group_name: str, + service_name: str, + product_id: str, + if_match: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WikiContract: + """Updates the details of the Wiki for a Product specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param product_id: Product identifier. Must be unique in the current API Management service + instance. Required. + :type product_id: str + :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. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WikiContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.WikiContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + service_name: str, + product_id: str, + if_match: str, + parameters: Union[_models.WikiUpdateContract, IO], + **kwargs: Any + ) -> _models.WikiContract: + """Updates the details of the Wiki for a Product specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param product_id: Product identifier. Must be unique in the current API Management service + instance. Required. + :type product_id: str + :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 + :return: WikiContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.WikiContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WikiContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "WikiUpdateContract") + + request = build_update_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, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("WikiContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, product_id: str, if_match: str, **kwargs: Any + ) -> None: + """Deletes the specified Wiki from a Product. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param product_id: Product identifier. Must be unique in the current API Management service + instance. Required. + :type product_id: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" + } 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 new file mode 100644 index 000000000000..898949cf5bf4 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wikis_operations.py @@ -0,0 +1,168 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._product_wikis_operations import build_list_request +from .._vendor import ApiManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ProductWikisOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s + :attr:`product_wikis` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + product_id: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.WikiContract"]: + """Gets the details of the Wiki for a Product specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param product_id: Product identifier. Must be unique in the current API Management service + instance. Required. + :type product_id: str + :param filter: | Field | Usage | Supported operators | Supported + functions |
|-------------|-------------|-------------|-------------|
| name | + filter | eq | contains |
. Default value is None. + :type filter: str + :param top: Number of records to return. Default value is None. + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WikiCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + filter=filter, + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WikiCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 cc7cd725a7a9..813f9c808f4d 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._quota_by_counter_keys_operations import build_list_by_service_request, build_update_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +58,12 @@ async def list_by_service( """Lists a collection of current quota counter periods associated with the counter-key configured in the policy on the specified service instance. The api does not support paging yet. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-product-with-rules#a-namepolicies-ato-configure-call-rate-limit-and-quota-policies + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -88,10 +88,8 @@ async def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.QuotaCounterCollection] + 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( resource_group_name=resource_group_name, @@ -104,10 +102,11 @@ async def list_by_service( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -124,7 +123,9 @@ async def list_by_service( return deserialized - list_by_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}" + } @overload async def update( @@ -140,7 +141,8 @@ async def update( """Updates all the quota counter values specified with the existing quota counter key to a value in the specified service instance. This should be used for reset of the quota counter values. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -175,7 +177,8 @@ async def update( """Updates all the quota counter values specified with the existing quota counter key to a value in the specified service instance. This should be used for reset of the quota counter values. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -208,7 +211,8 @@ async def update( """Updates all the quota counter values specified with the existing quota counter key to a value in the specified service instance. This should be used for reset of the quota counter values. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -218,7 +222,7 @@ 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 model type or a IO type. Required. + 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. @@ -239,11 +243,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.QuotaCounterCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.QuotaCounterCollection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -267,10 +269,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -287,4 +290,6 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}" + } 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 8ea0b5c93bda..893702243da0 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._quota_by_period_keys_operations import build_get_request, build_update_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +58,12 @@ async def get( """Gets the value of the quota counter associated with the counter-key in the policy for the specific period in service instance. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-product-with-rules#a-namepolicies-ato-configure-call-rate-limit-and-quota-policies + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -90,10 +90,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.QuotaCounterContract] + 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( resource_group_name=resource_group_name, @@ -107,10 +105,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -127,7 +126,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}" + } @overload async def update( @@ -143,7 +144,8 @@ async def update( ) -> _models.QuotaCounterContract: """Updates an existing quota counter value in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -180,7 +182,8 @@ async def update( ) -> _models.QuotaCounterContract: """Updates an existing quota counter value in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -215,7 +218,8 @@ async def update( ) -> _models.QuotaCounterContract: """Updates an existing quota counter value in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -227,7 +231,7 @@ 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 model type or a IO type. Required. + 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. @@ -248,11 +252,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.QuotaCounterContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.QuotaCounterContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -277,10 +279,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -297,4 +300,6 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}" + } 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 2ebfdf334bc9..bb848961c98d 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ...operations._region_operations import build_list_by_service_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +59,8 @@ def list_by_service( ) -> AsyncIterable["_models.RegionContract"]: """Lists all azure regions in which the service exists. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -77,10 +73,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RegionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +97,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +113,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,14 +121,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RegionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -147,4 +142,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}/regions"} # type: ignore + 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 2c3c9df3a126..ddf2de919bc4 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 @@ -7,7 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -41,10 +40,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +76,8 @@ def list_by_api( ) -> AsyncIterable["_models.ReportRecordContract"]: """Lists report records by API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -103,10 +99,8 @@ def list_by_api( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReportCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -133,7 +127,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -149,7 +143,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -157,14 +151,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -177,7 +172,9 @@ 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"} # type: ignore + list_by_api.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byApi" + } @distributed_trace def list_by_user( @@ -192,7 +189,8 @@ def list_by_user( ) -> AsyncIterable["_models.ReportRecordContract"]: """Lists report records by User. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -227,10 +225,8 @@ def list_by_user( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReportCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -257,7 +253,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -273,7 +269,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -281,14 +277,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -301,7 +298,9 @@ 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"} # type: ignore + list_by_user.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byUser" + } @distributed_trace def list_by_operation( @@ -316,7 +315,8 @@ def list_by_operation( ) -> AsyncIterable["_models.ReportRecordContract"]: """Lists report records by API Operations. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -351,10 +351,8 @@ def list_by_operation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReportCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -381,7 +379,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -397,7 +395,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -405,14 +403,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -425,7 +424,9 @@ 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"} # type: ignore + list_by_operation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byOperation" + } @distributed_trace def list_by_product( @@ -440,7 +441,8 @@ def list_by_product( ) -> AsyncIterable["_models.ReportRecordContract"]: """Lists report records by Product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -474,10 +476,8 @@ def list_by_product( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReportCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -504,7 +504,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -520,7 +520,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -528,14 +528,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -548,7 +549,9 @@ 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"} # type: ignore + list_by_product.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byProduct" + } @distributed_trace def list_by_geo( @@ -562,7 +565,8 @@ def list_by_geo( ) -> AsyncIterable["_models.ReportRecordContract"]: """Lists report records by geography. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -594,10 +598,8 @@ def list_by_geo( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReportCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -623,7 +625,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -639,7 +641,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -647,14 +649,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -667,7 +670,9 @@ 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"} # type: ignore + list_by_geo.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byGeo" + } @distributed_trace def list_by_subscription( @@ -682,7 +687,8 @@ def list_by_subscription( ) -> AsyncIterable["_models.ReportRecordContract"]: """Lists report records by subscription. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -716,10 +722,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReportCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -746,7 +750,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -762,7 +766,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -770,14 +774,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -790,7 +795,9 @@ 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"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/bySubscription" + } @distributed_trace def list_by_time( @@ -806,7 +813,8 @@ def list_by_time( ) -> AsyncIterable["_models.ReportRecordContract"]: """Lists report records by Time. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -844,10 +852,8 @@ def list_by_time( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReportCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -875,7 +881,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -891,7 +897,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -899,14 +905,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -919,7 +926,9 @@ 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"} # type: ignore + list_by_time.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byTime" + } @distributed_trace def list_by_request( @@ -933,7 +942,8 @@ def list_by_request( ) -> AsyncIterable["_models.RequestReportRecordContract"]: """Lists report records by Request. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -957,10 +967,8 @@ def list_by_request( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RequestReportCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RequestReportCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -986,7 +994,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1002,7 +1010,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1010,14 +1018,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RequestReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1030,4 +1039,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_request.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byRequest"} # type: ignore + 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 41b9ce954a11..c87c4602b353 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -34,10 +33,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +60,8 @@ def __init__(self, *args, **kwargs) -> None: async def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the SignInSettings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -85,10 +81,8 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -100,10 +94,11 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -120,13 +115,16 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -146,10 +144,8 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalSigninSettings] + 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( resource_group_name=resource_group_name, @@ -161,10 +157,11 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -184,7 +181,9 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin" + } @overload async def update( # pylint: disable=inconsistent-return-statements @@ -199,7 +198,8 @@ async def update( # pylint: disable=inconsistent-return-statements ) -> None: """Update Sign-In settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -230,7 +230,8 @@ async def update( # pylint: disable=inconsistent-return-statements ) -> None: """Update Sign-In settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -259,14 +260,16 @@ async def update( # pylint: disable=inconsistent-return-statements ) -> None: """Update Sign-In settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :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. @@ -287,11 +290,9 @@ async def update( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -315,10 +316,11 @@ async def update( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -331,7 +333,9 @@ async def update( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin" + } @overload async def create_or_update( @@ -346,7 +350,8 @@ async def create_or_update( ) -> _models.PortalSigninSettings: """Create or Update Sign-In settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -377,7 +382,8 @@ async def create_or_update( ) -> _models.PortalSigninSettings: """Create or Update Sign-In settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -406,11 +412,13 @@ async def create_or_update( ) -> _models.PortalSigninSettings: """Create or Update Sign-In settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -434,11 +442,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalSigninSettings] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PortalSigninSettings] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -462,10 +468,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -482,4 +489,6 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin" + } 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 5e3a42ca7a33..3d7483dcd4b9 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -34,10 +33,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +60,8 @@ def __init__(self, *args, **kwargs) -> None: async def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the SignUpSettings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -85,10 +81,8 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -100,10 +94,11 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -120,13 +115,16 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -146,10 +144,8 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalSignupSettings] + 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( resource_group_name=resource_group_name, @@ -161,10 +157,11 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -184,7 +181,9 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup" + } @overload async def update( # pylint: disable=inconsistent-return-statements @@ -199,7 +198,8 @@ async def update( # pylint: disable=inconsistent-return-statements ) -> None: """Update Sign-Up settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -230,7 +230,8 @@ async def update( # pylint: disable=inconsistent-return-statements ) -> None: """Update Sign-Up settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -259,14 +260,16 @@ async def update( # pylint: disable=inconsistent-return-statements ) -> None: """Update Sign-Up settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :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. @@ -287,11 +290,9 @@ async def update( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -315,10 +316,11 @@ async def update( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -331,7 +333,9 @@ async def update( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup" + } @overload async def create_or_update( @@ -346,7 +350,8 @@ async def create_or_update( ) -> _models.PortalSignupSettings: """Create or Update Sign-Up settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -377,7 +382,8 @@ async def create_or_update( ) -> _models.PortalSignupSettings: """Create or Update Sign-Up settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -406,11 +412,13 @@ async def create_or_update( ) -> _models.PortalSignupSettings: """Create or Update Sign-Up settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -434,11 +442,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalSignupSettings] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PortalSignupSettings] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -462,10 +468,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -482,4 +489,6 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup" + } 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 6794cf28483e..a2cc0057e43e 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -42,10 +41,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +76,8 @@ def list( ) -> AsyncIterable["_models.SubscriptionContract"]: """Lists all subscriptions of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -111,10 +107,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SubscriptionCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -140,7 +134,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -156,7 +150,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -164,14 +158,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SubscriptionCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -184,14 +179,17 @@ 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"} # type: ignore + 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 identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -214,10 +212,8 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, sid: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -230,10 +226,11 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, sid: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -250,7 +247,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, sid: return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" + } @distributed_trace_async async def get( @@ -258,7 +257,8 @@ async def get( ) -> _models.SubscriptionContract: """Gets the specified Subscription entity. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -281,10 +281,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionContract] + 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( resource_group_name=resource_group_name, @@ -297,10 +295,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -320,7 +319,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" + } @overload async def create_or_update( @@ -338,7 +339,8 @@ async def create_or_update( ) -> _models.SubscriptionContract: """Creates or updates the subscription of specified user to the specified product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -385,7 +387,8 @@ async def create_or_update( ) -> _models.SubscriptionContract: """Creates or updates the subscription of specified user to the specified product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -430,14 +433,16 @@ async def create_or_update( ) -> _models.SubscriptionContract: """Creates or updates the subscription of specified user to the specified product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a SubscriptionCreateParameters type or a IO + type. Required. :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionCreateParameters or IO :param notify: Notify change in Subscription State. @@ -471,11 +476,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SubscriptionContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -502,10 +505,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -527,11 +531,13 @@ async def create_or_update( 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 + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" + } @overload async def update( @@ -549,7 +555,8 @@ async def update( ) -> _models.SubscriptionContract: """Updates the details of a subscription specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -596,7 +603,8 @@ async def update( ) -> _models.SubscriptionContract: """Updates the details of a subscription specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -641,7 +649,8 @@ async def update( ) -> _models.SubscriptionContract: """Updates the details of a subscription specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -651,7 +660,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: Update parameters. Is either a model type or a IO type. Required. + :param parameters: Update parameters. Is either a SubscriptionUpdateParameters type or a IO + type. Required. :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionUpdateParameters or IO :param notify: Notify change in Subscription State. @@ -682,11 +692,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SubscriptionContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -713,10 +721,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -736,7 +745,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -744,7 +755,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified subscription. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -770,10 +782,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -787,10 +797,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -803,7 +814,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" + } @distributed_trace_async async def regenerate_primary_key( # pylint: disable=inconsistent-return-statements @@ -811,7 +824,8 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme ) -> None: """Regenerates primary key of existing subscription of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -834,10 +848,8 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -850,10 +862,11 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -866,7 +879,9 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme if cls: return cls(pipeline_response, None, {}) - regenerate_primary_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regeneratePrimaryKey"} # type: ignore + regenerate_primary_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regeneratePrimaryKey" + } @distributed_trace_async async def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements @@ -874,7 +889,8 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state ) -> None: """Regenerates secondary key of existing subscription of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -897,10 +913,8 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -913,10 +927,11 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -929,7 +944,9 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state if cls: return cls(pipeline_response, None, {}) - regenerate_secondary_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regenerateSecondaryKey"} # type: ignore + regenerate_secondary_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regenerateSecondaryKey" + } @distributed_trace_async async def list_secrets( @@ -937,7 +954,8 @@ async def list_secrets( ) -> _models.SubscriptionKeysContract: """Gets the specified Subscription keys. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -960,10 +978,8 @@ async def list_secrets( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionKeysContract] + 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( resource_group_name=resource_group_name, @@ -976,10 +992,11 @@ async def list_secrets( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -999,4 +1016,6 @@ async def list_secrets( return deserialized - list_secrets.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/listSecrets"} # type: ignore + list_secrets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/listSecrets" + } 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 3787f886cb2a..e83c610d6026 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -54,10 +53,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,7 +90,8 @@ def list_by_operation( ) -> AsyncIterable["_models.TagContract"]: """Lists all Tags associated with the Operation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -123,10 +119,8 @@ def list_by_operation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TagCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -154,7 +148,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -170,7 +164,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -178,14 +172,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TagCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -198,7 +193,9 @@ 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"} # type: ignore + 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( @@ -206,7 +203,8 @@ async def get_entity_state_by_operation( ) -> bool: """Gets the entity state version of the tag specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -235,10 +233,8 @@ async def get_entity_state_by_operation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -253,10 +249,11 @@ async def get_entity_state_by_operation( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -273,7 +270,9 @@ async def get_entity_state_by_operation( return cls(pipeline_response, None, response_headers) 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}"} # type: ignore + 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( @@ -281,7 +280,8 @@ async def get_by_operation( ) -> _models.TagContract: """Get tag associated with the Operation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -310,10 +310,8 @@ async def get_by_operation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagContract] + 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( resource_group_name=resource_group_name, @@ -328,10 +326,11 @@ async def get_by_operation( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -351,7 +350,9 @@ async def get_by_operation( return deserialized - get_by_operation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}"} # type: ignore + get_by_operation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}" + } @distributed_trace_async async def assign_to_operation( @@ -359,7 +360,8 @@ async def assign_to_operation( ) -> _models.TagContract: """Assign tag to the Operation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -388,10 +390,8 @@ async def assign_to_operation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagContract] + 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( resource_group_name=resource_group_name, @@ -406,10 +406,11 @@ async def assign_to_operation( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -426,11 +427,13 @@ async def assign_to_operation( deserialized = self._deserialize("TagContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - assign_to_operation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}"} # 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 @@ -438,7 +441,8 @@ async def detach_from_operation( # pylint: disable=inconsistent-return-statemen ) -> None: """Detach the tag from the Operation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -467,10 +471,8 @@ async def detach_from_operation( # pylint: disable=inconsistent-return-statemen _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -485,10 +487,11 @@ async def detach_from_operation( # pylint: disable=inconsistent-return-statemen params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -501,7 +504,9 @@ async def detach_from_operation( # pylint: disable=inconsistent-return-statemen 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}"} # type: ignore + detach_from_operation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}" + } @distributed_trace def list_by_api( @@ -516,7 +521,8 @@ def list_by_api( ) -> AsyncIterable["_models.TagContract"]: """Lists all Tags associated with the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -541,10 +547,8 @@ def list_by_api( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TagCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -571,7 +575,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -587,7 +591,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -595,14 +599,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TagCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -615,7 +620,9 @@ 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"} # type: ignore + 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( @@ -623,7 +630,8 @@ async def get_entity_state_by_api( ) -> bool: """Gets the entity state version of the tag specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -649,10 +657,8 @@ async def get_entity_state_by_api( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -666,10 +672,11 @@ async def get_entity_state_by_api( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -686,7 +693,9 @@ async def get_entity_state_by_api( return cls(pipeline_response, None, response_headers) 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}"} # type: ignore + 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( @@ -694,7 +703,8 @@ async def get_by_api( ) -> _models.TagContract: """Get tag associated with the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -720,10 +730,8 @@ async def get_by_api( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagContract] + 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( resource_group_name=resource_group_name, @@ -737,10 +745,11 @@ async def get_by_api( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -760,7 +769,9 @@ async def get_by_api( return deserialized - get_by_api.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}"} # type: ignore + get_by_api.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}" + } @distributed_trace_async async def assign_to_api( @@ -768,7 +779,8 @@ async def assign_to_api( ) -> _models.TagContract: """Assign tag to the Api. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -794,10 +806,8 @@ async def assign_to_api( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagContract] + 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( resource_group_name=resource_group_name, @@ -811,10 +821,11 @@ async def assign_to_api( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -836,11 +847,13 @@ async def assign_to_api( deserialized = self._deserialize("TagContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - assign_to_api.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}"} # 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 @@ -848,7 +861,8 @@ async def detach_from_api( # pylint: disable=inconsistent-return-statements ) -> None: """Detach the tag from the Api. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -874,10 +888,8 @@ async def detach_from_api( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -891,10 +903,11 @@ async def detach_from_api( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -907,7 +920,9 @@ async def detach_from_api( # pylint: disable=inconsistent-return-statements 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}"} # type: ignore + detach_from_api.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}" + } @distributed_trace def list_by_product( @@ -922,7 +937,8 @@ def list_by_product( ) -> AsyncIterable["_models.TagContract"]: """Lists all Tags associated with the Product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -947,10 +963,8 @@ def list_by_product( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TagCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -977,7 +991,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -993,7 +1007,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1001,14 +1015,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TagCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1021,7 +1036,9 @@ 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"} # type: ignore + 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( @@ -1029,7 +1046,8 @@ async def get_entity_state_by_product( ) -> bool: """Gets the entity state version of the tag specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1055,10 +1073,8 @@ async def get_entity_state_by_product( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -1072,10 +1088,11 @@ async def get_entity_state_by_product( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1092,7 +1109,9 @@ async def get_entity_state_by_product( return cls(pipeline_response, None, response_headers) 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}"} # type: ignore + 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( @@ -1100,7 +1119,8 @@ async def get_by_product( ) -> _models.TagContract: """Get tag associated with the Product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1126,10 +1146,8 @@ async def get_by_product( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagContract] + 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( resource_group_name=resource_group_name, @@ -1143,10 +1161,11 @@ async def get_by_product( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1166,7 +1185,9 @@ async def get_by_product( return deserialized - get_by_product.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}"} # type: ignore + get_by_product.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}" + } @distributed_trace_async async def assign_to_product( @@ -1174,7 +1195,8 @@ async def assign_to_product( ) -> _models.TagContract: """Assign tag to the Product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1200,10 +1222,8 @@ async def assign_to_product( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagContract] + 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( resource_group_name=resource_group_name, @@ -1217,10 +1237,11 @@ async def assign_to_product( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1237,11 +1258,13 @@ async def assign_to_product( deserialized = self._deserialize("TagContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - assign_to_product.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}"} # 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 @@ -1249,7 +1272,8 @@ async def detach_from_product( # pylint: disable=inconsistent-return-statements ) -> None: """Detach the tag from the Product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1275,10 +1299,8 @@ async def detach_from_product( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -1292,10 +1314,11 @@ async def detach_from_product( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1308,7 +1331,9 @@ async def detach_from_product( # pylint: disable=inconsistent-return-statements 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}"} # type: ignore + detach_from_product.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}" + } @distributed_trace def list_by_service( @@ -1323,7 +1348,8 @@ def list_by_service( ) -> AsyncIterable["_models.TagContract"]: """Lists a collection of tags defined within a service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1347,10 +1373,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TagCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1377,7 +1401,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1393,7 +1417,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1401,14 +1425,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TagCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1421,13 +1446,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1450,10 +1478,8 @@ async def get_entity_state(self, resource_group_name: str, service_name: str, ta _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -1466,10 +1492,11 @@ async def get_entity_state(self, resource_group_name: str, service_name: str, ta params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1486,13 +1513,16 @@ async def get_entity_state(self, resource_group_name: str, service_name: str, ta return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_state.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1515,10 +1545,8 @@ async def get(self, resource_group_name: str, service_name: str, tag_id: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagContract] + 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( resource_group_name=resource_group_name, @@ -1531,10 +1559,11 @@ async def get(self, resource_group_name: str, service_name: str, tag_id: str, ** params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1554,7 +1583,9 @@ async def get(self, resource_group_name: str, service_name: str, tag_id: str, ** return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}" + } @overload async def create_or_update( @@ -1570,7 +1601,8 @@ async def create_or_update( ) -> _models.TagContract: """Creates a tag. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1605,7 +1637,8 @@ async def create_or_update( ) -> _models.TagContract: """Creates a tag. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1638,14 +1671,16 @@ async def create_or_update( ) -> _models.TagContract: """Creates a tag. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a TagCreateUpdateParameters type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -1669,11 +1704,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TagContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1698,10 +1731,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1723,11 +1757,13 @@ async def create_or_update( deserialized = self._deserialize("TagContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}" + } @overload async def update( @@ -1743,7 +1779,8 @@ async def update( ) -> _models.TagContract: """Updates the details of the tag specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1778,7 +1815,8 @@ async def update( ) -> _models.TagContract: """Updates the details of the tag specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1811,7 +1849,8 @@ async def update( ) -> _models.TagContract: """Updates the details of the tag specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1821,7 +1860,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -1842,11 +1882,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TagContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1871,10 +1909,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1894,7 +1933,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -1902,7 +1943,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific tag of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1928,10 +1970,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1945,10 +1985,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1961,4 +2002,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}" + } 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 0360ba29b131..0fa9c526753e 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ...operations._tag_resource_operations import build_list_by_service_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +65,8 @@ def list_by_service( ) -> AsyncIterable["_models.TagResourceContract"]: """Lists a collection of resources associated with tags. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -103,10 +99,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagResourceCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TagResourceCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -132,7 +126,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -148,7 +142,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -156,14 +150,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TagResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,4 +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}/tagResources"} # type: ignore + 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 74d4f9ac9951..286de8a226a2 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -32,10 +31,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +60,8 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme ) -> None: """Regenerate primary access key for GIT. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -88,10 +84,8 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -104,10 +98,11 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -120,7 +115,9 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme 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"} # type: ignore + regenerate_primary_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regeneratePrimaryKey" + } @distributed_trace_async async def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements @@ -128,7 +125,8 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state ) -> None: """Regenerate secondary access key for GIT. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -151,10 +149,8 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -167,10 +163,11 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,4 +180,6 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state 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"} # type: ignore + regenerate_secondary_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regenerateSecondaryKey" + } 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 69a8b8b3f030..1928a8a90621 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -41,10 +40,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +69,8 @@ def list_by_service( ) -> AsyncIterable["_models.AccessInformationContract"]: """Returns list of access infos - for Git and Management endpoints. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -90,10 +86,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessInformationCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AccessInformationCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -117,7 +111,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -133,7 +127,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -141,14 +135,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessInformationCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -161,7 +156,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant" + } @distributed_trace_async async def get_entity_tag( @@ -169,7 +166,8 @@ async def get_entity_tag( ) -> bool: """Tenant access metadata. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -192,10 +190,8 @@ async def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -208,10 +204,11 @@ async def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -228,7 +225,9 @@ async def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}" + } @distributed_trace_async async def get( @@ -236,7 +235,8 @@ async def get( ) -> _models.AccessInformationContract: """Get tenant access information details without secrets. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -259,10 +259,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessInformationContract] + 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( resource_group_name=resource_group_name, @@ -275,10 +273,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -298,7 +297,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}" + } @overload async def create( @@ -314,7 +315,8 @@ async def create( ) -> _models.AccessInformationContract: """Update tenant access information details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -349,7 +351,8 @@ async def create( ) -> _models.AccessInformationContract: """Update tenant access information details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -382,7 +385,8 @@ async def create( ) -> _models.AccessInformationContract: """Update tenant access information details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -393,7 +397,7 @@ 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 - model type or a IO type. Required. + 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. @@ -414,11 +418,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessInformationContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessInformationContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -443,10 +445,11 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -466,7 +469,9 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}" + } @overload async def update( @@ -482,7 +487,8 @@ async def update( ) -> _models.AccessInformationContract: """Update tenant access information details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -517,7 +523,8 @@ async def update( ) -> _models.AccessInformationContract: """Update tenant access information details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -550,7 +557,8 @@ async def update( ) -> _models.AccessInformationContract: """Update tenant access information details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -561,7 +569,7 @@ 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 - model type or a IO type. Required. + 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. @@ -582,11 +590,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessInformationContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessInformationContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -611,10 +617,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -634,7 +641,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}" + } @distributed_trace_async async def regenerate_primary_key( # pylint: disable=inconsistent-return-statements @@ -642,7 +651,8 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme ) -> None: """Regenerate primary access key. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -665,10 +675,8 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -681,10 +689,11 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -697,7 +706,9 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme if cls: return cls(pipeline_response, None, {}) - regenerate_primary_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regeneratePrimaryKey"} # type: ignore + regenerate_primary_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regeneratePrimaryKey" + } @distributed_trace_async async def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements @@ -705,7 +716,8 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state ) -> None: """Regenerate secondary access key. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -728,10 +740,8 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -744,10 +754,11 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -760,7 +771,9 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state if cls: return cls(pipeline_response, None, {}) - regenerate_secondary_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regenerateSecondaryKey"} # type: ignore + regenerate_secondary_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regenerateSecondaryKey" + } @distributed_trace_async async def list_secrets( @@ -768,7 +781,8 @@ async def list_secrets( ) -> _models.AccessInformationSecretsContract: """Get tenant access information details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -791,10 +805,8 @@ async def list_secrets( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessInformationSecretsContract] + 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( resource_group_name=resource_group_name, @@ -807,10 +819,11 @@ async def list_secrets( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -830,4 +843,6 @@ async def list_secrets( return deserialized - list_secrets.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/listSecrets"} # type: ignore + list_secrets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/listSecrets" + } 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 627b32edde58..b0d43e415e6d 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -36,10 +35,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,11 +77,9 @@ async def _deploy_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.OperationResultContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.OperationResultContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -110,10 +103,11 @@ async def _deploy_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,7 +126,9 @@ async def _deploy_initial( return deserialized - _deploy_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy"} # type: ignore + _deploy_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy" + } @overload async def begin_deploy( @@ -148,7 +144,12 @@ async def begin_deploy( """This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-configuration-repository-git/#to-deploy-any-service-configuration-changes-to-the-api-management-service-instance + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -189,7 +190,12 @@ async def begin_deploy( """This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-configuration-repository-git/#to-deploy-any-service-configuration-changes-to-the-api-management-service-instance + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -228,15 +234,20 @@ async def begin_deploy( """This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-configuration-repository-git/#to-deploy-any-service-configuration-changes-to-the-api-management-service-instance + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :param configuration_name: The identifier of the Git Configuration Operation. "configuration" Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName - :param parameters: Deploy Configuration parameters. Is either a model type or a IO type. - Required. + :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. @@ -258,16 +269,14 @@ async def begin_deploy( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationResultContract] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationResultContract] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._deploy_initial( # type: ignore + raw_result = await self._deploy_initial( resource_group_name=resource_group_name, service_name=service_name, configuration_name=configuration_name, @@ -288,9 +297,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -302,9 +311,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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"} # type: ignore + begin_deploy.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy" + } async def _save_initial( self, @@ -325,11 +336,9 @@ async def _save_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.OperationResultContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.OperationResultContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -353,10 +362,11 @@ async def _save_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,7 +385,9 @@ async def _save_initial( return deserialized - _save_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save"} # type: ignore + _save_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save" + } @overload async def begin_save( @@ -391,7 +403,12 @@ async def begin_save( """This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-configuration-repository-git/#to-save-the-service-configuration-to-the-git-repository + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -432,7 +449,12 @@ async def begin_save( """This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-configuration-repository-git/#to-save-the-service-configuration-to-the-git-repository + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -471,15 +493,20 @@ async def begin_save( """This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-configuration-repository-git/#to-save-the-service-configuration-to-the-git-repository + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :param configuration_name: The identifier of the Git Configuration Operation. "configuration" Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName - :param parameters: Save Configuration parameters. Is either a model type or a IO type. - Required. + :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. @@ -501,16 +528,14 @@ async def begin_save( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationResultContract] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationResultContract] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._save_initial( # type: ignore + raw_result = await self._save_initial( resource_group_name=resource_group_name, service_name=service_name, configuration_name=configuration_name, @@ -531,9 +556,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -545,9 +570,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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"} # type: ignore + begin_save.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save" + } async def _validate_initial( self, @@ -568,11 +595,9 @@ async def _validate_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.OperationResultContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.OperationResultContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -596,10 +621,11 @@ async def _validate_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -618,7 +644,9 @@ async def _validate_initial( return deserialized - _validate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate"} # type: ignore + _validate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate" + } @overload async def begin_validate( @@ -634,7 +662,8 @@ async def begin_validate( """This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -675,7 +704,8 @@ async def begin_validate( """This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -714,15 +744,16 @@ async def begin_validate( """This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :param configuration_name: The identifier of the Git Configuration Operation. "configuration" Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName - :param parameters: Validate Configuration parameters. Is either a model type or a IO type. - Required. + :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. @@ -744,16 +775,14 @@ async def begin_validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationResultContract] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationResultContract] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._validate_initial( # type: ignore + raw_result = await self._validate_initial( resource_group_name=resource_group_name, service_name=service_name, configuration_name=configuration_name, @@ -774,9 +803,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -788,9 +817,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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"} # type: ignore + begin_validate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate" + } @distributed_trace_async async def get_sync_state( @@ -803,7 +834,8 @@ async def get_sync_state( """Gets the status of the most recent synchronization between the configuration database and the Git repository. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -826,10 +858,8 @@ async def get_sync_state( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TenantConfigurationSyncStateContract] + 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( resource_group_name=resource_group_name, @@ -842,10 +872,11 @@ async def get_sync_state( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -862,4 +893,6 @@ async def get_sync_state( return deserialized - get_sync_state.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/syncState"} # type: ignore + get_sync_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/syncState" + } 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 627b7e2469c2..de89967d556d 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union import urllib.parse @@ -32,10 +31,6 @@ from ...operations._tenant_settings_operations import build_get_request, build_list_by_service_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +60,8 @@ def list_by_service( ) -> AsyncIterable["_models.TenantSettingsContract"]: """Public settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -81,10 +77,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TenantSettingsCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TenantSettingsCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -108,7 +102,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -124,7 +118,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -132,14 +126,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TenantSettingsCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -152,7 +147,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings" + } @distributed_trace_async async def get( @@ -164,7 +161,8 @@ async def get( ) -> _models.TenantSettingsContract: """Get tenant settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -186,10 +184,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TenantSettingsContract] + 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( resource_group_name=resource_group_name, @@ -202,10 +198,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -225,4 +222,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings/{settingsType}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings/{settingsType}" + } 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 798a18da52f9..0efaf1bfe432 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._user_confirmation_password_operations import build_send_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,7 +62,8 @@ async def send( # pylint: disable=inconsistent-return-statements ) -> None: """Sends confirmation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -94,10 +90,8 @@ async def send( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -111,10 +105,11 @@ async def send( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -127,4 +122,6 @@ async def send( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - send.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/confirmations/password/send"} # type: ignore + send.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/confirmations/password/send" + } 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 5538e06a6076..1f66a3e7a06a 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ...operations._user_group_operations import build_list_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +66,8 @@ def list( ) -> AsyncIterable["_models.GroupContract"]: """Lists all user groups. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -98,10 +94,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GroupCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -128,7 +122,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -144,7 +138,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -152,14 +146,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("GroupCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -172,4 +167,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}/groups"} # type: ignore + 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 034fc7b7eeb6..e06a94fc4f9e 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ...operations._user_identities_operations import build_list_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +59,8 @@ def list( ) -> AsyncIterable["_models.UserIdentityContract"]: """List of all user identities. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -81,10 +77,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserIdentityCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UserIdentityCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -108,7 +102,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -124,7 +118,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -132,14 +126,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("UserIdentityCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -152,4 +147,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}/identities"} # type: ignore + 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 f71815293414..570db6af5ad3 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -41,10 +40,6 @@ ) from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +76,8 @@ def list_by_service( ) -> AsyncIterable["_models.UserContract"]: """Lists a collection of registered users in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -109,10 +105,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UserCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -139,7 +133,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -155,7 +149,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -163,14 +157,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("UserCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,13 +178,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -212,10 +210,8 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, user _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -228,10 +224,11 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, user params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -248,7 +245,9 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, user return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" + } @distributed_trace_async async def get( @@ -256,7 +255,8 @@ async def get( ) -> _models.UserContract: """Gets the details of the user specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -279,10 +279,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserContract] + 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( resource_group_name=resource_group_name, @@ -295,10 +293,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -318,7 +317,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" + } @overload async def create_or_update( @@ -335,7 +336,8 @@ async def create_or_update( ) -> _models.UserContract: """Creates or Updates a user. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -373,7 +375,8 @@ async def create_or_update( ) -> _models.UserContract: """Creates or Updates a user. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -409,14 +412,16 @@ async def create_or_update( ) -> _models.UserContract: """Creates or Updates a user. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :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 notify: Send an Email notification to the User. Default value is None. :type notify: bool @@ -442,11 +447,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.UserContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -472,10 +475,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -497,11 +501,13 @@ async def create_or_update( deserialized = self._deserialize("UserContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" + } @overload async def update( @@ -517,7 +523,8 @@ async def update( ) -> _models.UserContract: """Updates the details of the user specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -552,7 +559,8 @@ async def update( ) -> _models.UserContract: """Updates the details of the user specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -585,7 +593,8 @@ async def update( ) -> _models.UserContract: """Updates the details of the user specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -595,7 +604,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -616,11 +626,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.UserContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -645,10 +653,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -668,7 +677,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -684,7 +695,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific user. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -719,10 +731,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -739,10 +749,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -755,7 +766,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" + } @distributed_trace_async async def generate_sso_url( @@ -764,7 +777,8 @@ async def generate_sso_url( """Retrieves a redirection URL containing an authentication token for signing a given user into the developer portal. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -787,10 +801,8 @@ async def generate_sso_url( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GenerateSsoUrlResult] + 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( resource_group_name=resource_group_name, @@ -803,10 +815,11 @@ async def generate_sso_url( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -823,7 +836,9 @@ async def generate_sso_url( return deserialized - generate_sso_url.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/generateSsoUrl"} # type: ignore + generate_sso_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/generateSsoUrl" + } @overload async def get_shared_access_token( @@ -838,7 +853,8 @@ async def get_shared_access_token( ) -> _models.UserTokenResult: """Gets the Shared Access Authorization Token for the User. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -869,7 +885,8 @@ async def get_shared_access_token( ) -> _models.UserTokenResult: """Gets the Shared Access Authorization Token for the User. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -898,15 +915,16 @@ async def get_shared_access_token( ) -> _models.UserTokenResult: """Gets the Shared Access Authorization Token for the User. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :param parameters: Create Authorization Token parameters. Is either a model type or a IO type. - Required. + :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. @@ -927,11 +945,9 @@ async def get_shared_access_token( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserTokenResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.UserTokenResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -955,10 +971,11 @@ async def get_shared_access_token( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -975,4 +992,6 @@ async def get_shared_access_token( return deserialized - get_shared_access_token.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/token"} # type: ignore + get_shared_access_token.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/token" + } 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 a65a3504e151..d421a1a8ff33 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -32,10 +31,6 @@ from ...operations._user_subscription_operations import build_get_request, build_list_request from .._vendor import ApiManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +67,8 @@ def list( ) -> AsyncIterable["_models.SubscriptionContract"]: """Lists the collection of subscriptions of the specified user. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -104,10 +100,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SubscriptionCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -134,7 +128,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -150,7 +144,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -158,14 +152,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SubscriptionCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -178,7 +173,9 @@ 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"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions" + } @distributed_trace_async async def get( @@ -186,7 +183,8 @@ async def get( ) -> _models.SubscriptionContract: """Gets the specified Subscription entity associated with a particular user. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -212,10 +210,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionContract] + 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( resource_group_name=resource_group_name, @@ -229,10 +225,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -252,4 +249,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions/{sid}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions/{sid}" + } diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/__init__.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/__init__.py index 1b2f6163a239..9ff039a1fa83 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/__init__.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/__init__.py @@ -66,6 +66,18 @@ from ._models_py3 import ArmIdWrapper from ._models_py3 import AssociationContract from ._models_py3 import AuthenticationSettingsContract +from ._models_py3 import AuthorizationAccessPolicyCollection +from ._models_py3 import AuthorizationAccessPolicyContract +from ._models_py3 import AuthorizationCollection +from ._models_py3 import AuthorizationConfirmConsentCodeRequestContract +from ._models_py3 import AuthorizationContract +from ._models_py3 import AuthorizationError +from ._models_py3 import AuthorizationLoginRequestContract +from ._models_py3 import AuthorizationLoginResponseContract +from ._models_py3 import AuthorizationProviderCollection +from ._models_py3 import AuthorizationProviderContract +from ._models_py3 import AuthorizationProviderOAuth2GrantTypes +from ._models_py3 import AuthorizationProviderOAuth2Settings from ._models_py3 import AuthorizationServerCollection from ._models_py3 import AuthorizationServerContract from ._models_py3 import AuthorizationServerContractBaseProperties @@ -75,6 +87,7 @@ from ._models_py3 import AuthorizationServerUpdateContractProperties from ._models_py3 import BackendAuthorizationHeaderCredentials from ._models_py3 import BackendBaseParameters +from ._models_py3 import BackendCircuitBreaker from ._models_py3 import BackendCollection from ._models_py3 import BackendContract from ._models_py3 import BackendContractProperties @@ -95,6 +108,8 @@ from ._models_py3 import CertificateContract from ._models_py3 import CertificateCreateOrUpdateParameters from ._models_py3 import CertificateInformation +from ._models_py3 import CircuitBreakerFailureCondition +from ._models_py3 import CircuitBreakerRule from ._models_py3 import ClientSecretContract from ._models_py3 import ConnectivityCheckRequest from ._models_py3 import ConnectivityCheckRequestDestination @@ -116,6 +131,9 @@ from ._models_py3 import DeployConfigurationParameters from ._models_py3 import DiagnosticCollection from ._models_py3 import DiagnosticContract +from ._models_py3 import DocumentationCollection +from ._models_py3 import DocumentationContract +from ._models_py3 import DocumentationUpdateContract from ._models_py3 import EmailTemplateCollection from ._models_py3 import EmailTemplateContract from ._models_py3 import EmailTemplateParametersContractProperties @@ -125,6 +143,7 @@ from ._models_py3 import ErrorFieldContract from ._models_py3 import ErrorResponse from ._models_py3 import ErrorResponseBody +from ._models_py3 import FailureStatusCodeRange from ._models_py3 import GatewayCertificateAuthorityCollection from ._models_py3 import GatewayCertificateAuthorityContract from ._models_py3 import GatewayCollection @@ -209,6 +228,16 @@ from ._models_py3 import PolicyContract from ._models_py3 import PolicyDescriptionCollection from ._models_py3 import PolicyDescriptionContract +from ._models_py3 import PolicyFragmentCollection +from ._models_py3 import PolicyFragmentContract +from ._models_py3 import PortalConfigCollection +from ._models_py3 import PortalConfigContract +from ._models_py3 import PortalConfigCorsProperties +from ._models_py3 import PortalConfigCspProperties +from ._models_py3 import PortalConfigDelegationProperties +from ._models_py3 import PortalConfigPropertiesSignin +from ._models_py3 import PortalConfigPropertiesSignup +from ._models_py3 import PortalConfigTermsOfServiceProperties from ._models_py3 import PortalDelegationSettings from ._models_py3 import PortalRevisionCollection from ._models_py3 import PortalRevisionContract @@ -232,6 +261,7 @@ from ._models_py3 import ProductTagResourceContractProperties from ._models_py3 import ProductUpdateParameters from ._models_py3 import ProductUpdateProperties +from ._models_py3 import ProxyResource from ._models_py3 import QuotaCounterCollection from ._models_py3 import QuotaCounterContract from ._models_py3 import QuotaCounterValueContract @@ -252,7 +282,14 @@ from ._models_py3 import RequestContract from ._models_py3 import RequestReportCollection from ._models_py3 import RequestReportRecordContract +from ._models_py3 import ResolverCollection +from ._models_py3 import ResolverContract +from ._models_py3 import ResolverResultContract +from ._models_py3 import ResolverResultLogItemContract +from ._models_py3 import ResolverUpdateContract from ._models_py3 import Resource +from ._models_py3 import ResourceCollection +from ._models_py3 import ResourceCollectionValueItem from ._models_py3 import ResourceLocationDataContract from ._models_py3 import ResourceSku from ._models_py3 import ResourceSkuCapacity @@ -301,6 +338,10 @@ from ._models_py3 import UserUpdateParameters from ._models_py3 import UserUpdateParametersProperties from ._models_py3 import VirtualNetworkConfiguration +from ._models_py3 import WikiCollection +from ._models_py3 import WikiContract +from ._models_py3 import WikiDocumentationContract +from ._models_py3 import WikiUpdateContract from ._models_py3 import X509CertificateName from ._api_management_client_enums import AccessIdName @@ -310,11 +351,12 @@ from ._api_management_client_enums import ApiManagementSkuRestrictionsReasonCode from ._api_management_client_enums import ApiManagementSkuRestrictionsType from ._api_management_client_enums import ApiType -from ._api_management_client_enums import ApiVersionSetContractDetailsVersioningScheme from ._api_management_client_enums import ApimIdentityType from ._api_management_client_enums import AppType from ._api_management_client_enums import AsyncOperationStatus +from ._api_management_client_enums import AsyncResolverStatus from ._api_management_client_enums import AuthorizationMethod +from ._api_management_client_enums import AuthorizationType from ._api_management_client_enums import BackendProtocol from ._api_management_client_enums import BearerTokenSendingMethod from ._api_management_client_enums import BearerTokenSendingMethods @@ -343,15 +385,19 @@ from ._api_management_client_enums import LoggerType from ._api_management_client_enums import Method from ._api_management_client_enums import NameAvailabilityReason +from ._api_management_client_enums import NatGatewayState from ._api_management_client_enums import NotificationName +from ._api_management_client_enums import OAuth2GrantType from ._api_management_client_enums import OperationNameFormat from ._api_management_client_enums import Origin from ._api_management_client_enums import PlatformVersion from ._api_management_client_enums import PolicyContentFormat from ._api_management_client_enums import PolicyExportFormat +from ._api_management_client_enums import PolicyFragmentContentFormat from ._api_management_client_enums import PolicyIdName from ._api_management_client_enums import PolicyScopeContract from ._api_management_client_enums import PortalRevisionStatus +from ._api_management_client_enums import PortalSettingsCspMode from ._api_management_client_enums import PreferredIPVersion from ._api_management_client_enums import PrivateEndpointConnectionProvisioningState from ._api_management_client_enums import PrivateEndpointServiceConnectionStatus @@ -368,12 +414,13 @@ from ._api_management_client_enums import State from ._api_management_client_enums import SubscriptionState from ._api_management_client_enums import TemplateName +from ._api_management_client_enums import TranslateRequiredQueryParametersConduct from ._api_management_client_enums import UserState from ._api_management_client_enums import Verbosity from ._api_management_client_enums import VersioningScheme from ._api_management_client_enums import VirtualNetworkType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -437,6 +484,18 @@ "ArmIdWrapper", "AssociationContract", "AuthenticationSettingsContract", + "AuthorizationAccessPolicyCollection", + "AuthorizationAccessPolicyContract", + "AuthorizationCollection", + "AuthorizationConfirmConsentCodeRequestContract", + "AuthorizationContract", + "AuthorizationError", + "AuthorizationLoginRequestContract", + "AuthorizationLoginResponseContract", + "AuthorizationProviderCollection", + "AuthorizationProviderContract", + "AuthorizationProviderOAuth2GrantTypes", + "AuthorizationProviderOAuth2Settings", "AuthorizationServerCollection", "AuthorizationServerContract", "AuthorizationServerContractBaseProperties", @@ -446,6 +505,7 @@ "AuthorizationServerUpdateContractProperties", "BackendAuthorizationHeaderCredentials", "BackendBaseParameters", + "BackendCircuitBreaker", "BackendCollection", "BackendContract", "BackendContractProperties", @@ -466,6 +526,8 @@ "CertificateContract", "CertificateCreateOrUpdateParameters", "CertificateInformation", + "CircuitBreakerFailureCondition", + "CircuitBreakerRule", "ClientSecretContract", "ConnectivityCheckRequest", "ConnectivityCheckRequestDestination", @@ -487,6 +549,9 @@ "DeployConfigurationParameters", "DiagnosticCollection", "DiagnosticContract", + "DocumentationCollection", + "DocumentationContract", + "DocumentationUpdateContract", "EmailTemplateCollection", "EmailTemplateContract", "EmailTemplateParametersContractProperties", @@ -496,6 +561,7 @@ "ErrorFieldContract", "ErrorResponse", "ErrorResponseBody", + "FailureStatusCodeRange", "GatewayCertificateAuthorityCollection", "GatewayCertificateAuthorityContract", "GatewayCollection", @@ -580,6 +646,16 @@ "PolicyContract", "PolicyDescriptionCollection", "PolicyDescriptionContract", + "PolicyFragmentCollection", + "PolicyFragmentContract", + "PortalConfigCollection", + "PortalConfigContract", + "PortalConfigCorsProperties", + "PortalConfigCspProperties", + "PortalConfigDelegationProperties", + "PortalConfigPropertiesSignin", + "PortalConfigPropertiesSignup", + "PortalConfigTermsOfServiceProperties", "PortalDelegationSettings", "PortalRevisionCollection", "PortalRevisionContract", @@ -603,6 +679,7 @@ "ProductTagResourceContractProperties", "ProductUpdateParameters", "ProductUpdateProperties", + "ProxyResource", "QuotaCounterCollection", "QuotaCounterContract", "QuotaCounterValueContract", @@ -623,7 +700,14 @@ "RequestContract", "RequestReportCollection", "RequestReportRecordContract", + "ResolverCollection", + "ResolverContract", + "ResolverResultContract", + "ResolverResultLogItemContract", + "ResolverUpdateContract", "Resource", + "ResourceCollection", + "ResourceCollectionValueItem", "ResourceLocationDataContract", "ResourceSku", "ResourceSkuCapacity", @@ -672,6 +756,10 @@ "UserUpdateParameters", "UserUpdateParametersProperties", "VirtualNetworkConfiguration", + "WikiCollection", + "WikiContract", + "WikiDocumentationContract", + "WikiUpdateContract", "X509CertificateName", "AccessIdName", "AccessType", @@ -680,11 +768,12 @@ "ApiManagementSkuRestrictionsReasonCode", "ApiManagementSkuRestrictionsType", "ApiType", - "ApiVersionSetContractDetailsVersioningScheme", "ApimIdentityType", "AppType", "AsyncOperationStatus", + "AsyncResolverStatus", "AuthorizationMethod", + "AuthorizationType", "BackendProtocol", "BearerTokenSendingMethod", "BearerTokenSendingMethods", @@ -713,15 +802,19 @@ "LoggerType", "Method", "NameAvailabilityReason", + "NatGatewayState", "NotificationName", + "OAuth2GrantType", "OperationNameFormat", "Origin", "PlatformVersion", "PolicyContentFormat", "PolicyExportFormat", + "PolicyFragmentContentFormat", "PolicyIdName", "PolicyScopeContract", "PortalRevisionStatus", + "PortalSettingsCspMode", "PreferredIPVersion", "PrivateEndpointConnectionProvisioningState", "PrivateEndpointServiceConnectionStatus", @@ -738,6 +831,7 @@ "State", "SubscriptionState", "TemplateName", + "TranslateRequiredQueryParametersConduct", "UserState", "Verbosity", "VersioningScheme", 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 2e8ec9b684f4..85270529ff70 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 @@ -20,19 +20,19 @@ class AccessIdName(str, Enum, metaclass=CaseInsensitiveEnumMeta): class AccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of access to be used for the storage account.""" - #: Use access key. ACCESS_KEY = "AccessKey" - #: Use system assigned managed identity. + """Use access key.""" SYSTEM_ASSIGNED_MANAGED_IDENTITY = "SystemAssignedManagedIdentity" - #: Use user assigned managed identity. + """Use system assigned managed identity.""" USER_ASSIGNED_MANAGED_IDENTITY = "UserAssignedManagedIdentity" + """Use user assigned managed identity.""" class AlwaysLog(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies for what type of messages sampling settings should not apply.""" - #: Always log all erroneous request regardless of sampling settings. ALL_ERRORS = "allErrors" + """Always log all erroneous request regardless of sampling settings.""" class ApiManagementSkuCapacityScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -78,21 +78,13 @@ class ApiType(str, Enum, metaclass=CaseInsensitiveEnumMeta): GRAPHQL = "graphql" -class ApiVersionSetContractDetailsVersioningScheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """An value that determines where the API Version identifier will be located in a HTTP request.""" - - SEGMENT = "Segment" - QUERY = "Query" - HEADER = "Header" - - class AppType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AppType.""" - #: User create request was sent by legacy developer portal. PORTAL = "portal" - #: User create request was sent by new developer portal. + """User create request was sent by legacy developer portal.""" DEVELOPER_PORTAL = "developerPortal" + """User create request was sent by new developer portal.""" class AsyncOperationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -104,6 +96,15 @@ class AsyncOperationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): FAILED = "Failed" +class AsyncResolverStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of an async resolver.""" + + STARTED = "Started" + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + + class AuthorizationMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AuthorizationMethod.""" @@ -117,13 +118,20 @@ class AuthorizationMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETE = "DELETE" +class AuthorizationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Authorization type options.""" + + O_AUTH2 = "OAuth2" + """OAuth2 authorization type""" + + class BackendProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Backend communication protocol.""" - #: The Backend is a RESTful service. HTTP = "http" - #: The Backend is a SOAP service. + """The Backend is a RESTful service.""" SOAP = "soap" + """The Backend is a SOAP service.""" class BearerTokenSendingMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -136,10 +144,10 @@ class BearerTokenSendingMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): class BearerTokenSendingMethods(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Form of an authorization grant, which the client uses to request the access token.""" - #: Access token will be transmitted in the Authorization header using Bearer schema AUTHORIZATION_HEADER = "authorizationHeader" - #: Access token will be transmitted as query parameters. + """Access token will be transmitted in the Authorization header using Bearer schema""" QUERY = "query" + """Access token will be transmitted as query parameters.""" class CertificateConfigurationStoreName(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -171,10 +179,10 @@ class CertificateStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ClientAuthenticationMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ClientAuthenticationMethod.""" - #: Basic Client Authentication method. BASIC = "Basic" - #: Body based Authentication method. + """Basic Client Authentication method.""" BODY = "Body" + """Body based Authentication method.""" class ConfigurationIdName(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -186,10 +194,10 @@ class ConfigurationIdName(str, Enum, metaclass=CaseInsensitiveEnumMeta): class Confirmation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the type of confirmation e-mail that will be sent to the newly created user.""" - #: Send an e-mail to the user confirming they have successfully signed up. SIGNUP = "signup" - #: Send an e-mail inviting the user to sign-up and complete registration. + """Send an e-mail to the user confirming they have successfully signed up.""" INVITE = "invite" + """Send an e-mail inviting the user to sign-up and complete registration.""" class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -222,28 +230,28 @@ class ConnectivityStatusType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ContentFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Format of the Content in which the API is getting imported.""" - #: The contents are inline and Content type is a WADL document. WADL_XML = "wadl-xml" - #: The WADL document is hosted on a publicly accessible internet address. + """The contents are inline and Content type is a WADL document.""" WADL_LINK_JSON = "wadl-link-json" - #: The contents are inline and Content Type is a OpenAPI 2.0 JSON Document. + """The WADL document is hosted on a publicly accessible internet address.""" SWAGGER_JSON = "swagger-json" - #: The OpenAPI 2.0 JSON document is hosted on a publicly accessible internet address. + """The contents are inline and Content Type is a OpenAPI 2.0 JSON Document.""" SWAGGER_LINK_JSON = "swagger-link-json" - #: The contents are inline and the document is a WSDL/Soap document. + """The OpenAPI 2.0 JSON document is hosted on a publicly accessible internet address.""" WSDL = "wsdl" - #: The WSDL document is hosted on a publicly accessible internet address. + """The contents are inline and the document is a WSDL/Soap document.""" WSDL_LINK = "wsdl-link" - #: The contents are inline and Content Type is a OpenAPI 3.0 YAML Document. + """The WSDL document is hosted on a publicly accessible internet address.""" OPENAPI = "openapi" - #: The contents are inline and Content Type is a OpenAPI 3.0 JSON Document. + """The contents are inline and Content Type is a OpenAPI 3.0 YAML Document.""" OPENAPI_JSON = "openapi+json" - #: The OpenAPI 3.0 YAML document is hosted on a publicly accessible internet address. + """The contents are inline and Content Type is a OpenAPI 3.0 JSON Document.""" OPENAPI_LINK = "openapi-link" - #: The OpenAPI 3.0 JSON document is hosted on a publicly accessible internet address. + """The OpenAPI 3.0 YAML document is hosted on a publicly accessible internet address.""" OPENAPI_JSON_LINK = "openapi+json-link" - #: The GraphQL API endpoint hosted on a publicly accessible internet address. + """The OpenAPI 3.0 JSON document is hosted on a publicly accessible internet address.""" GRAPHQL_LINK = "graphql-link" + """The GraphQL API endpoint hosted on a publicly accessible internet address.""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -258,10 +266,10 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class DataMaskingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Data masking mode.""" - #: Mask the value of an entity. MASK = "Mask" - #: Hide the presence of an entity. + """Mask the value of an entity.""" HIDE = "Hide" + """Hide the presence of an entity.""" class ExportApi(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -273,17 +281,17 @@ class ExportApi(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ExportFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ExportFormat.""" - #: Export the Api Definition in OpenAPI 2.0 Specification as JSON document to the Storage Blob. SWAGGER = "swagger-link" - #: Export the Api Definition in WSDL Schema to Storage Blob. This is only supported for APIs of - #: Type ``soap`` + """Export the Api Definition in OpenAPI 2.0 Specification as JSON document to the Storage Blob.""" WSDL = "wsdl-link" - #: Export the Api Definition in WADL Schema to Storage Blob. + """Export the Api Definition in WSDL Schema to Storage Blob. This is only supported for APIs of + #: Type ``soap``""" WADL = "wadl-link" - #: Export the Api Definition in OpenAPI 3.0 Specification as YAML document to Storage Blob. + """Export the Api Definition in WADL Schema to Storage Blob.""" OPENAPI = "openapi-link" - #: Export the Api Definition in OpenAPI 3.0 Specification as JSON document to Storage Blob. + """Export the Api Definition in OpenAPI 3.0 Specification as YAML document to Storage Blob.""" OPENAPI_JSON = "openapi+json-link" + """Export the Api Definition in OpenAPI 3.0 Specification as JSON document to Storage Blob.""" class ExportResultFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -291,29 +299,29 @@ class ExportResultFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): minutes. """ - #: The API Definition is exported in OpenAPI Specification 2.0 format to the Storage Blob. SWAGGER = "swagger-link-json" - #: The API Definition is exported in WSDL Schema to Storage Blob. This is only supported for APIs - #: of Type ``soap`` + """The API Definition is exported in OpenAPI Specification 2.0 format to the Storage Blob.""" WSDL = "wsdl-link+xml" - #: Export the API Definition in WADL Schema to Storage Blob. + """The API Definition is exported in WSDL Schema to Storage Blob. This is only supported for APIs + #: of Type ``soap``""" WADL = "wadl-link-json" - #: Export the API Definition in OpenAPI Specification 3.0 to Storage Blob. + """Export the API Definition in WADL Schema to Storage Blob.""" OPEN_API = "openapi-link" + """Export the API Definition in OpenAPI Specification 3.0 to Storage Blob.""" class GrantType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GrantType.""" - #: Authorization Code Grant flow as described https://tools.ietf.org/html/rfc6749#section-4.1. AUTHORIZATION_CODE = "authorizationCode" - #: Implicit Code Grant flow as described https://tools.ietf.org/html/rfc6749#section-4.2. + """Authorization Code Grant flow as described https://tools.ietf.org/html/rfc6749#section-4.1.""" IMPLICIT = "implicit" - #: Resource Owner Password Grant flow as described - #: https://tools.ietf.org/html/rfc6749#section-4.3. + """Implicit Code Grant flow as described https://tools.ietf.org/html/rfc6749#section-4.2.""" RESOURCE_OWNER_PASSWORD = "resourceOwnerPassword" - #: Client Credentials Grant flow as described https://tools.ietf.org/html/rfc6749#section-4.4. + """Resource Owner Password Grant flow as described + #: 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.""" class GroupType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -337,30 +345,30 @@ class HostnameType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class HttpCorrelationProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Sets correlation protocol to use for Application Insights diagnostics.""" - #: Do not read and inject correlation headers. NONE = "None" - #: 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. + """Do not read and inject correlation headers.""" LEGACY = "Legacy" - #: Inject Trace Context headers. See https://w3c.github.io/trace-context. + """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.""" W3_C = "W3C" + """Inject Trace Context headers. See https://w3c.github.io/trace-context.""" class IdentityProviderType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """IdentityProviderType.""" - #: Facebook as Identity provider. FACEBOOK = "facebook" - #: Google as Identity provider. + """Facebook as Identity provider.""" GOOGLE = "google" - #: Microsoft Live as Identity provider. + """Google as Identity provider.""" MICROSOFT = "microsoft" - #: Twitter as Identity provider. + """Microsoft Live as Identity provider.""" TWITTER = "twitter" - #: Azure Active Directory as Identity provider. + """Twitter as Identity provider.""" AAD = "aad" - #: Azure Active Directory B2C as Identity provider. + """Azure Active Directory as Identity provider.""" AAD_B2_C = "aadB2C" + """Azure Active Directory B2C as Identity provider.""" class IssueType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -387,12 +395,12 @@ class KeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class LoggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Logger type.""" - #: Azure Event Hub as log destination. AZURE_EVENT_HUB = "azureEventHub" - #: Azure Application Insights as log destination. + """Azure Event Hub as log destination.""" APPLICATION_INSIGHTS = "applicationInsights" - #: Azure Monitor + """Azure Application Insights as log destination.""" AZURE_MONITOR = "azureMonitor" + """Azure Monitor""" class Method(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -413,38 +421,56 @@ class NameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALREADY_EXISTS = "AlreadyExists" +class NatGatewayState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Property can be used to enable NAT Gateway for this API Management service.""" + + ENABLED = "Enabled" + """Nat Gateway is enabled for the service.""" + DISABLED = "Disabled" + """Nat Gateway is disabled for the service.""" + + class NotificationName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """NotificationName.""" - #: The following email recipients and users will receive email notifications about subscription - #: requests for API products requiring approval. REQUEST_PUBLISHER_NOTIFICATION_MESSAGE = "RequestPublisherNotificationMessage" - #: The following email recipients and users will receive email notifications about new API product - #: subscriptions. + """The following email recipients and users will receive email notifications about subscription + #: requests for API products requiring approval.""" PURCHASE_PUBLISHER_NOTIFICATION_MESSAGE = "PurchasePublisherNotificationMessage" - #: The following email recipients and users will receive email notifications when new applications - #: are submitted to the application gallery. + """The following email recipients and users will receive email notifications about new API product + #: subscriptions.""" NEW_APPLICATION_NOTIFICATION_MESSAGE = "NewApplicationNotificationMessage" - #: The following recipients will receive blind carbon copies of all emails sent to developers. + """The following email recipients and users will receive email notifications when new applications + #: are submitted to the application gallery.""" BCC = "BCC" - #: The following email recipients and users will receive email notifications when a new issue or - #: comment is submitted on the developer portal. + """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 developer closes - #: his account. + """The following email recipients and users will receive email notifications when a new issue or + #: comment is submitted on the developer portal.""" ACCOUNT_CLOSED_PUBLISHER = "AccountClosedPublisher" - #: The following email recipients and users will receive email notifications when subscription - #: usage gets close to usage quota. + """The following email recipients and users will receive email notifications when developer closes + #: 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.""" + + +class OAuth2GrantType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """OAuth2 grant type options.""" + + AUTHORIZATION_CODE = "AuthorizationCode" + """Authorization Code grant""" + CLIENT_CREDENTIALS = "ClientCredentials" + """Client Credential grant""" class OperationNameFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The format of the Operation Name for Application Insights telemetries. Default is Name.""" - #: API_NAME;rev=API_REVISION - OPERATION_NAME NAME = "Name" - #: HTTP_VERB URL + """API_NAME;rev=API_REVISION - OPERATION_NAME""" URL = "Url" + """HTTP_VERB URL""" class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -458,38 +484,47 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): class PlatformVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Compute Platform Version running the service.""" - #: Platform version cannot be determined, as compute platform is not deployed. UNDETERMINED = "undetermined" - #: Platform running the service on Single Tenant V1 platform. + """Platform version cannot be determined, as compute platform is not deployed.""" STV1 = "stv1" - #: Platform running the service on Single Tenant V2 platform. + """Platform running the service on Single Tenant V1 platform.""" STV2 = "stv2" - #: Platform running the service on Multi Tenant V1 platform. + """Platform running the service on Single Tenant V2 platform.""" MTV1 = "mtv1" + """Platform running the service on Multi Tenant V1 platform.""" class PolicyContentFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Format of the policyContent.""" - #: The contents are inline and Content type is an XML document. XML = "xml" - #: The policy XML document is hosted on a http endpoint accessible from the API Management - #: service. + """The contents are inline and Content type is an XML document.""" XML_LINK = "xml-link" - #: The contents are inline and Content type is a non XML encoded policy document. + """The policy XML document is hosted on a HTTP endpoint accessible from the API Management + #: service.""" RAWXML = "rawxml" - #: The policy document is not Xml encoded and is hosted on a http endpoint accessible from the API - #: Management service. + """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.""" class PolicyExportFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): """PolicyExportFormat.""" - #: The contents are inline and Content type is an XML document. XML = "xml" - #: The contents are inline and Content type is a non XML encoded policy document. + """The contents are inline and Content type is an XML document.""" RAWXML = "rawxml" + """The contents are inline and Content type is a non XML encoded policy document.""" + + +class PolicyFragmentContentFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """PolicyFragmentContentFormat.""" + + XML = "xml" + """The contents are inline and Content type is an XML document.""" + RAWXML = "rawxml" + """The contents are inline and Content type is a non XML encoded policy document.""" class PolicyIdName(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -511,14 +546,25 @@ class PolicyScopeContract(str, Enum, metaclass=CaseInsensitiveEnumMeta): class PortalRevisionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Status of the portal's revision.""" - #: Portal's revision has been queued. PENDING = "pending" - #: Portal's revision is being published. + """Portal's revision has been queued.""" PUBLISHING = "publishing" - #: Portal's revision publishing completed. + """Portal's revision is being published.""" COMPLETED = "completed" - #: Portal's revision publishing failed. + """Portal's revision publishing completed.""" FAILED = "failed" + """Portal's revision publishing failed.""" + + +class PortalSettingsCspMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The mode of the developer portal Content Security Policy (CSP).""" + + ENABLED = "enabled" + """The browser will block requests not matching allowed origins.""" + DISABLED = "disabled" + """The browser will not apply the origin restrictions.""" + REPORT_ONLY = "reportOnly" + """The browser will report requests not matching allowed origins without blocking them.""" class PreferredIPVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -576,28 +622,28 @@ class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ResourceSkuCapacityScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The scale type applicable to the sku.""" - #: Supported scale type automatic. AUTOMATIC = "automatic" - #: Supported scale type manual. + """Supported scale type automatic.""" MANUAL = "manual" - #: Scaling not supported. + """Supported scale type manual.""" NONE = "none" + """Scaling not supported.""" class SamplingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Sampling type.""" - #: Fixed-rate sampling. FIXED = "fixed" + """Fixed-rate sampling.""" class SchemaType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Schema Type. Immutable.""" - #: Xml schema type. XML = "xml" - #: Json schema type. + """XML schema type.""" JSON = "json" + """Json schema type.""" class SettingsTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -616,18 +662,18 @@ class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): class SkuType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Name of the Sku.""" - #: Developer SKU of Api Management. DEVELOPER = "Developer" - #: Standard SKU of Api Management. + """Developer SKU of Api Management.""" STANDARD = "Standard" - #: Premium SKU of Api Management. + """Standard SKU of Api Management.""" PREMIUM = "Premium" - #: Basic SKU of Api Management. + """Premium SKU of Api Management.""" BASIC = "Basic" - #: Consumption SKU of Api Management. + """Basic SKU of Api Management.""" CONSUMPTION = "Consumption" - #: Isolated SKU of Api Management. + """Consumption SKU of Api Management.""" ISOLATED = "Isolated" + """Isolated SKU of Api Management.""" class SoapApiType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -640,29 +686,29 @@ class SoapApiType(str, Enum, metaclass=CaseInsensitiveEnumMeta): * ``graphql`` creates GraphQL API. """ - #: Imports a SOAP API having a RESTful front end. SOAP_TO_REST = "http" - #: Imports the SOAP API having a SOAP front end. + """Imports a SOAP API having a RESTful front end.""" SOAP_PASS_THROUGH = "soap" - #: Imports the API having a Websocket front end. + """Imports the SOAP API having a SOAP front end.""" WEB_SOCKET = "websocket" - #: Imports the API having a GraphQL front end. + """Imports the API having a Websocket front end.""" GRAPH_QL = "graphql" + """Imports the API having a GraphQL front end.""" class State(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Status of the issue.""" - #: The issue is proposed. PROPOSED = "proposed" - #: The issue is opened. + """The issue is proposed.""" OPEN = "open" - #: The issue was removed. + """The issue is opened.""" REMOVED = "removed" - #: The issue is now resolved. + """The issue was removed.""" RESOLVED = "resolved" - #: The issue was closed. + """The issue is now resolved.""" CLOSED = "closed" + """The issue was closed.""" class SubscriptionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -701,44 +747,55 @@ class TemplateName(str, Enum, metaclass=CaseInsensitiveEnumMeta): REQUEST_DEVELOPER_NOTIFICATION_MESSAGE = "requestDeveloperNotificationMessage" +class TranslateRequiredQueryParametersConduct(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Strategy of translating required query parameters to template ones. By default has value + 'template'. Possible values: 'template', 'query'. + """ + + TEMPLATE = "template" + """Translates required query parameters to template ones. Is a default value""" + QUERY = "query" + """Leaves required query parameters as they are (no translation done).""" + + class UserState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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 is Active. """ - #: User state is active. ACTIVE = "active" - #: User is blocked. Blocked users cannot authenticate at developer portal or call API. + """User state is active.""" BLOCKED = "blocked" - #: User account is pending. Requires identity confirmation before it can be made active. + """User is blocked. Blocked users cannot authenticate at developer portal or call API.""" PENDING = "pending" - #: User account is closed. All identities and related entities are removed. + """User account is pending. Requires identity confirmation before it can be made active.""" DELETED = "deleted" + """User account is closed. All identities and related entities are removed.""" class Verbosity(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The verbosity level applied to traces emitted by trace policies.""" - #: All the traces emitted by trace policies will be sent to the logger attached to this diagnostic - #: instance. VERBOSE = "verbose" - #: Traces with 'severity' set to 'information' and 'error' will be sent to the logger attached to - #: this diagnostic instance. + """All the traces emitted by trace policies will be sent to the logger attached to this diagnostic + #: instance.""" INFORMATION = "information" - #: Only traces with 'severity' set to 'error' will be sent to the logger attached to this - #: diagnostic instance. + """Traces with 'severity' set to 'information' and 'error' will be sent to the logger attached to + #: this diagnostic instance.""" ERROR = "error" + """Only traces with 'severity' set to 'error' will be sent to the logger attached to this + #: diagnostic instance.""" class VersioningScheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): """An value that determines where the API Version identifier will be located in a HTTP request.""" - #: The API Version is passed in a path segment. SEGMENT = "Segment" - #: The API Version is passed in a query parameter. + """The API Version is passed in a path segment.""" QUERY = "Query" - #: The API Version is passed in a HTTP header. + """The API Version is passed in a query parameter.""" HEADER = "Header" + """The API Version is passed in a HTTP header.""" class VirtualNetworkType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -749,10 +806,10 @@ class VirtualNetworkType(str, Enum, metaclass=CaseInsensitiveEnumMeta): Intranet Facing Endpoint only. """ - #: The service is not part of any Virtual Network. NONE = "None" - #: The service is part of Virtual Network and it is accessible from Internet. + """The service is not part of any Virtual Network.""" EXTERNAL = "External" - #: The service is part of Virtual Network and it is only accessible from within the virtual - #: network. + """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.""" 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 11d3e4a3c5dc..adc7bf873ebb 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 @@ -52,7 +52,7 @@ class AccessInformationCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, count: Optional[int] = None, **kwargs): + def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None: """ :keyword count: Total record count number across all pages. :paramtype count: int @@ -90,7 +90,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -98,7 +98,40 @@ def __init__(self, **kwargs): self.type = None -class AccessInformationContract(Resource): +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _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. Variables are only populated by the server, and will be ignored when sending a request. @@ -140,8 +173,8 @@ def __init__( id_properties_id: Optional[str] = None, principal_id: Optional[str] = None, enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id_properties_id: Access Information type ('access' or 'gitAccess'). :paramtype id_properties_id: str @@ -185,8 +218,8 @@ def __init__( primary_key: Optional[str] = None, secondary_key: Optional[str] = None, enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword principal_id: Principal (User) Identifier. :paramtype principal_id: str @@ -239,8 +272,8 @@ def __init__( primary_key: Optional[str] = None, secondary_key: Optional[str] = None, enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Access Information type ('access' or 'gitAccess'). :paramtype id: str @@ -274,7 +307,7 @@ class AccessInformationUpdateParameters(_serialization.Model): "enabled": {"key": "properties.enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Determines whether direct access is enabled. :paramtype enabled: bool @@ -283,7 +316,7 @@ def __init__(self, *, enabled: Optional[bool] = None, **kwargs): self.enabled = enabled -class AdditionalLocation(_serialization.Model): +class AdditionalLocation(_serialization.Model): # pylint: disable=too-many-instance-attributes """Description of an additional API Management resource location. Variables are only populated by the server, and will be ignored when sending a request. @@ -314,6 +347,12 @@ class AdditionalLocation(_serialization.Model): ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration :ivar gateway_regional_url: Gateway URL of the API Management service in the Region. :vartype gateway_regional_url: str + :ivar nat_gateway_state: Property can be used to enable NAT Gateway for this API Management + service. Known values are: "Enabled" and "Disabled". + :vartype nat_gateway_state: str or ~azure.mgmt.apimanagement.models.NatGatewayState + :ivar outbound_public_ip_addresses: Outbound public IPV4 address prefixes associated with NAT + Gateway deployed service. Available only for Premium SKU on stv2 platform. + :vartype outbound_public_ip_addresses: list[str] :ivar disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in this additional location. :vartype disable_gateway: bool @@ -328,6 +367,7 @@ class AdditionalLocation(_serialization.Model): "public_ip_addresses": {"readonly": True}, "private_ip_addresses": {"readonly": True}, "gateway_regional_url": {"readonly": True}, + "outbound_public_ip_addresses": {"readonly": True}, "platform_version": {"readonly": True}, } @@ -340,6 +380,8 @@ class AdditionalLocation(_serialization.Model): "public_ip_address_id": {"key": "publicIpAddressId", "type": "str"}, "virtual_network_configuration": {"key": "virtualNetworkConfiguration", "type": "VirtualNetworkConfiguration"}, "gateway_regional_url": {"key": "gatewayRegionalUrl", "type": "str"}, + "nat_gateway_state": {"key": "natGatewayState", "type": "str"}, + "outbound_public_ip_addresses": {"key": "outboundPublicIPAddresses", "type": "[str]"}, "disable_gateway": {"key": "disableGateway", "type": "bool"}, "platform_version": {"key": "platformVersion", "type": "str"}, } @@ -352,9 +394,10 @@ def __init__( zones: Optional[List[str]] = None, public_ip_address_id: Optional[str] = None, virtual_network_configuration: Optional["_models.VirtualNetworkConfiguration"] = None, + nat_gateway_state: Optional[Union[str, "_models.NatGatewayState"]] = None, disable_gateway: bool = False, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location name of the additional region among Azure Data center regions. Required. @@ -370,6 +413,9 @@ def __init__( :keyword virtual_network_configuration: Virtual network configuration for the location. :paramtype virtual_network_configuration: ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration + :keyword nat_gateway_state: Property can be used to enable NAT Gateway for this API Management + service. Known values are: "Enabled" and "Disabled". + :paramtype nat_gateway_state: str or ~azure.mgmt.apimanagement.models.NatGatewayState :keyword disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in this additional location. :paramtype disable_gateway: bool @@ -383,6 +429,8 @@ def __init__( self.public_ip_address_id = public_ip_address_id self.virtual_network_configuration = virtual_network_configuration self.gateway_regional_url = None + self.nat_gateway_state = nat_gateway_state + self.outbound_public_ip_addresses = None self.disable_gateway = disable_gateway self.platform_version = None @@ -411,7 +459,7 @@ class ApiCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, count: Optional[int] = None, **kwargs): + def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None: """ :keyword count: Total record count number across all pages. :paramtype count: int @@ -440,7 +488,9 @@ class ApiContactInformation(_serialization.Model): "email": {"key": "email", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, url: Optional[str] = None, email: Optional[str] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, url: Optional[str] = None, email: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword name: The identifying name of the contact person/organization. :paramtype name: str @@ -456,7 +506,7 @@ def __init__(self, *, name: Optional[str] = None, url: Optional[str] = None, ema self.email = email -class ApiContract(Resource): # pylint: disable=too-many-instance-attributes +class ApiContract(ProxyResource): # pylint: disable=too-many-instance-attributes """API details. Variables are only populated by the server, and will be ignored when sending a request. @@ -591,8 +641,8 @@ def __init__( # pylint: disable=too-many-locals path: Optional[str] = None, protocols: Optional[List[Union[str, "_models.Protocol"]]] = None, api_version_set: Optional["_models.ApiVersionSetContractDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of the API. May include HTML formatting tags. :paramtype description: str @@ -755,8 +805,8 @@ def __init__( terms_of_service_url: Optional[str] = None, contact: Optional["_models.ApiContactInformation"] = None, license: Optional["_models.ApiLicenseInformation"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of the API. May include HTML formatting tags. :paramtype description: str @@ -930,8 +980,8 @@ def __init__( service_url: Optional[str] = None, protocols: Optional[List[Union[str, "_models.Protocol"]]] = None, api_version_set: Optional["_models.ApiVersionSetContractDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of the API. May include HTML formatting tags. :paramtype description: str @@ -1116,8 +1166,8 @@ def __init__( service_url: Optional[str] = None, path: Optional[str] = None, protocols: Optional[List[Union[str, "_models.Protocol"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of the API. May include HTML formatting tags. :paramtype description: str @@ -1259,6 +1309,11 @@ class ApiCreateOrUpdateParameter(_serialization.Model): # pylint: disable=too-m * ``graphql`` creates GraphQL API. Known values are: "http", "soap", "websocket", and "graphql". :vartype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType + :ivar translate_required_query_parameters_conduct: Strategy of translating required query + parameters to template ones. By default has value 'template'. Possible values: 'template', + 'query'. Known values are: "template" and "query". + :vartype translate_required_query_parameters_conduct: str or + ~azure.mgmt.apimanagement.models.TranslateRequiredQueryParametersConduct """ _validation = { @@ -1304,6 +1359,10 @@ class ApiCreateOrUpdateParameter(_serialization.Model): # pylint: disable=too-m "format": {"key": "properties.format", "type": "str"}, "wsdl_selector": {"key": "properties.wsdlSelector", "type": "ApiCreateOrUpdatePropertiesWsdlSelector"}, "soap_api_type": {"key": "properties.apiType", "type": "str"}, + "translate_required_query_parameters_conduct": { + "key": "properties.translateRequiredQueryParameters", + "type": "str", + }, } def __init__( # pylint: disable=too-many-locals @@ -1333,8 +1392,11 @@ def __init__( # pylint: disable=too-many-locals format: Optional[Union[str, "_models.ContentFormat"]] = None, wsdl_selector: Optional["_models.ApiCreateOrUpdatePropertiesWsdlSelector"] = None, soap_api_type: Optional[Union[str, "_models.SoapApiType"]] = None, - **kwargs - ): + translate_required_query_parameters_conduct: Optional[ + Union[str, "_models.TranslateRequiredQueryParametersConduct"] + ] = None, + **kwargs: Any + ) -> None: """ :keyword description: Description of the API. May include HTML formatting tags. :paramtype description: str @@ -1402,6 +1464,11 @@ def __init__( # pylint: disable=too-many-locals * ``graphql`` creates GraphQL API. Known values are: "http", "soap", "websocket", and "graphql". :paramtype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType + :keyword translate_required_query_parameters_conduct: Strategy of translating required query + parameters to template ones. By default has value 'template'. Possible values: 'template', + 'query'. Known values are: "template" and "query". + :paramtype translate_required_query_parameters_conduct: str or + ~azure.mgmt.apimanagement.models.TranslateRequiredQueryParametersConduct """ super().__init__(**kwargs) self.description = description @@ -1429,6 +1496,7 @@ def __init__( # pylint: disable=too-many-locals self.format = format self.wsdl_selector = wsdl_selector self.soap_api_type = soap_api_type + self.translate_required_query_parameters_conduct = translate_required_query_parameters_conduct class ApiCreateOrUpdateProperties(ApiContractProperties): # pylint: disable=too-many-instance-attributes @@ -1506,6 +1574,11 @@ class ApiCreateOrUpdateProperties(ApiContractProperties): # pylint: disable=too * ``graphql`` creates GraphQL API. Known values are: "http", "soap", "websocket", and "graphql". :vartype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType + :ivar translate_required_query_parameters_conduct: Strategy of translating required query + parameters to template ones. By default has value 'template'. Possible values: 'template', + 'query'. Known values are: "template" and "query". + :vartype translate_required_query_parameters_conduct: str or + ~azure.mgmt.apimanagement.models.TranslateRequiredQueryParametersConduct """ _validation = { @@ -1548,6 +1621,7 @@ class ApiCreateOrUpdateProperties(ApiContractProperties): # pylint: disable=too "format": {"key": "format", "type": "str"}, "wsdl_selector": {"key": "wsdlSelector", "type": "ApiCreateOrUpdatePropertiesWsdlSelector"}, "soap_api_type": {"key": "apiType", "type": "str"}, + "translate_required_query_parameters_conduct": {"key": "translateRequiredQueryParameters", "type": "str"}, } def __init__( # pylint: disable=too-many-locals @@ -1577,8 +1651,11 @@ def __init__( # pylint: disable=too-many-locals format: Optional[Union[str, "_models.ContentFormat"]] = None, wsdl_selector: Optional["_models.ApiCreateOrUpdatePropertiesWsdlSelector"] = None, soap_api_type: Optional[Union[str, "_models.SoapApiType"]] = None, - **kwargs - ): + translate_required_query_parameters_conduct: Optional[ + Union[str, "_models.TranslateRequiredQueryParametersConduct"] + ] = None, + **kwargs: Any + ) -> None: """ :keyword description: Description of the API. May include HTML formatting tags. :paramtype description: str @@ -1646,6 +1723,11 @@ def __init__( # pylint: disable=too-many-locals * ``graphql`` creates GraphQL API. Known values are: "http", "soap", "websocket", and "graphql". :paramtype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType + :keyword translate_required_query_parameters_conduct: Strategy of translating required query + parameters to template ones. By default has value 'template'. Possible values: 'template', + 'query'. Known values are: "template" and "query". + :paramtype translate_required_query_parameters_conduct: str or + ~azure.mgmt.apimanagement.models.TranslateRequiredQueryParametersConduct """ super().__init__( description=description, @@ -1674,6 +1756,7 @@ def __init__( # pylint: disable=too-many-locals self.format = format self.wsdl_selector = wsdl_selector self.soap_api_type = soap_api_type + self.translate_required_query_parameters_conduct = translate_required_query_parameters_conduct class ApiCreateOrUpdatePropertiesWsdlSelector(_serialization.Model): @@ -1690,7 +1773,9 @@ class ApiCreateOrUpdatePropertiesWsdlSelector(_serialization.Model): "wsdl_endpoint_name": {"key": "wsdlEndpointName", "type": "str"}, } - def __init__(self, *, wsdl_service_name: Optional[str] = None, wsdl_endpoint_name: Optional[str] = None, **kwargs): + def __init__( + self, *, wsdl_service_name: Optional[str] = None, wsdl_endpoint_name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword wsdl_service_name: Name of service to import from WSDL. :paramtype wsdl_service_name: str @@ -1727,8 +1812,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin export_result_format: Optional[Union[str, "_models.ExportResultFormat"]] = None, value: Optional["_models.ApiExportResultValue"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: ResourceId of the API which was exported. :paramtype id: str @@ -1757,7 +1842,7 @@ class ApiExportResultValue(_serialization.Model): "link": {"key": "link", "type": "str"}, } - def __init__(self, *, link: Optional[str] = None, **kwargs): + def __init__(self, *, link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword link: Link to the Storage Blob containing the result of the export operation. The Blob Uri is only valid for 5 minutes. @@ -1781,7 +1866,7 @@ class ApiLicenseInformation(_serialization.Model): "url": {"key": "url", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, url: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, url: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The license name used for the API. :paramtype name: str @@ -1805,7 +1890,7 @@ class ApiManagementServiceApplyNetworkConfigurationParameters(_serialization.Mod "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: Optional[str] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: Location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required. @@ -1863,8 +1948,8 @@ def __init__( access_type: Union[str, "_models.AccessType"] = "AccessKey", access_key: Optional[str] = None, client_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword storage_account: The name of the Azure storage account (used to place/retrieve the backup). Required. @@ -1960,9 +2045,9 @@ class ApiManagementServiceBaseProperties(_serialization.Model): # pylint: disab ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable HTTP2 protocol on an API Management service.
Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings - except Http2 the default value is ``True`` if the service was created on or before April 1st + except Http2 the default value is ``True`` if the service was created on or before April 1, 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can - disable any of next ciphers by using settings + disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, @@ -1970,9 +2055,9 @@ class ApiManagementServiceBaseProperties(_serialization.Model): # pylint: disab TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ - ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since - they are required by Azure CloudService internal components: - 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_RSA_WITH_AES_256_GCM_SHA384. + ``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. :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. @@ -1981,6 +2066,12 @@ class ApiManagementServiceBaseProperties(_serialization.Model): # pylint: disab This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. :vartype enable_client_certificate: bool + :ivar nat_gateway_state: Property can be used to enable NAT Gateway for this API Management + service. Known values are: "Enabled" and "Disabled". + :vartype nat_gateway_state: str or ~azure.mgmt.apimanagement.models.NatGatewayState + :ivar outbound_public_ip_addresses: Outbound public IPV4 address prefixes associated with NAT + Gateway deployed service. Available only for Premium SKU on stv2 platform. + :vartype outbound_public_ip_addresses: list[str] :ivar disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. :vartype disable_gateway: bool @@ -2018,6 +2109,7 @@ class ApiManagementServiceBaseProperties(_serialization.Model): # pylint: disab "developer_portal_url": {"readonly": True}, "public_ip_addresses": {"readonly": True}, "private_ip_addresses": {"readonly": True}, + "outbound_public_ip_addresses": {"readonly": True}, "platform_version": {"readonly": True}, } @@ -2042,6 +2134,8 @@ class ApiManagementServiceBaseProperties(_serialization.Model): # pylint: disab "custom_properties": {"key": "customProperties", "type": "{str}"}, "certificates": {"key": "certificates", "type": "[CertificateConfiguration]"}, "enable_client_certificate": {"key": "enableClientCertificate", "type": "bool"}, + "nat_gateway_state": {"key": "natGatewayState", "type": "str"}, + "outbound_public_ip_addresses": {"key": "outboundPublicIPAddresses", "type": "[str]"}, "disable_gateway": {"key": "disableGateway", "type": "bool"}, "virtual_network_type": {"key": "virtualNetworkType", "type": "str"}, "api_version_constraint": {"key": "apiVersionConstraint", "type": "ApiVersionConstraint"}, @@ -2065,13 +2159,14 @@ def __init__( # pylint: disable=too-many-locals custom_properties: Optional[Dict[str, str]] = None, certificates: Optional[List["_models.CertificateConfiguration"]] = None, enable_client_certificate: bool = False, + nat_gateway_state: Optional[Union[str, "_models.NatGatewayState"]] = None, disable_gateway: bool = False, virtual_network_type: Union[str, "_models.VirtualNetworkType"] = "None", api_version_constraint: Optional["_models.ApiVersionConstraint"] = None, restore: bool = False, private_endpoint_connections: Optional[List["_models.RemotePrivateEndpointConnectionWrapper"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword notification_sender_email: Email address from which the notification will be sent. :paramtype notification_sender_email: str @@ -2107,9 +2202,9 @@ def __init__( # pylint: disable=too-many-locals ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable HTTP2 protocol on an API Management service.
Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings - except Http2 the default value is ``True`` if the service was created on or before April 1st + except Http2 the default value is ``True`` if the service was created on or before April 1, 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can - disable any of next ciphers by using settings + disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, @@ -2117,9 +2212,9 @@ def __init__( # pylint: disable=too-many-locals TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ - ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since - they are required by Azure CloudService internal components: - 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_RSA_WITH_AES_256_GCM_SHA384. + ``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. :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. @@ -2128,6 +2223,9 @@ def __init__( # pylint: disable=too-many-locals This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. :paramtype enable_client_certificate: bool + :keyword nat_gateway_state: Property can be used to enable NAT Gateway for this API Management + service. Known values are: "Enabled" and "Disabled". + :paramtype nat_gateway_state: str or ~azure.mgmt.apimanagement.models.NatGatewayState :keyword disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. :paramtype disable_gateway: bool @@ -2169,6 +2267,8 @@ def __init__( # pylint: disable=too-many-locals self.custom_properties = custom_properties self.certificates = certificates self.enable_client_certificate = enable_client_certificate + self.nat_gateway_state = nat_gateway_state + self.outbound_public_ip_addresses = None self.disable_gateway = disable_gateway self.virtual_network_type = virtual_network_type self.api_version_constraint = api_version_constraint @@ -2194,7 +2294,7 @@ class ApiManagementServiceCheckNameAvailabilityParameters(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: The name to check for availability. Required. :paramtype name: str @@ -2220,7 +2320,7 @@ class ApiManagementServiceGetDomainOwnershipIdentifierResult(_serialization.Mode "domain_ownership_identifier": {"key": "domainOwnershipIdentifier", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.domain_ownership_identifier = None @@ -2237,7 +2337,7 @@ class ApiManagementServiceGetSsoTokenResult(_serialization.Model): "redirect_uri": {"key": "redirectUri", "type": "str"}, } - def __init__(self, *, redirect_uri: Optional[str] = None, **kwargs): + def __init__(self, *, redirect_uri: Optional[str] = None, **kwargs: Any) -> None: """ :keyword redirect_uri: Redirect URL to the Publisher Portal containing the SSO token. :paramtype redirect_uri: str @@ -2289,8 +2389,8 @@ def __init__( *, type: Union[str, "_models.ApimIdentityType"], user_assigned_identities: Optional[Dict[str, "_models.UserIdentityProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword 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 @@ -2334,8 +2434,8 @@ class ApiManagementServiceListResult(_serialization.Model): } def __init__( - self, *, value: List["_models.ApiManagementServiceResource"], next_link: Optional[str] = None, **kwargs - ): + self, *, value: List["_models.ApiManagementServiceResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List API Management services operation. Required. :paramtype value: list[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] @@ -2379,7 +2479,7 @@ class ApiManagementServiceNameAvailabilityResult(_serialization.Model): "reason": {"key": "reason", "type": "str"}, } - def __init__(self, *, reason: Optional[Union[str, "_models.NameAvailabilityReason"]] = None, **kwargs): + def __init__(self, *, reason: Optional[Union[str, "_models.NameAvailabilityReason"]] = None, **kwargs: Any) -> None: """ :keyword reason: Invalid indicates the name provided does not match the resource provider’s naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates @@ -2464,9 +2564,9 @@ class ApiManagementServiceProperties( ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable HTTP2 protocol on an API Management service.
Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings - except Http2 the default value is ``True`` if the service was created on or before April 1st + except Http2 the default value is ``True`` if the service was created on or before April 1, 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can - disable any of next ciphers by using settings + disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, @@ -2474,9 +2574,9 @@ class ApiManagementServiceProperties( TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ - ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since - they are required by Azure CloudService internal components: - 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_RSA_WITH_AES_256_GCM_SHA384. + ``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. :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. @@ -2485,6 +2585,12 @@ class ApiManagementServiceProperties( This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. :vartype enable_client_certificate: bool + :ivar nat_gateway_state: Property can be used to enable NAT Gateway for this API Management + service. Known values are: "Enabled" and "Disabled". + :vartype nat_gateway_state: str or ~azure.mgmt.apimanagement.models.NatGatewayState + :ivar outbound_public_ip_addresses: Outbound public IPV4 address prefixes associated with NAT + Gateway deployed service. Available only for Premium SKU on stv2 platform. + :vartype outbound_public_ip_addresses: list[str] :ivar disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. :vartype disable_gateway: bool @@ -2526,6 +2632,7 @@ class ApiManagementServiceProperties( "developer_portal_url": {"readonly": True}, "public_ip_addresses": {"readonly": True}, "private_ip_addresses": {"readonly": True}, + "outbound_public_ip_addresses": {"readonly": True}, "platform_version": {"readonly": True}, "publisher_email": {"required": True, "max_length": 100}, "publisher_name": {"required": True, "max_length": 100}, @@ -2552,6 +2659,8 @@ class ApiManagementServiceProperties( "custom_properties": {"key": "customProperties", "type": "{str}"}, "certificates": {"key": "certificates", "type": "[CertificateConfiguration]"}, "enable_client_certificate": {"key": "enableClientCertificate", "type": "bool"}, + "nat_gateway_state": {"key": "natGatewayState", "type": "str"}, + "outbound_public_ip_addresses": {"key": "outboundPublicIPAddresses", "type": "[str]"}, "disable_gateway": {"key": "disableGateway", "type": "bool"}, "virtual_network_type": {"key": "virtualNetworkType", "type": "str"}, "api_version_constraint": {"key": "apiVersionConstraint", "type": "ApiVersionConstraint"}, @@ -2579,13 +2688,14 @@ def __init__( # pylint: disable=too-many-locals custom_properties: Optional[Dict[str, str]] = None, certificates: Optional[List["_models.CertificateConfiguration"]] = None, enable_client_certificate: bool = False, + nat_gateway_state: Optional[Union[str, "_models.NatGatewayState"]] = None, disable_gateway: bool = False, virtual_network_type: Union[str, "_models.VirtualNetworkType"] = "None", api_version_constraint: Optional["_models.ApiVersionConstraint"] = None, restore: bool = False, private_endpoint_connections: Optional[List["_models.RemotePrivateEndpointConnectionWrapper"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword notification_sender_email: Email address from which the notification will be sent. :paramtype notification_sender_email: str @@ -2621,9 +2731,9 @@ def __init__( # pylint: disable=too-many-locals ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable HTTP2 protocol on an API Management service.
Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings - except Http2 the default value is ``True`` if the service was created on or before April 1st + except Http2 the default value is ``True`` if the service was created on or before April 1, 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can - disable any of next ciphers by using settings + disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, @@ -2631,9 +2741,9 @@ def __init__( # pylint: disable=too-many-locals TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ - ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since - they are required by Azure CloudService internal components: - 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_RSA_WITH_AES_256_GCM_SHA384. + ``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. :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. @@ -2642,6 +2752,9 @@ def __init__( # pylint: disable=too-many-locals This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. :paramtype enable_client_certificate: bool + :keyword nat_gateway_state: Property can be used to enable NAT Gateway for this API Management + service. Known values are: "Enabled" and "Disabled". + :paramtype nat_gateway_state: str or ~azure.mgmt.apimanagement.models.NatGatewayState :keyword disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. :paramtype disable_gateway: bool @@ -2676,6 +2789,7 @@ def __init__( # pylint: disable=too-many-locals custom_properties=custom_properties, certificates=certificates, enable_client_certificate=enable_client_certificate, + nat_gateway_state=nat_gateway_state, disable_gateway=disable_gateway, virtual_network_type=virtual_network_type, api_version_constraint=api_version_constraint, @@ -2715,7 +2829,7 @@ class ApimResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2816,9 +2930,9 @@ class ApiManagementServiceResource(ApimResource): # pylint: disable=too-many-in ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable HTTP2 protocol on an API Management service.
Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings - except Http2 the default value is ``True`` if the service was created on or before April 1st + except Http2 the default value is ``True`` if the service was created on or before April 1, 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can - disable any of next ciphers by using settings + disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, @@ -2826,9 +2940,9 @@ class ApiManagementServiceResource(ApimResource): # pylint: disable=too-many-in TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ - ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since - they are required by Azure CloudService internal components: - 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_RSA_WITH_AES_256_GCM_SHA384. + ``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. :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. @@ -2837,6 +2951,12 @@ class ApiManagementServiceResource(ApimResource): # pylint: disable=too-many-in This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. :vartype enable_client_certificate: bool + :ivar nat_gateway_state: Property can be used to enable NAT Gateway for this API Management + service. Known values are: "Enabled" and "Disabled". + :vartype nat_gateway_state: str or ~azure.mgmt.apimanagement.models.NatGatewayState + :ivar outbound_public_ip_addresses: Outbound public IPV4 address prefixes associated with NAT + Gateway deployed service. Available only for Premium SKU on stv2 platform. + :vartype outbound_public_ip_addresses: list[str] :ivar disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. :vartype disable_gateway: bool @@ -2885,6 +3005,7 @@ class ApiManagementServiceResource(ApimResource): # pylint: disable=too-many-in "developer_portal_url": {"readonly": True}, "public_ip_addresses": {"readonly": True}, "private_ip_addresses": {"readonly": True}, + "outbound_public_ip_addresses": {"readonly": True}, "platform_version": {"readonly": True}, "publisher_email": {"required": True, "max_length": 100}, "publisher_name": {"required": True, "max_length": 100}, @@ -2924,6 +3045,8 @@ class ApiManagementServiceResource(ApimResource): # pylint: disable=too-many-in "custom_properties": {"key": "properties.customProperties", "type": "{str}"}, "certificates": {"key": "properties.certificates", "type": "[CertificateConfiguration]"}, "enable_client_certificate": {"key": "properties.enableClientCertificate", "type": "bool"}, + "nat_gateway_state": {"key": "properties.natGatewayState", "type": "str"}, + "outbound_public_ip_addresses": {"key": "properties.outboundPublicIPAddresses", "type": "[str]"}, "disable_gateway": {"key": "properties.disableGateway", "type": "bool"}, "virtual_network_type": {"key": "properties.virtualNetworkType", "type": "str"}, "api_version_constraint": {"key": "properties.apiVersionConstraint", "type": "ApiVersionConstraint"}, @@ -2956,13 +3079,14 @@ def __init__( # pylint: disable=too-many-locals custom_properties: Optional[Dict[str, str]] = None, certificates: Optional[List["_models.CertificateConfiguration"]] = None, enable_client_certificate: bool = False, + nat_gateway_state: Optional[Union[str, "_models.NatGatewayState"]] = None, disable_gateway: bool = False, virtual_network_type: Union[str, "_models.VirtualNetworkType"] = "None", api_version_constraint: Optional["_models.ApiVersionConstraint"] = None, restore: bool = False, private_endpoint_connections: Optional[List["_models.RemotePrivateEndpointConnectionWrapper"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -3008,9 +3132,9 @@ def __init__( # pylint: disable=too-many-locals ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable HTTP2 protocol on an API Management service.
Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings - except Http2 the default value is ``True`` if the service was created on or before April 1st + except Http2 the default value is ``True`` if the service was created on or before April 1, 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can - disable any of next ciphers by using settings + disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, @@ -3018,9 +3142,9 @@ def __init__( # pylint: disable=too-many-locals TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ - ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since - they are required by Azure CloudService internal components: - 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_RSA_WITH_AES_256_GCM_SHA384. + ``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. :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. @@ -3029,6 +3153,9 @@ def __init__( # pylint: disable=too-many-locals This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. :paramtype enable_client_certificate: bool + :keyword nat_gateway_state: Property can be used to enable NAT Gateway for this API Management + service. Known values are: "Enabled" and "Disabled". + :paramtype nat_gateway_state: str or ~azure.mgmt.apimanagement.models.NatGatewayState :keyword disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. :paramtype disable_gateway: bool @@ -3080,6 +3207,8 @@ def __init__( # pylint: disable=too-many-locals self.custom_properties = custom_properties self.certificates = certificates self.enable_client_certificate = enable_client_certificate + self.nat_gateway_state = nat_gateway_state + self.outbound_public_ip_addresses = None self.disable_gateway = disable_gateway self.virtual_network_type = virtual_network_type self.api_version_constraint = api_version_constraint @@ -3113,7 +3242,7 @@ class ApiManagementServiceSkuProperties(_serialization.Model): "capacity": {"key": "capacity", "type": "int"}, } - def __init__(self, *, name: Union[str, "_models.SkuType"], capacity: int, **kwargs): + def __init__(self, *, name: Union[str, "_models.SkuType"], capacity: int, **kwargs: Any) -> None: """ :keyword name: Name of the Sku. Required. Known values are: "Developer", "Standard", "Premium", "Basic", "Consumption", and "Isolated". @@ -3210,9 +3339,9 @@ class ApiManagementServiceUpdateParameters(ApimResource): # pylint: disable=too ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable HTTP2 protocol on an API Management service.
Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings - except Http2 the default value is ``True`` if the service was created on or before April 1st + except Http2 the default value is ``True`` if the service was created on or before April 1, 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can - disable any of next ciphers by using settings + disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, @@ -3220,9 +3349,9 @@ class ApiManagementServiceUpdateParameters(ApimResource): # pylint: disable=too TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ - ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since - they are required by Azure CloudService internal components: - 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_RSA_WITH_AES_256_GCM_SHA384. + ``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. :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. @@ -3231,6 +3360,12 @@ class ApiManagementServiceUpdateParameters(ApimResource): # pylint: disable=too This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. :vartype enable_client_certificate: bool + :ivar nat_gateway_state: Property can be used to enable NAT Gateway for this API Management + service. Known values are: "Enabled" and "Disabled". + :vartype nat_gateway_state: str or ~azure.mgmt.apimanagement.models.NatGatewayState + :ivar outbound_public_ip_addresses: Outbound public IPV4 address prefixes associated with NAT + Gateway deployed service. Available only for Premium SKU on stv2 platform. + :vartype outbound_public_ip_addresses: list[str] :ivar disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. :vartype disable_gateway: bool @@ -3276,6 +3411,7 @@ class ApiManagementServiceUpdateParameters(ApimResource): # pylint: disable=too "developer_portal_url": {"readonly": True}, "public_ip_addresses": {"readonly": True}, "private_ip_addresses": {"readonly": True}, + "outbound_public_ip_addresses": {"readonly": True}, "platform_version": {"readonly": True}, "publisher_email": {"max_length": 100}, "publisher_name": {"max_length": 100}, @@ -3313,6 +3449,8 @@ class ApiManagementServiceUpdateParameters(ApimResource): # pylint: disable=too "custom_properties": {"key": "properties.customProperties", "type": "{str}"}, "certificates": {"key": "properties.certificates", "type": "[CertificateConfiguration]"}, "enable_client_certificate": {"key": "properties.enableClientCertificate", "type": "bool"}, + "nat_gateway_state": {"key": "properties.natGatewayState", "type": "str"}, + "outbound_public_ip_addresses": {"key": "properties.outboundPublicIPAddresses", "type": "[str]"}, "disable_gateway": {"key": "properties.disableGateway", "type": "bool"}, "virtual_network_type": {"key": "properties.virtualNetworkType", "type": "str"}, "api_version_constraint": {"key": "properties.apiVersionConstraint", "type": "ApiVersionConstraint"}, @@ -3342,6 +3480,7 @@ def __init__( # pylint: disable=too-many-locals custom_properties: Optional[Dict[str, str]] = None, certificates: Optional[List["_models.CertificateConfiguration"]] = None, enable_client_certificate: bool = False, + nat_gateway_state: Optional[Union[str, "_models.NatGatewayState"]] = None, disable_gateway: bool = False, virtual_network_type: Union[str, "_models.VirtualNetworkType"] = "None", api_version_constraint: Optional["_models.ApiVersionConstraint"] = None, @@ -3349,8 +3488,8 @@ def __init__( # pylint: disable=too-many-locals private_endpoint_connections: Optional[List["_models.RemotePrivateEndpointConnectionWrapper"]] = None, publisher_email: Optional[str] = None, publisher_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -3394,9 +3533,9 @@ def __init__( # pylint: disable=too-many-locals ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable HTTP2 protocol on an API Management service.
Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings - except Http2 the default value is ``True`` if the service was created on or before April 1st + except Http2 the default value is ``True`` if the service was created on or before April 1, 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can - disable any of next ciphers by using settings + disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, @@ -3404,9 +3543,9 @@ def __init__( # pylint: disable=too-many-locals TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ - ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since - they are required by Azure CloudService internal components: - 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_RSA_WITH_AES_256_GCM_SHA384. + ``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. :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. @@ -3415,6 +3554,9 @@ def __init__( # pylint: disable=too-many-locals This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. :paramtype enable_client_certificate: bool + :keyword nat_gateway_state: Property can be used to enable NAT Gateway for this API Management + service. Known values are: "Enabled" and "Disabled". + :paramtype nat_gateway_state: str or ~azure.mgmt.apimanagement.models.NatGatewayState :keyword disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. :paramtype disable_gateway: bool @@ -3464,6 +3606,8 @@ def __init__( # pylint: disable=too-many-locals self.custom_properties = custom_properties self.certificates = certificates self.enable_client_certificate = enable_client_certificate + self.nat_gateway_state = nat_gateway_state + self.outbound_public_ip_addresses = None self.disable_gateway = disable_gateway self.virtual_network_type = virtual_network_type self.api_version_constraint = api_version_constraint @@ -3543,9 +3687,9 @@ class ApiManagementServiceUpdateProperties( ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable HTTP2 protocol on an API Management service.
Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings - except Http2 the default value is ``True`` if the service was created on or before April 1st + except Http2 the default value is ``True`` if the service was created on or before April 1, 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can - disable any of next ciphers by using settings + disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, @@ -3553,9 +3697,9 @@ class ApiManagementServiceUpdateProperties( TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ - ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since - they are required by Azure CloudService internal components: - 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_RSA_WITH_AES_256_GCM_SHA384. + ``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. :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. @@ -3564,6 +3708,12 @@ class ApiManagementServiceUpdateProperties( This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. :vartype enable_client_certificate: bool + :ivar nat_gateway_state: Property can be used to enable NAT Gateway for this API Management + service. Known values are: "Enabled" and "Disabled". + :vartype nat_gateway_state: str or ~azure.mgmt.apimanagement.models.NatGatewayState + :ivar outbound_public_ip_addresses: Outbound public IPV4 address prefixes associated with NAT + Gateway deployed service. Available only for Premium SKU on stv2 platform. + :vartype outbound_public_ip_addresses: list[str] :ivar disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. :vartype disable_gateway: bool @@ -3605,6 +3755,7 @@ class ApiManagementServiceUpdateProperties( "developer_portal_url": {"readonly": True}, "public_ip_addresses": {"readonly": True}, "private_ip_addresses": {"readonly": True}, + "outbound_public_ip_addresses": {"readonly": True}, "platform_version": {"readonly": True}, "publisher_email": {"max_length": 100}, "publisher_name": {"max_length": 100}, @@ -3631,6 +3782,8 @@ class ApiManagementServiceUpdateProperties( "custom_properties": {"key": "customProperties", "type": "{str}"}, "certificates": {"key": "certificates", "type": "[CertificateConfiguration]"}, "enable_client_certificate": {"key": "enableClientCertificate", "type": "bool"}, + "nat_gateway_state": {"key": "natGatewayState", "type": "str"}, + "outbound_public_ip_addresses": {"key": "outboundPublicIPAddresses", "type": "[str]"}, "disable_gateway": {"key": "disableGateway", "type": "bool"}, "virtual_network_type": {"key": "virtualNetworkType", "type": "str"}, "api_version_constraint": {"key": "apiVersionConstraint", "type": "ApiVersionConstraint"}, @@ -3656,6 +3809,7 @@ def __init__( # pylint: disable=too-many-locals custom_properties: Optional[Dict[str, str]] = None, certificates: Optional[List["_models.CertificateConfiguration"]] = None, enable_client_certificate: bool = False, + nat_gateway_state: Optional[Union[str, "_models.NatGatewayState"]] = None, disable_gateway: bool = False, virtual_network_type: Union[str, "_models.VirtualNetworkType"] = "None", api_version_constraint: Optional["_models.ApiVersionConstraint"] = None, @@ -3663,8 +3817,8 @@ def __init__( # pylint: disable=too-many-locals private_endpoint_connections: Optional[List["_models.RemotePrivateEndpointConnectionWrapper"]] = None, publisher_email: Optional[str] = None, publisher_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword notification_sender_email: Email address from which the notification will be sent. :paramtype notification_sender_email: str @@ -3700,9 +3854,9 @@ def __init__( # pylint: disable=too-many-locals ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable HTTP2 protocol on an API Management service.
Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings - except Http2 the default value is ``True`` if the service was created on or before April 1st + except Http2 the default value is ``True`` if the service was created on or before April 1, 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can - disable any of next ciphers by using settings + disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, @@ -3710,9 +3864,9 @@ def __init__( # pylint: disable=too-many-locals TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ - ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since - they are required by Azure CloudService internal components: - 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_RSA_WITH_AES_256_GCM_SHA384. + ``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. :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. @@ -3721,6 +3875,9 @@ def __init__( # pylint: disable=too-many-locals This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. :paramtype enable_client_certificate: bool + :keyword nat_gateway_state: Property can be used to enable NAT Gateway for this API Management + service. Known values are: "Enabled" and "Disabled". + :paramtype nat_gateway_state: str or ~azure.mgmt.apimanagement.models.NatGatewayState :keyword disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. :paramtype disable_gateway: bool @@ -3755,6 +3912,7 @@ def __init__( # pylint: disable=too-many-locals custom_properties=custom_properties, certificates=certificates, enable_client_certificate=enable_client_certificate, + nat_gateway_state=nat_gateway_state, disable_gateway=disable_gateway, virtual_network_type=virtual_network_type, api_version_constraint=api_version_constraint, @@ -3835,7 +3993,7 @@ class ApiManagementSku(_serialization.Model): # pylint: disable=too-many-instan "restrictions": {"key": "restrictions", "type": "[ApiManagementSkuRestrictions]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.resource_type = None @@ -3874,7 +4032,7 @@ class ApiManagementSkuCapabilities(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -3911,7 +4069,7 @@ class ApiManagementSkuCapacity(_serialization.Model): "scale_type": {"key": "scaleType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.minimum = None @@ -3945,7 +4103,7 @@ class ApiManagementSkuCosts(_serialization.Model): "extended_unit": {"key": "extendedUnit", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.meter_id = None @@ -3978,7 +4136,7 @@ class ApiManagementSkuLocationInfo(_serialization.Model): "zone_details": {"key": "zoneDetails", "type": "[ApiManagementSkuZoneDetails]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.location = None @@ -4007,7 +4165,7 @@ class ApiManagementSkuRestrictionInfo(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.locations = None @@ -4046,7 +4204,7 @@ class ApiManagementSkuRestrictions(_serialization.Model): "reason_code": {"key": "reasonCode", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -4079,7 +4237,7 @@ class ApiManagementSkusResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.ApiManagementSku"], **kwargs): + def __init__(self, *, value: List["_models.ApiManagementSku"], **kwargs: Any) -> None: """ :keyword value: The list of skus available for the subscription. Required. :paramtype value: list[~azure.mgmt.apimanagement.models.ApiManagementSku] @@ -4111,7 +4269,7 @@ class ApiManagementSkuZoneDetails(_serialization.Model): "capabilities": {"key": "capabilities", "type": "[ApiManagementSkuCapabilities]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -4142,7 +4300,7 @@ class ApiReleaseCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, count: Optional[int] = None, **kwargs): + def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None: """ :keyword count: Total record count number across all pages. :paramtype count: int @@ -4153,7 +4311,7 @@ def __init__(self, *, count: Optional[int] = None, **kwargs): self.next_link = None -class ApiReleaseContract(Resource): +class ApiReleaseContract(ProxyResource): """ApiRelease details. Variables are only populated by the server, and will be ignored when sending a request. @@ -4195,7 +4353,7 @@ class ApiReleaseContract(Resource): "notes": {"key": "properties.notes", "type": "str"}, } - def __init__(self, *, api_id: Optional[str] = None, notes: Optional[str] = None, **kwargs): + def __init__(self, *, api_id: Optional[str] = None, notes: Optional[str] = None, **kwargs: Any) -> None: """ :keyword api_id: Identifier of the API the release belongs to. :paramtype api_id: str @@ -4233,7 +4391,7 @@ class ApiRevisionCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, count: Optional[int] = None, **kwargs): + def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None: """ :keyword count: Total record count number across all pages. :paramtype count: int @@ -4291,7 +4449,7 @@ class ApiRevisionContract(_serialization.Model): "is_current": {"key": "isCurrent", "type": "bool"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.api_id = None @@ -4336,8 +4494,8 @@ def __init__( api_version_name: Optional[str] = None, api_revision_description: Optional[str] = None, api_version_set: Optional["_models.ApiVersionSetContractDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword source_api_id: Resource identifier of API to be used to create the revision from. :paramtype source_api_id: str @@ -4468,8 +4626,8 @@ def __init__( service_url: Optional[str] = None, path: Optional[str] = None, protocols: Optional[List[Union[str, "_models.Protocol"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of the API. May include HTML formatting tags. :paramtype description: str @@ -4653,8 +4811,8 @@ def __init__( service_url: Optional[str] = None, path: Optional[str] = None, protocols: Optional[List[Union[str, "_models.Protocol"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of the API. May include HTML formatting tags. :paramtype description: str @@ -4734,7 +4892,7 @@ class ApiVersionConstraint(_serialization.Model): "min_api_version": {"key": "minApiVersion", "type": "str"}, } - def __init__(self, *, min_api_version: Optional[str] = None, **kwargs): + def __init__(self, *, min_api_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword min_api_version: Limit control plane API calls to API Management service with version equal to or newer than this value. @@ -4767,8 +4925,8 @@ def __init__( value: Optional[List["_models.ApiVersionSetContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Page values. :paramtype value: list[~azure.mgmt.apimanagement.models.ApiVersionSetContract] @@ -4783,7 +4941,7 @@ def __init__( self.next_link = next_link -class ApiVersionSetContract(Resource): +class ApiVersionSetContract(ProxyResource): """API Version Set Contract details. Variables are only populated by the server, and will be ignored when sending a request. @@ -4839,8 +4997,8 @@ def __init__( version_header_name: Optional[str] = None, display_name: Optional[str] = None, versioning_scheme: Optional[Union[str, "_models.VersioningScheme"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of API Version Set. :paramtype description: str @@ -4875,8 +5033,7 @@ class ApiVersionSetContractDetails(_serialization.Model): :vartype description: str :ivar versioning_scheme: An value that determines where the API Version identifier will be located in a HTTP request. Known values are: "Segment", "Query", and "Header". - :vartype versioning_scheme: str or - ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetailsVersioningScheme + :vartype versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme :ivar version_query_name: Name of query parameter that indicates the API Version if versioningScheme is set to ``query``. :vartype version_query_name: str @@ -4900,11 +5057,11 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, description: Optional[str] = None, - versioning_scheme: Optional[Union[str, "_models.ApiVersionSetContractDetailsVersioningScheme"]] = None, + versioning_scheme: Optional[Union[str, "_models.VersioningScheme"]] = None, version_query_name: Optional[str] = None, version_header_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Identifier for existing API Version Set. Omit this value to create a new Version Set. @@ -4915,8 +5072,7 @@ def __init__( :paramtype description: str :keyword versioning_scheme: An value that determines where the API Version identifier will be located in a HTTP request. Known values are: "Segment", "Query", and "Header". - :paramtype versioning_scheme: str or - ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetailsVersioningScheme + :paramtype versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme :keyword version_query_name: Name of query parameter that indicates the API Version if versioningScheme is set to ``query``. :paramtype version_query_name: str @@ -4963,8 +5119,8 @@ def __init__( description: Optional[str] = None, version_query_name: Optional[str] = None, version_header_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of API Version Set. :paramtype description: str @@ -5024,8 +5180,8 @@ def __init__( description: Optional[str] = None, version_query_name: Optional[str] = None, version_header_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of API Version Set. :paramtype description: str @@ -5091,8 +5247,8 @@ def __init__( version_header_name: Optional[str] = None, display_name: Optional[str] = None, versioning_scheme: Optional[Union[str, "_models.VersioningScheme"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of API Version Set. :paramtype description: str @@ -5156,8 +5312,8 @@ def __init__( version_header_name: Optional[str] = None, display_name: Optional[str] = None, versioning_scheme: Optional[Union[str, "_models.VersioningScheme"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of API Version Set. :paramtype description: str @@ -5200,13 +5356,13 @@ class ArmIdWrapper(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None -class AssociationContract(Resource): +class AssociationContract(ProxyResource): """Association entity details. Variables are only populated by the server, and will be ignored when sending a request. @@ -5236,7 +5392,7 @@ class AssociationContract(Resource): "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } - def __init__(self, *, provisioning_state: Optional[Literal["created"]] = None, **kwargs): + def __init__(self, *, provisioning_state: Optional[Literal["created"]] = None, **kwargs: Any) -> None: """ :keyword provisioning_state: Provisioning state. Default value is "created". :paramtype provisioning_state: str @@ -5252,11 +5408,27 @@ class AuthenticationSettingsContract(_serialization.Model): :vartype o_auth2: ~azure.mgmt.apimanagement.models.OAuth2AuthenticationSettingsContract :ivar openid: OpenID Connect Authentication Settings. :vartype openid: ~azure.mgmt.apimanagement.models.OpenIdAuthenticationSettingsContract + :ivar o_auth2_authentication_settings: Collection of OAuth2 authentication settings included + into this API. + :vartype o_auth2_authentication_settings: + list[~azure.mgmt.apimanagement.models.OAuth2AuthenticationSettingsContract] + :ivar openid_authentication_settings: Collection of Open ID Connect authentication settings + included into this API. + :vartype openid_authentication_settings: + list[~azure.mgmt.apimanagement.models.OpenIdAuthenticationSettingsContract] """ _attribute_map = { "o_auth2": {"key": "oAuth2", "type": "OAuth2AuthenticationSettingsContract"}, "openid": {"key": "openid", "type": "OpenIdAuthenticationSettingsContract"}, + "o_auth2_authentication_settings": { + "key": "oAuth2AuthenticationSettings", + "type": "[OAuth2AuthenticationSettingsContract]", + }, + "openid_authentication_settings": { + "key": "openidAuthenticationSettings", + "type": "[OpenIdAuthenticationSettingsContract]", + }, } def __init__( @@ -5264,24 +5436,36 @@ def __init__( *, o_auth2: Optional["_models.OAuth2AuthenticationSettingsContract"] = None, openid: Optional["_models.OpenIdAuthenticationSettingsContract"] = None, - **kwargs - ): + o_auth2_authentication_settings: Optional[List["_models.OAuth2AuthenticationSettingsContract"]] = None, + openid_authentication_settings: Optional[List["_models.OpenIdAuthenticationSettingsContract"]] = None, + **kwargs: Any + ) -> None: """ :keyword o_auth2: OAuth2 Authentication settings. :paramtype o_auth2: ~azure.mgmt.apimanagement.models.OAuth2AuthenticationSettingsContract :keyword openid: OpenID Connect Authentication Settings. :paramtype openid: ~azure.mgmt.apimanagement.models.OpenIdAuthenticationSettingsContract + :keyword o_auth2_authentication_settings: Collection of OAuth2 authentication settings included + into this API. + :paramtype o_auth2_authentication_settings: + list[~azure.mgmt.apimanagement.models.OAuth2AuthenticationSettingsContract] + :keyword openid_authentication_settings: Collection of Open ID Connect authentication settings + included into this API. + :paramtype openid_authentication_settings: + list[~azure.mgmt.apimanagement.models.OpenIdAuthenticationSettingsContract] """ super().__init__(**kwargs) self.o_auth2 = o_auth2 self.openid = openid + self.o_auth2_authentication_settings = o_auth2_authentication_settings + self.openid_authentication_settings = openid_authentication_settings -class AuthorizationServerCollection(_serialization.Model): - """Paged OAuth2 Authorization Servers list representation. +class AuthorizationAccessPolicyCollection(_serialization.Model): + """Paged Authorization Access Policy list representation. :ivar value: Page values. - :vartype value: list[~azure.mgmt.apimanagement.models.AuthorizationServerContract] + :vartype value: list[~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract] :ivar count: Total record count number across all pages. :vartype count: int :ivar next_link: Next page link if any. @@ -5289,7 +5473,7 @@ class AuthorizationServerCollection(_serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "[AuthorizationServerContract]"}, + "value": {"key": "value", "type": "[AuthorizationAccessPolicyContract]"}, "count": {"key": "count", "type": "int"}, "next_link": {"key": "nextLink", "type": "str"}, } @@ -5297,14 +5481,14 @@ class AuthorizationServerCollection(_serialization.Model): def __init__( self, *, - value: Optional[List["_models.AuthorizationServerContract"]] = None, + value: Optional[List["_models.AuthorizationAccessPolicyContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Page values. - :paramtype value: list[~azure.mgmt.apimanagement.models.AuthorizationServerContract] + :paramtype value: list[~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract] :keyword count: Total record count number across all pages. :paramtype count: int :keyword next_link: Next page link if any. @@ -5316,8 +5500,8 @@ def __init__( self.next_link = next_link -class AuthorizationServerContract(Resource): # pylint: disable=too-many-instance-attributes - """External OAuth authorization server settings. +class AuthorizationAccessPolicyContract(ProxyResource): + """Authorization access policy contract. Variables are only populated by the server, and will be ignored when sending a request. @@ -5329,237 +5513,695 @@ class AuthorizationServerContract(Resource): # pylint: disable=too-many-instanc :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar description: Description of the authorization server. Can contain HTML formatting tags. - :vartype description: str - :ivar authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be - always present. POST is optional. - :vartype authorization_methods: list[str or - ~azure.mgmt.apimanagement.models.AuthorizationMethod] - :ivar client_authentication_method: Method of authentication supported by the token endpoint of - this authorization server. Possible values are Basic and/or Body. When Body is specified, - client credentials and other parameters are passed within the request body in the - application/x-www-form-urlencoded format. - :vartype client_authentication_method: list[str or - ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] - :ivar token_body_parameters: Additional parameters required by the token endpoint of this - authorization server represented as an array of JSON objects with name and value string - properties, i.e. {"name" : "name value", "value": "a value"}. - :vartype token_body_parameters: - list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] - :ivar token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. - :vartype token_endpoint: str - :ivar support_state: If true, authorization server will include state parameter from the - authorization request to its response. Client may use state parameter to raise protocol - security. - :vartype support_state: bool - :ivar default_scope: Access token scope that is going to be requested by default. Can be - overridden at the API level. Should be provided in the form of a string containing - space-delimited values. - :vartype default_scope: str - :ivar bearer_token_sending_methods: Specifies the mechanism by which access token is passed to - the API. - :vartype bearer_token_sending_methods: list[str or - ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] - :ivar resource_owner_username: Can be optionally specified when resource owner password grant - type is supported by this authorization server. Default resource owner username. - :vartype resource_owner_username: str - :ivar resource_owner_password: Can be optionally specified when resource owner password grant - type is supported by this authorization server. Default resource owner password. - :vartype resource_owner_password: str - :ivar display_name: User-friendly authorization server name. - :vartype display_name: str - :ivar client_registration_endpoint: Optional reference to a page where client or app - registration for this authorization server is performed. Contains absolute URL to entity being - referenced. - :vartype client_registration_endpoint: str - :ivar authorization_endpoint: OAuth authorization endpoint. See - http://tools.ietf.org/html/rfc6749#section-3.2. - :vartype authorization_endpoint: str - :ivar grant_types: Form of an authorization grant, which the client uses to request the access - token. - :vartype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] - :ivar client_id: Client or app id registered with this authorization server. - :vartype client_id: str - :ivar client_secret: Client or app secret registered with this authorization server. This - property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the - value. - :vartype client_secret: str + :ivar tenant_id: The Tenant Id. + :vartype tenant_id: str + :ivar object_id: The Object Id. + :vartype object_id: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "display_name": {"max_length": 50, "min_length": 1}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "authorization_methods": {"key": "properties.authorizationMethods", "type": "[str]"}, - "client_authentication_method": {"key": "properties.clientAuthenticationMethod", "type": "[str]"}, - "token_body_parameters": {"key": "properties.tokenBodyParameters", "type": "[TokenBodyParameterContract]"}, - "token_endpoint": {"key": "properties.tokenEndpoint", "type": "str"}, - "support_state": {"key": "properties.supportState", "type": "bool"}, - "default_scope": {"key": "properties.defaultScope", "type": "str"}, - "bearer_token_sending_methods": {"key": "properties.bearerTokenSendingMethods", "type": "[str]"}, - "resource_owner_username": {"key": "properties.resourceOwnerUsername", "type": "str"}, - "resource_owner_password": {"key": "properties.resourceOwnerPassword", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "client_registration_endpoint": {"key": "properties.clientRegistrationEndpoint", "type": "str"}, - "authorization_endpoint": {"key": "properties.authorizationEndpoint", "type": "str"}, - "grant_types": {"key": "properties.grantTypes", "type": "[str]"}, - "client_id": {"key": "properties.clientId", "type": "str"}, - "client_secret": {"key": "properties.clientSecret", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "object_id": {"key": "properties.objectId", "type": "str"}, } - def __init__( - self, - *, - description: Optional[str] = None, - authorization_methods: Optional[List[Union[str, "_models.AuthorizationMethod"]]] = None, - client_authentication_method: Optional[List[Union[str, "_models.ClientAuthenticationMethod"]]] = None, - token_body_parameters: Optional[List["_models.TokenBodyParameterContract"]] = None, - token_endpoint: Optional[str] = None, - support_state: Optional[bool] = None, - default_scope: Optional[str] = None, - bearer_token_sending_methods: Optional[List[Union[str, "_models.BearerTokenSendingMethod"]]] = None, - resource_owner_username: Optional[str] = None, - resource_owner_password: Optional[str] = None, - display_name: Optional[str] = None, - client_registration_endpoint: Optional[str] = None, - authorization_endpoint: Optional[str] = None, - grant_types: Optional[List[Union[str, "_models.GrantType"]]] = None, - client_id: Optional[str] = None, - client_secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, tenant_id: Optional[str] = None, object_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword description: Description of the authorization server. Can contain HTML formatting - tags. - :paramtype description: str - :keyword authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be - always present. POST is optional. - :paramtype authorization_methods: list[str or - ~azure.mgmt.apimanagement.models.AuthorizationMethod] - :keyword client_authentication_method: Method of authentication supported by the token endpoint - of this authorization server. Possible values are Basic and/or Body. When Body is specified, - client credentials and other parameters are passed within the request body in the - application/x-www-form-urlencoded format. - :paramtype client_authentication_method: list[str or - ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] - :keyword token_body_parameters: Additional parameters required by the token endpoint of this - authorization server represented as an array of JSON objects with name and value string - properties, i.e. {"name" : "name value", "value": "a value"}. - :paramtype token_body_parameters: - list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] - :keyword token_endpoint: OAuth token endpoint. Contains absolute URI to entity being - referenced. - :paramtype token_endpoint: str - :keyword support_state: If true, authorization server will include state parameter from the - authorization request to its response. Client may use state parameter to raise protocol - security. - :paramtype support_state: bool - :keyword default_scope: Access token scope that is going to be requested by default. Can be - overridden at the API level. Should be provided in the form of a string containing - space-delimited values. - :paramtype default_scope: str - :keyword bearer_token_sending_methods: Specifies the mechanism by which access token is passed - to the API. - :paramtype bearer_token_sending_methods: list[str or - ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] - :keyword resource_owner_username: Can be optionally specified when resource owner password - grant type is supported by this authorization server. Default resource owner username. - :paramtype resource_owner_username: str - :keyword resource_owner_password: Can be optionally specified when resource owner password - grant type is supported by this authorization server. Default resource owner password. - :paramtype resource_owner_password: str - :keyword display_name: User-friendly authorization server name. - :paramtype display_name: str - :keyword client_registration_endpoint: Optional reference to a page where client or app - registration for this authorization server is performed. Contains absolute URL to entity being - referenced. - :paramtype client_registration_endpoint: str - :keyword authorization_endpoint: OAuth authorization endpoint. See - http://tools.ietf.org/html/rfc6749#section-3.2. - :paramtype authorization_endpoint: str - :keyword grant_types: Form of an authorization grant, which the client uses to request the - access token. - :paramtype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] - :keyword client_id: Client or app id registered with this authorization server. - :paramtype client_id: str - :keyword client_secret: Client or app secret registered with this authorization server. This - property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the - value. - :paramtype client_secret: str + :keyword tenant_id: The Tenant Id. + :paramtype tenant_id: str + :keyword object_id: The Object Id. + :paramtype object_id: str """ super().__init__(**kwargs) - self.description = description - self.authorization_methods = authorization_methods - self.client_authentication_method = client_authentication_method - self.token_body_parameters = token_body_parameters - self.token_endpoint = token_endpoint - self.support_state = support_state - self.default_scope = default_scope - self.bearer_token_sending_methods = bearer_token_sending_methods - self.resource_owner_username = resource_owner_username - self.resource_owner_password = resource_owner_password - self.display_name = display_name - self.client_registration_endpoint = client_registration_endpoint - self.authorization_endpoint = authorization_endpoint - self.grant_types = grant_types - self.client_id = client_id - self.client_secret = client_secret + self.tenant_id = tenant_id + self.object_id = object_id -class AuthorizationServerContractBaseProperties(_serialization.Model): - """External OAuth authorization server Update settings contract. +class AuthorizationCollection(_serialization.Model): + """Paged Authorization list representation. - :ivar description: Description of the authorization server. Can contain HTML formatting tags. - :vartype description: str - :ivar authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be - always present. POST is optional. - :vartype authorization_methods: list[str or - ~azure.mgmt.apimanagement.models.AuthorizationMethod] - :ivar client_authentication_method: Method of authentication supported by the token endpoint of - this authorization server. Possible values are Basic and/or Body. When Body is specified, - client credentials and other parameters are passed within the request body in the - application/x-www-form-urlencoded format. - :vartype client_authentication_method: list[str or - ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] - :ivar token_body_parameters: Additional parameters required by the token endpoint of this - authorization server represented as an array of JSON objects with name and value string - properties, i.e. {"name" : "name value", "value": "a value"}. - :vartype token_body_parameters: - list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] - :ivar token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. - :vartype token_endpoint: str - :ivar support_state: If true, authorization server will include state parameter from the - authorization request to its response. Client may use state parameter to raise protocol - security. - :vartype support_state: bool - :ivar default_scope: Access token scope that is going to be requested by default. Can be - overridden at the API level. Should be provided in the form of a string containing - space-delimited values. - :vartype default_scope: str - :ivar bearer_token_sending_methods: Specifies the mechanism by which access token is passed to - the API. - :vartype bearer_token_sending_methods: list[str or - ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] - :ivar resource_owner_username: Can be optionally specified when resource owner password grant - type is supported by this authorization server. Default resource owner username. - :vartype resource_owner_username: str - :ivar resource_owner_password: Can be optionally specified when resource owner password grant - type is supported by this authorization server. Default resource owner password. - :vartype resource_owner_password: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.AuthorizationContract] + :ivar count: Total record count number across all pages. + :vartype count: int + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { - "description": {"key": "description", "type": "str"}, - "authorization_methods": {"key": "authorizationMethods", "type": "[str]"}, - "client_authentication_method": {"key": "clientAuthenticationMethod", "type": "[str]"}, + "value": {"key": "value", "type": "[AuthorizationContract]"}, + "count": {"key": "count", "type": "int"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.AuthorizationContract"]] = None, + count: Optional[int] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.AuthorizationContract] + :keyword count: Total record count number across all pages. + :paramtype count: int + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.count = count + self.next_link = next_link + + +class AuthorizationConfirmConsentCodeRequestContract(_serialization.Model): + """Authorization confirm consent code request contract. + + :ivar consent_code: The consent code from the authorization server after authorizing and + consenting. + :vartype consent_code: str + """ + + _attribute_map = { + "consent_code": {"key": "consentCode", "type": "str"}, + } + + def __init__(self, *, consent_code: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword consent_code: The consent code from the authorization server after authorizing and + consenting. + :paramtype consent_code: str + """ + super().__init__(**kwargs) + self.consent_code = consent_code + + +class AuthorizationContract(ProxyResource): + """Authorization contract. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar authorization_type: Authorization type options. "OAuth2" + :vartype authorization_type: str or ~azure.mgmt.apimanagement.models.AuthorizationType + :ivar o_auth2_grant_type: OAuth2 grant type options. Known values are: "AuthorizationCode" and + "ClientCredentials". + :vartype o_auth2_grant_type: str or ~azure.mgmt.apimanagement.models.OAuth2GrantType + :ivar parameters: Authorization parameters. + :vartype parameters: dict[str, str] + :ivar error: Authorization error details. + :vartype error: ~azure.mgmt.apimanagement.models.AuthorizationError + :ivar status: Status of the Authorization. + :vartype status: 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"}, + "authorization_type": {"key": "properties.authorizationType", "type": "str"}, + "o_auth2_grant_type": {"key": "properties.oauth2grantType", "type": "str"}, + "parameters": {"key": "properties.parameters", "type": "{str}"}, + "error": {"key": "properties.error", "type": "AuthorizationError"}, + "status": {"key": "properties.status", "type": "str"}, + } + + def __init__( + self, + *, + authorization_type: Optional[Union[str, "_models.AuthorizationType"]] = None, + o_auth2_grant_type: Optional[Union[str, "_models.OAuth2GrantType"]] = None, + parameters: Optional[Dict[str, str]] = None, + error: Optional["_models.AuthorizationError"] = None, + status: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword authorization_type: Authorization type options. "OAuth2" + :paramtype authorization_type: str or ~azure.mgmt.apimanagement.models.AuthorizationType + :keyword o_auth2_grant_type: OAuth2 grant type options. Known values are: "AuthorizationCode" + and "ClientCredentials". + :paramtype o_auth2_grant_type: str or ~azure.mgmt.apimanagement.models.OAuth2GrantType + :keyword parameters: Authorization parameters. + :paramtype parameters: dict[str, str] + :keyword error: Authorization error details. + :paramtype error: ~azure.mgmt.apimanagement.models.AuthorizationError + :keyword status: Status of the Authorization. + :paramtype status: str + """ + super().__init__(**kwargs) + self.authorization_type = authorization_type + self.o_auth2_grant_type = o_auth2_grant_type + self.parameters = parameters + self.error = error + self.status = status + + +class AuthorizationError(_serialization.Model): + """Authorization error details. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message. + :vartype message: str + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: Error message. + :paramtype message: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + + +class AuthorizationLoginRequestContract(_serialization.Model): + """Authorization login request contract. + + :ivar post_login_redirect_url: The redirect URL after login has completed. + :vartype post_login_redirect_url: str + """ + + _attribute_map = { + "post_login_redirect_url": {"key": "postLoginRedirectUrl", "type": "str"}, + } + + def __init__(self, *, post_login_redirect_url: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword post_login_redirect_url: The redirect URL after login has completed. + :paramtype post_login_redirect_url: str + """ + super().__init__(**kwargs) + self.post_login_redirect_url = post_login_redirect_url + + +class AuthorizationLoginResponseContract(_serialization.Model): + """Authorization login response contract. + + :ivar login_link: The login link. + :vartype login_link: str + """ + + _attribute_map = { + "login_link": {"key": "loginLink", "type": "str"}, + } + + def __init__(self, *, login_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword login_link: The login link. + :paramtype login_link: str + """ + super().__init__(**kwargs) + self.login_link = login_link + + +class AuthorizationProviderCollection(_serialization.Model): + """Paged Authorization Provider list representation. + + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.AuthorizationProviderContract] + :ivar next_link: Next page link if any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[AuthorizationProviderContract]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.AuthorizationProviderContract"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.AuthorizationProviderContract] + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AuthorizationProviderContract(ProxyResource): + """Authorization Provider contract. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar display_name: Authorization Provider name. Must be 1 to 300 characters long. + :vartype display_name: str + :ivar identity_provider: Identity provider name. Must be 1 to 300 characters long. + :vartype identity_provider: str + :ivar oauth2: OAuth2 settings. + :vartype oauth2: ~azure.mgmt.apimanagement.models.AuthorizationProviderOAuth2Settings + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "display_name": {"max_length": 300, "min_length": 1}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "identity_provider": {"key": "properties.identityProvider", "type": "str"}, + "oauth2": {"key": "properties.oauth2", "type": "AuthorizationProviderOAuth2Settings"}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + identity_provider: Optional[str] = None, + oauth2: Optional["_models.AuthorizationProviderOAuth2Settings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword display_name: Authorization Provider name. Must be 1 to 300 characters long. + :paramtype display_name: str + :keyword identity_provider: Identity provider name. Must be 1 to 300 characters long. + :paramtype identity_provider: str + :keyword oauth2: OAuth2 settings. + :paramtype oauth2: ~azure.mgmt.apimanagement.models.AuthorizationProviderOAuth2Settings + """ + super().__init__(**kwargs) + self.display_name = display_name + self.identity_provider = identity_provider + self.oauth2 = oauth2 + + +class AuthorizationProviderOAuth2GrantTypes(_serialization.Model): + """Authorization Provider oauth2 grant types settings. + + :ivar authorization_code: OAuth2 authorization code grant parameters. + :vartype authorization_code: dict[str, str] + :ivar client_credentials: OAuth2 client credential grant parameters. + :vartype client_credentials: dict[str, str] + """ + + _attribute_map = { + "authorization_code": {"key": "authorizationCode", "type": "{str}"}, + "client_credentials": {"key": "clientCredentials", "type": "{str}"}, + } + + def __init__( + self, + *, + authorization_code: Optional[Dict[str, str]] = None, + client_credentials: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword authorization_code: OAuth2 authorization code grant parameters. + :paramtype authorization_code: dict[str, str] + :keyword client_credentials: OAuth2 client credential grant parameters. + :paramtype client_credentials: dict[str, str] + """ + super().__init__(**kwargs) + self.authorization_code = authorization_code + self.client_credentials = client_credentials + + +class AuthorizationProviderOAuth2Settings(_serialization.Model): + """OAuth2 settings details. + + :ivar redirect_url: Redirect URL to be set in the OAuth application. + :vartype redirect_url: str + :ivar grant_types: OAuth2 settings. + :vartype grant_types: ~azure.mgmt.apimanagement.models.AuthorizationProviderOAuth2GrantTypes + """ + + _attribute_map = { + "redirect_url": {"key": "redirectUrl", "type": "str"}, + "grant_types": {"key": "grantTypes", "type": "AuthorizationProviderOAuth2GrantTypes"}, + } + + def __init__( + self, + *, + redirect_url: Optional[str] = None, + grant_types: Optional["_models.AuthorizationProviderOAuth2GrantTypes"] = None, + **kwargs: Any + ) -> None: + """ + :keyword redirect_url: Redirect URL to be set in the OAuth application. + :paramtype redirect_url: str + :keyword grant_types: OAuth2 settings. + :paramtype grant_types: ~azure.mgmt.apimanagement.models.AuthorizationProviderOAuth2GrantTypes + """ + super().__init__(**kwargs) + self.redirect_url = redirect_url + self.grant_types = grant_types + + +class AuthorizationServerCollection(_serialization.Model): + """Paged OAuth2 Authorization Servers list representation. + + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.AuthorizationServerContract] + :ivar count: Total record count number across all pages. + :vartype count: int + :ivar next_link: Next page link if any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[AuthorizationServerContract]"}, + "count": {"key": "count", "type": "int"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.AuthorizationServerContract"]] = None, + count: Optional[int] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.AuthorizationServerContract] + :keyword count: Total record count number across all pages. + :paramtype count: int + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.count = count + self.next_link = next_link + + +class AuthorizationServerContract(ProxyResource): # pylint: disable=too-many-instance-attributes + """External OAuth authorization server settings. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar description: Description of the authorization server. Can contain HTML formatting tags. + :vartype description: str + :ivar authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + always present. POST is optional. + :vartype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :ivar client_authentication_method: Method of authentication supported by the token endpoint of + this authorization server. Possible values are Basic and/or Body. When Body is specified, + client credentials and other parameters are passed within the request body in the + application/x-www-form-urlencoded format. + :vartype client_authentication_method: list[str or + ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] + :ivar token_body_parameters: Additional parameters required by the token endpoint of this + authorization server represented as an array of JSON objects with name and value string + properties, i.e. {"name" : "name value", "value": "a value"}. + :vartype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :ivar token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. + :vartype token_endpoint: str + :ivar support_state: If true, authorization server will include state parameter from the + authorization request to its response. Client may use state parameter to raise protocol + security. + :vartype support_state: bool + :ivar default_scope: Access token scope that is going to be requested by default. Can be + overridden at the API level. Should be provided in the form of a string containing + space-delimited values. + :vartype default_scope: str + :ivar bearer_token_sending_methods: Specifies the mechanism by which access token is passed to + the API. + :vartype bearer_token_sending_methods: list[str or + ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] + :ivar resource_owner_username: Can be optionally specified when resource owner password grant + type is supported by this authorization server. Default resource owner username. + :vartype resource_owner_username: str + :ivar resource_owner_password: Can be optionally specified when resource owner password grant + type is supported by this authorization server. Default resource owner password. + :vartype resource_owner_password: str + :ivar display_name: User-friendly authorization server name. + :vartype display_name: str + :ivar use_in_test_console: If true, the authorization server may be used in the developer + portal test console. True by default if no value is provided. + :vartype use_in_test_console: bool + :ivar use_in_api_documentation: If true, the authorization server will be used in the API + documentation in the developer portal. False by default if no value is provided. + :vartype use_in_api_documentation: bool + :ivar client_registration_endpoint: Optional reference to a page where client or app + registration for this authorization server is performed. Contains absolute URL to entity being + referenced. + :vartype client_registration_endpoint: str + :ivar authorization_endpoint: OAuth authorization endpoint. See + http://tools.ietf.org/html/rfc6749#section-3.2. + :vartype authorization_endpoint: str + :ivar grant_types: Form of an authorization grant, which the client uses to request the access + token. + :vartype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] + :ivar client_id: Client or app id registered with this authorization server. + :vartype client_id: str + :ivar client_secret: Client or app secret registered with this authorization server. This + property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the + value. + :vartype client_secret: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "display_name": {"max_length": 50, "min_length": 1}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "authorization_methods": {"key": "properties.authorizationMethods", "type": "[str]"}, + "client_authentication_method": {"key": "properties.clientAuthenticationMethod", "type": "[str]"}, + "token_body_parameters": {"key": "properties.tokenBodyParameters", "type": "[TokenBodyParameterContract]"}, + "token_endpoint": {"key": "properties.tokenEndpoint", "type": "str"}, + "support_state": {"key": "properties.supportState", "type": "bool"}, + "default_scope": {"key": "properties.defaultScope", "type": "str"}, + "bearer_token_sending_methods": {"key": "properties.bearerTokenSendingMethods", "type": "[str]"}, + "resource_owner_username": {"key": "properties.resourceOwnerUsername", "type": "str"}, + "resource_owner_password": {"key": "properties.resourceOwnerPassword", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "use_in_test_console": {"key": "properties.useInTestConsole", "type": "bool"}, + "use_in_api_documentation": {"key": "properties.useInApiDocumentation", "type": "bool"}, + "client_registration_endpoint": {"key": "properties.clientRegistrationEndpoint", "type": "str"}, + "authorization_endpoint": {"key": "properties.authorizationEndpoint", "type": "str"}, + "grant_types": {"key": "properties.grantTypes", "type": "[str]"}, + "client_id": {"key": "properties.clientId", "type": "str"}, + "client_secret": {"key": "properties.clientSecret", "type": "str"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + authorization_methods: Optional[List[Union[str, "_models.AuthorizationMethod"]]] = None, + client_authentication_method: Optional[List[Union[str, "_models.ClientAuthenticationMethod"]]] = None, + token_body_parameters: Optional[List["_models.TokenBodyParameterContract"]] = None, + token_endpoint: Optional[str] = None, + support_state: Optional[bool] = None, + default_scope: Optional[str] = None, + bearer_token_sending_methods: Optional[List[Union[str, "_models.BearerTokenSendingMethod"]]] = None, + resource_owner_username: Optional[str] = None, + resource_owner_password: Optional[str] = None, + display_name: Optional[str] = None, + use_in_test_console: Optional[bool] = None, + use_in_api_documentation: Optional[bool] = None, + client_registration_endpoint: Optional[str] = None, + authorization_endpoint: Optional[str] = None, + grant_types: Optional[List[Union[str, "_models.GrantType"]]] = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: Description of the authorization server. Can contain HTML formatting + tags. + :paramtype description: str + :keyword authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + always present. POST is optional. + :paramtype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :keyword client_authentication_method: Method of authentication supported by the token endpoint + of this authorization server. Possible values are Basic and/or Body. When Body is specified, + client credentials and other parameters are passed within the request body in the + application/x-www-form-urlencoded format. + :paramtype client_authentication_method: list[str or + ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] + :keyword token_body_parameters: Additional parameters required by the token endpoint of this + authorization server represented as an array of JSON objects with name and value string + properties, i.e. {"name" : "name value", "value": "a value"}. + :paramtype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :keyword token_endpoint: OAuth token endpoint. Contains absolute URI to entity being + referenced. + :paramtype token_endpoint: str + :keyword support_state: If true, authorization server will include state parameter from the + authorization request to its response. Client may use state parameter to raise protocol + security. + :paramtype support_state: bool + :keyword default_scope: Access token scope that is going to be requested by default. Can be + overridden at the API level. Should be provided in the form of a string containing + space-delimited values. + :paramtype default_scope: str + :keyword bearer_token_sending_methods: Specifies the mechanism by which access token is passed + to the API. + :paramtype bearer_token_sending_methods: list[str or + ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] + :keyword resource_owner_username: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner username. + :paramtype resource_owner_username: str + :keyword resource_owner_password: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner password. + :paramtype resource_owner_password: str + :keyword display_name: User-friendly authorization server name. + :paramtype display_name: str + :keyword use_in_test_console: If true, the authorization server may be used in the developer + portal test console. True by default if no value is provided. + :paramtype use_in_test_console: bool + :keyword use_in_api_documentation: If true, the authorization server will be used in the API + documentation in the developer portal. False by default if no value is provided. + :paramtype use_in_api_documentation: bool + :keyword client_registration_endpoint: Optional reference to a page where client or app + registration for this authorization server is performed. Contains absolute URL to entity being + referenced. + :paramtype client_registration_endpoint: str + :keyword authorization_endpoint: OAuth authorization endpoint. See + http://tools.ietf.org/html/rfc6749#section-3.2. + :paramtype authorization_endpoint: str + :keyword grant_types: Form of an authorization grant, which the client uses to request the + access token. + :paramtype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] + :keyword client_id: Client or app id registered with this authorization server. + :paramtype client_id: str + :keyword client_secret: Client or app secret registered with this authorization server. This + property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the + value. + :paramtype client_secret: str + """ + super().__init__(**kwargs) + self.description = description + self.authorization_methods = authorization_methods + self.client_authentication_method = client_authentication_method + self.token_body_parameters = token_body_parameters + self.token_endpoint = token_endpoint + self.support_state = support_state + self.default_scope = default_scope + self.bearer_token_sending_methods = bearer_token_sending_methods + self.resource_owner_username = resource_owner_username + self.resource_owner_password = resource_owner_password + self.display_name = display_name + self.use_in_test_console = use_in_test_console + self.use_in_api_documentation = use_in_api_documentation + self.client_registration_endpoint = client_registration_endpoint + self.authorization_endpoint = authorization_endpoint + self.grant_types = grant_types + self.client_id = client_id + self.client_secret = client_secret + + +class AuthorizationServerContractBaseProperties(_serialization.Model): + """External OAuth authorization server Update settings contract. + + :ivar description: Description of the authorization server. Can contain HTML formatting tags. + :vartype description: str + :ivar authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + always present. POST is optional. + :vartype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :ivar client_authentication_method: Method of authentication supported by the token endpoint of + this authorization server. Possible values are Basic and/or Body. When Body is specified, + client credentials and other parameters are passed within the request body in the + application/x-www-form-urlencoded format. + :vartype client_authentication_method: list[str or + ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] + :ivar token_body_parameters: Additional parameters required by the token endpoint of this + authorization server represented as an array of JSON objects with name and value string + properties, i.e. {"name" : "name value", "value": "a value"}. + :vartype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :ivar token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. + :vartype token_endpoint: str + :ivar support_state: If true, authorization server will include state parameter from the + authorization request to its response. Client may use state parameter to raise protocol + security. + :vartype support_state: bool + :ivar default_scope: Access token scope that is going to be requested by default. Can be + overridden at the API level. Should be provided in the form of a string containing + space-delimited values. + :vartype default_scope: str + :ivar bearer_token_sending_methods: Specifies the mechanism by which access token is passed to + the API. + :vartype bearer_token_sending_methods: list[str or + ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] + :ivar resource_owner_username: Can be optionally specified when resource owner password grant + type is supported by this authorization server. Default resource owner username. + :vartype resource_owner_username: str + :ivar resource_owner_password: Can be optionally specified when resource owner password grant + type is supported by this authorization server. Default resource owner password. + :vartype resource_owner_password: str + """ + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "authorization_methods": {"key": "authorizationMethods", "type": "[str]"}, + "client_authentication_method": {"key": "clientAuthenticationMethod", "type": "[str]"}, "token_body_parameters": {"key": "tokenBodyParameters", "type": "[TokenBodyParameterContract]"}, "token_endpoint": {"key": "tokenEndpoint", "type": "str"}, "support_state": {"key": "supportState", "type": "bool"}, @@ -5582,8 +6224,8 @@ def __init__( bearer_token_sending_methods: Optional[List[Union[str, "_models.BearerTokenSendingMethod"]]] = None, resource_owner_username: Optional[str] = None, resource_owner_password: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of the authorization server. Can contain HTML formatting tags. @@ -5684,6 +6326,12 @@ class AuthorizationServerContractProperties( :vartype resource_owner_password: str :ivar display_name: User-friendly authorization server name. Required. :vartype display_name: str + :ivar use_in_test_console: If true, the authorization server may be used in the developer + portal test console. True by default if no value is provided. + :vartype use_in_test_console: bool + :ivar use_in_api_documentation: If true, the authorization server will be used in the API + documentation in the developer portal. False by default if no value is provided. + :vartype use_in_api_documentation: bool :ivar client_registration_endpoint: Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. Required. @@ -5722,6 +6370,8 @@ class AuthorizationServerContractProperties( "resource_owner_username": {"key": "resourceOwnerUsername", "type": "str"}, "resource_owner_password": {"key": "resourceOwnerPassword", "type": "str"}, "display_name": {"key": "displayName", "type": "str"}, + "use_in_test_console": {"key": "useInTestConsole", "type": "bool"}, + "use_in_api_documentation": {"key": "useInApiDocumentation", "type": "bool"}, "client_registration_endpoint": {"key": "clientRegistrationEndpoint", "type": "str"}, "authorization_endpoint": {"key": "authorizationEndpoint", "type": "str"}, "grant_types": {"key": "grantTypes", "type": "[str]"}, @@ -5747,9 +6397,11 @@ def __init__( bearer_token_sending_methods: Optional[List[Union[str, "_models.BearerTokenSendingMethod"]]] = None, resource_owner_username: Optional[str] = None, resource_owner_password: Optional[str] = None, + use_in_test_console: Optional[bool] = None, + use_in_api_documentation: Optional[bool] = None, client_secret: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of the authorization server. Can contain HTML formatting tags. @@ -5792,6 +6444,12 @@ def __init__( :paramtype resource_owner_password: str :keyword display_name: User-friendly authorization server name. Required. :paramtype display_name: str + :keyword use_in_test_console: If true, the authorization server may be used in the developer + portal test console. True by default if no value is provided. + :paramtype use_in_test_console: bool + :keyword use_in_api_documentation: If true, the authorization server will be used in the API + documentation in the developer portal. False by default if no value is provided. + :paramtype use_in_api_documentation: bool :keyword client_registration_endpoint: Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. Required. @@ -5823,6 +6481,8 @@ def __init__( **kwargs ) self.display_name = display_name + self.use_in_test_console = use_in_test_console + self.use_in_api_documentation = use_in_api_documentation self.client_registration_endpoint = client_registration_endpoint self.authorization_endpoint = authorization_endpoint self.grant_types = grant_types @@ -5855,8 +6515,8 @@ def __init__( client_secret: Optional[str] = None, resource_owner_username: Optional[str] = None, resource_owner_password: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword client_secret: oAuth Authorization Server Secrets. :paramtype client_secret: str @@ -5873,7 +6533,7 @@ def __init__( self.resource_owner_password = resource_owner_password -class AuthorizationServerUpdateContract(Resource): # pylint: disable=too-many-instance-attributes +class AuthorizationServerUpdateContract(ProxyResource): # pylint: disable=too-many-instance-attributes """External OAuth authorization server settings. Variables are only populated by the server, and will be ignored when sending a request. @@ -5925,6 +6585,12 @@ class AuthorizationServerUpdateContract(Resource): # pylint: disable=too-many-i :vartype resource_owner_password: str :ivar display_name: User-friendly authorization server name. :vartype display_name: str + :ivar use_in_test_console: If true, the authorization server may be used in the developer + portal test console. True by default if no value is provided. + :vartype use_in_test_console: bool + :ivar use_in_api_documentation: If true, the authorization server will be used in the API + documentation in the developer portal. False by default if no value is provided. + :vartype use_in_api_documentation: bool :ivar client_registration_endpoint: Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. @@ -5965,6 +6631,8 @@ class AuthorizationServerUpdateContract(Resource): # pylint: disable=too-many-i "resource_owner_username": {"key": "properties.resourceOwnerUsername", "type": "str"}, "resource_owner_password": {"key": "properties.resourceOwnerPassword", "type": "str"}, "display_name": {"key": "properties.displayName", "type": "str"}, + "use_in_test_console": {"key": "properties.useInTestConsole", "type": "bool"}, + "use_in_api_documentation": {"key": "properties.useInApiDocumentation", "type": "bool"}, "client_registration_endpoint": {"key": "properties.clientRegistrationEndpoint", "type": "str"}, "authorization_endpoint": {"key": "properties.authorizationEndpoint", "type": "str"}, "grant_types": {"key": "properties.grantTypes", "type": "[str]"}, @@ -5986,13 +6654,15 @@ def __init__( resource_owner_username: Optional[str] = None, resource_owner_password: Optional[str] = None, display_name: Optional[str] = None, + use_in_test_console: Optional[bool] = None, + use_in_api_documentation: Optional[bool] = None, client_registration_endpoint: Optional[str] = None, authorization_endpoint: Optional[str] = None, grant_types: Optional[List[Union[str, "_models.GrantType"]]] = None, client_id: Optional[str] = None, client_secret: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of the authorization server. Can contain HTML formatting tags. @@ -6035,6 +6705,12 @@ def __init__( :paramtype resource_owner_password: str :keyword display_name: User-friendly authorization server name. :paramtype display_name: str + :keyword use_in_test_console: If true, the authorization server may be used in the developer + portal test console. True by default if no value is provided. + :paramtype use_in_test_console: bool + :keyword use_in_api_documentation: If true, the authorization server will be used in the API + documentation in the developer portal. False by default if no value is provided. + :paramtype use_in_api_documentation: bool :keyword client_registration_endpoint: Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. @@ -6064,6 +6740,8 @@ def __init__( self.resource_owner_username = resource_owner_username self.resource_owner_password = resource_owner_password self.display_name = display_name + self.use_in_test_console = use_in_test_console + self.use_in_api_documentation = use_in_api_documentation self.client_registration_endpoint = client_registration_endpoint self.authorization_endpoint = authorization_endpoint self.grant_types = grant_types @@ -6115,6 +6793,12 @@ class AuthorizationServerUpdateContractProperties( :vartype resource_owner_password: str :ivar display_name: User-friendly authorization server name. :vartype display_name: str + :ivar use_in_test_console: If true, the authorization server may be used in the developer + portal test console. True by default if no value is provided. + :vartype use_in_test_console: bool + :ivar use_in_api_documentation: If true, the authorization server will be used in the API + documentation in the developer portal. False by default if no value is provided. + :vartype use_in_api_documentation: bool :ivar client_registration_endpoint: Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. @@ -6149,6 +6833,8 @@ class AuthorizationServerUpdateContractProperties( "resource_owner_username": {"key": "resourceOwnerUsername", "type": "str"}, "resource_owner_password": {"key": "resourceOwnerPassword", "type": "str"}, "display_name": {"key": "displayName", "type": "str"}, + "use_in_test_console": {"key": "useInTestConsole", "type": "bool"}, + "use_in_api_documentation": {"key": "useInApiDocumentation", "type": "bool"}, "client_registration_endpoint": {"key": "clientRegistrationEndpoint", "type": "str"}, "authorization_endpoint": {"key": "authorizationEndpoint", "type": "str"}, "grant_types": {"key": "grantTypes", "type": "[str]"}, @@ -6170,13 +6856,15 @@ def __init__( resource_owner_username: Optional[str] = None, resource_owner_password: Optional[str] = None, display_name: Optional[str] = None, + use_in_test_console: Optional[bool] = None, + use_in_api_documentation: Optional[bool] = None, client_registration_endpoint: Optional[str] = None, authorization_endpoint: Optional[str] = None, grant_types: Optional[List[Union[str, "_models.GrantType"]]] = None, client_id: Optional[str] = None, client_secret: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of the authorization server. Can contain HTML formatting tags. @@ -6219,6 +6907,12 @@ def __init__( :paramtype resource_owner_password: str :keyword display_name: User-friendly authorization server name. :paramtype display_name: str + :keyword use_in_test_console: If true, the authorization server may be used in the developer + portal test console. True by default if no value is provided. + :paramtype use_in_test_console: bool + :keyword use_in_api_documentation: If true, the authorization server will be used in the API + documentation in the developer portal. False by default if no value is provided. + :paramtype use_in_api_documentation: bool :keyword client_registration_endpoint: Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. @@ -6250,6 +6944,8 @@ def __init__( **kwargs ) self.display_name = display_name + self.use_in_test_console = use_in_test_console + self.use_in_api_documentation = use_in_api_documentation self.client_registration_endpoint = client_registration_endpoint self.authorization_endpoint = authorization_endpoint self.grant_types = grant_types @@ -6278,7 +6974,7 @@ class BackendAuthorizationHeaderCredentials(_serialization.Model): "parameter": {"key": "parameter", "type": "str"}, } - def __init__(self, *, scheme: str, parameter: str, **kwargs): + def __init__(self, *, scheme: str, parameter: str, **kwargs: Any) -> None: """ :keyword scheme: Authentication Scheme name. Required. :paramtype scheme: str @@ -6297,17 +6993,19 @@ class BackendBaseParameters(_serialization.Model): :vartype title: str :ivar description: Backend Description. :vartype description: str - :ivar resource_id: Management Uri of the Resource in External System. This url can be the Arm + :ivar resource_id: Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. :vartype resource_id: str :ivar properties: Backend Properties contract. :vartype properties: ~azure.mgmt.apimanagement.models.BackendProperties :ivar credentials: Backend Credentials Contract Properties. :vartype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :ivar proxy: Backend Proxy Contract Properties. + :ivar proxy: Backend gateway Contract Properties. :vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract :ivar tls: Backend TLS Properties. :vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :ivar circuit_breaker: Backend Circuit Breaker Configuration. + :vartype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker """ _validation = { @@ -6324,6 +7022,7 @@ class BackendBaseParameters(_serialization.Model): "credentials": {"key": "credentials", "type": "BackendCredentialsContract"}, "proxy": {"key": "proxy", "type": "BackendProxyContract"}, "tls": {"key": "tls", "type": "BackendTlsProperties"}, + "circuit_breaker": {"key": "circuitBreaker", "type": "BackendCircuitBreaker"}, } def __init__( @@ -6336,24 +7035,27 @@ def __init__( credentials: Optional["_models.BackendCredentialsContract"] = None, proxy: Optional["_models.BackendProxyContract"] = None, tls: Optional["_models.BackendTlsProperties"] = None, - **kwargs - ): + circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None, + **kwargs: Any + ) -> None: """ :keyword title: Backend Title. :paramtype title: str :keyword description: Backend Description. :paramtype description: str - :keyword resource_id: Management Uri of the Resource in External System. This url can be the + :keyword resource_id: Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. :paramtype resource_id: str :keyword properties: Backend Properties contract. :paramtype properties: ~azure.mgmt.apimanagement.models.BackendProperties :keyword credentials: Backend Credentials Contract Properties. :paramtype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :keyword proxy: Backend Proxy Contract Properties. + :keyword proxy: Backend gateway Contract Properties. :paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract :keyword tls: Backend TLS Properties. :paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :keyword circuit_breaker: Backend Circuit Breaker Configuration. + :paramtype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker """ super().__init__(**kwargs) self.title = title @@ -6363,6 +7065,31 @@ def __init__( self.credentials = credentials self.proxy = proxy self.tls = tls + self.circuit_breaker = circuit_breaker + + +class BackendCircuitBreaker(_serialization.Model): + """The configuration of the backend circuit breaker. + + :ivar rules: The rules for tripping the backend. + :vartype rules: list[~azure.mgmt.apimanagement.models.CircuitBreakerRule] + """ + + _validation = { + "rules": {"max_items": 15, "min_items": 0}, + } + + _attribute_map = { + "rules": {"key": "rules", "type": "[CircuitBreakerRule]"}, + } + + def __init__(self, *, rules: Optional[List["_models.CircuitBreakerRule"]] = None, **kwargs: Any) -> None: + """ + :keyword rules: The rules for tripping the backend. + :paramtype rules: list[~azure.mgmt.apimanagement.models.CircuitBreakerRule] + """ + super().__init__(**kwargs) + self.rules = rules class BackendCollection(_serialization.Model): @@ -6388,8 +7115,8 @@ def __init__( value: Optional[List["_models.BackendContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Backend values. :paramtype value: list[~azure.mgmt.apimanagement.models.BackendContract] @@ -6404,7 +7131,7 @@ def __init__( self.next_link = next_link -class BackendContract(Resource): # pylint: disable=too-many-instance-attributes +class BackendContract(ProxyResource): # pylint: disable=too-many-instance-attributes """Backend details. Variables are only populated by the server, and will be ignored when sending a request. @@ -6421,17 +7148,19 @@ class BackendContract(Resource): # pylint: disable=too-many-instance-attributes :vartype title: str :ivar description: Backend Description. :vartype description: str - :ivar resource_id: Management Uri of the Resource in External System. This url can be the Arm + :ivar resource_id: Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. :vartype resource_id: str :ivar properties: Backend Properties contract. :vartype properties: ~azure.mgmt.apimanagement.models.BackendProperties :ivar credentials: Backend Credentials Contract Properties. :vartype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :ivar proxy: Backend Proxy Contract Properties. + :ivar proxy: Backend gateway Contract Properties. :vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract :ivar tls: Backend TLS Properties. :vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :ivar circuit_breaker: Backend Circuit Breaker Configuration. + :vartype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker :ivar url: Runtime Url of the Backend. :vartype url: str :ivar protocol: Backend communication protocol. Known values are: "http" and "soap". @@ -6459,6 +7188,7 @@ class BackendContract(Resource): # pylint: disable=too-many-instance-attributes "credentials": {"key": "properties.credentials", "type": "BackendCredentialsContract"}, "proxy": {"key": "properties.proxy", "type": "BackendProxyContract"}, "tls": {"key": "properties.tls", "type": "BackendTlsProperties"}, + "circuit_breaker": {"key": "properties.circuitBreaker", "type": "BackendCircuitBreaker"}, "url": {"key": "properties.url", "type": "str"}, "protocol": {"key": "properties.protocol", "type": "str"}, } @@ -6473,26 +7203,29 @@ def __init__( credentials: Optional["_models.BackendCredentialsContract"] = None, proxy: Optional["_models.BackendProxyContract"] = None, tls: Optional["_models.BackendTlsProperties"] = None, + circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None, url: Optional[str] = None, protocol: Optional[Union[str, "_models.BackendProtocol"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword title: Backend Title. :paramtype title: str :keyword description: Backend Description. :paramtype description: str - :keyword resource_id: Management Uri of the Resource in External System. This url can be the + :keyword resource_id: Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. :paramtype resource_id: str :keyword properties: Backend Properties contract. :paramtype properties: ~azure.mgmt.apimanagement.models.BackendProperties :keyword credentials: Backend Credentials Contract Properties. :paramtype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :keyword proxy: Backend Proxy Contract Properties. + :keyword proxy: Backend gateway Contract Properties. :paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract :keyword tls: Backend TLS Properties. :paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :keyword circuit_breaker: Backend Circuit Breaker Configuration. + :paramtype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker :keyword url: Runtime Url of the Backend. :paramtype url: str :keyword protocol: Backend communication protocol. Known values are: "http" and "soap". @@ -6506,6 +7239,7 @@ def __init__( self.credentials = credentials self.proxy = proxy self.tls = tls + self.circuit_breaker = circuit_breaker self.url = url self.protocol = protocol @@ -6519,17 +7253,19 @@ class BackendContractProperties(BackendBaseParameters): :vartype title: str :ivar description: Backend Description. :vartype description: str - :ivar resource_id: Management Uri of the Resource in External System. This url can be the Arm + :ivar resource_id: Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. :vartype resource_id: str :ivar properties: Backend Properties contract. :vartype properties: ~azure.mgmt.apimanagement.models.BackendProperties :ivar credentials: Backend Credentials Contract Properties. :vartype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :ivar proxy: Backend Proxy Contract Properties. + :ivar proxy: Backend gateway Contract Properties. :vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract :ivar tls: Backend TLS Properties. :vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :ivar circuit_breaker: Backend Circuit Breaker Configuration. + :vartype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker :ivar url: Runtime Url of the Backend. Required. :vartype url: str :ivar protocol: Backend communication protocol. Required. Known values are: "http" and "soap". @@ -6552,6 +7288,7 @@ class BackendContractProperties(BackendBaseParameters): "credentials": {"key": "credentials", "type": "BackendCredentialsContract"}, "proxy": {"key": "proxy", "type": "BackendProxyContract"}, "tls": {"key": "tls", "type": "BackendTlsProperties"}, + "circuit_breaker": {"key": "circuitBreaker", "type": "BackendCircuitBreaker"}, "url": {"key": "url", "type": "str"}, "protocol": {"key": "protocol", "type": "str"}, } @@ -6568,24 +7305,27 @@ def __init__( credentials: Optional["_models.BackendCredentialsContract"] = None, proxy: Optional["_models.BackendProxyContract"] = None, tls: Optional["_models.BackendTlsProperties"] = None, - **kwargs - ): + circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None, + **kwargs: Any + ) -> None: """ :keyword title: Backend Title. :paramtype title: str :keyword description: Backend Description. :paramtype description: str - :keyword resource_id: Management Uri of the Resource in External System. This url can be the + :keyword resource_id: Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. :paramtype resource_id: str :keyword properties: Backend Properties contract. :paramtype properties: ~azure.mgmt.apimanagement.models.BackendProperties :keyword credentials: Backend Credentials Contract Properties. :paramtype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :keyword proxy: Backend Proxy Contract Properties. + :keyword proxy: Backend gateway Contract Properties. :paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract :keyword tls: Backend TLS Properties. :paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :keyword circuit_breaker: Backend Circuit Breaker Configuration. + :paramtype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker :keyword url: Runtime Url of the Backend. Required. :paramtype url: str :keyword protocol: Backend communication protocol. Required. Known values are: "http" and @@ -6600,6 +7340,7 @@ def __init__( credentials=credentials, proxy=proxy, tls=tls, + circuit_breaker=circuit_breaker, **kwargs ) self.url = url @@ -6643,8 +7384,8 @@ def __init__( query: Optional[Dict[str, List[str]]] = None, header: Optional[Dict[str, List[str]]] = None, authorization: Optional["_models.BackendAuthorizationHeaderCredentials"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword certificate_ids: List of Client Certificate Ids. :paramtype certificate_ids: list[str] @@ -6680,8 +7421,8 @@ class BackendProperties(_serialization.Model): } def __init__( - self, *, service_fabric_cluster: Optional["_models.BackendServiceFabricClusterProperties"] = None, **kwargs - ): + self, *, service_fabric_cluster: Optional["_models.BackendServiceFabricClusterProperties"] = None, **kwargs: Any + ) -> None: """ :keyword service_fabric_cluster: Backend Service Fabric Cluster Properties. :paramtype service_fabric_cluster: @@ -6715,7 +7456,9 @@ class BackendProxyContract(_serialization.Model): "password": {"key": "password", "type": "str"}, } - def __init__(self, *, url: str, username: Optional[str] = None, password: Optional[str] = None, **kwargs): + def __init__( + self, *, url: str, username: Optional[str] = None, password: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword url: WebProxy Server AbsoluteUri property which includes the entire URI stored in the Uri instance, including all fragments and query strings. Required. @@ -6731,7 +7474,7 @@ def __init__(self, *, url: str, username: Optional[str] = None, password: Option self.password = password -class BackendReconnectContract(Resource): +class BackendReconnectContract(ProxyResource): """Reconnect request parameters. Variables are only populated by the server, and will be ignored when sending a request. @@ -6762,7 +7505,7 @@ class BackendReconnectContract(Resource): "after": {"key": "properties.after", "type": "duration"}, } - def __init__(self, *, after: Optional[datetime.timedelta] = None, **kwargs): + def __init__(self, *, after: Optional[datetime.timedelta] = None, **kwargs: Any) -> None: """ :keyword after: Duration in ISO8601 format after which reconnect will be initiated. Minimum duration of the Reconnect is PT2M. @@ -6816,8 +7559,8 @@ def __init__( max_partition_resolution_retries: Optional[int] = None, server_certificate_thumbprints: Optional[List[str]] = None, server_x509_names: Optional[List["_models.X509CertificateName"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword client_certificate_id: The client certificate id for the management endpoint. :paramtype client_certificate_id: str @@ -6860,7 +7603,9 @@ class BackendTlsProperties(_serialization.Model): "validate_certificate_name": {"key": "validateCertificateName", "type": "bool"}, } - def __init__(self, *, validate_certificate_chain: bool = True, validate_certificate_name: bool = True, **kwargs): + def __init__( + self, *, validate_certificate_chain: bool = True, validate_certificate_name: bool = True, **kwargs: Any + ) -> None: """ :keyword validate_certificate_chain: Flag indicating whether SSL certificate chain validation should be done when using self-signed certificates for this backend host. @@ -6881,17 +7626,19 @@ class BackendUpdateParameterProperties(BackendBaseParameters): :vartype title: str :ivar description: Backend Description. :vartype description: str - :ivar resource_id: Management Uri of the Resource in External System. This url can be the Arm + :ivar resource_id: Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. :vartype resource_id: str :ivar properties: Backend Properties contract. :vartype properties: ~azure.mgmt.apimanagement.models.BackendProperties :ivar credentials: Backend Credentials Contract Properties. :vartype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :ivar proxy: Backend Proxy Contract Properties. + :ivar proxy: Backend gateway Contract Properties. :vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract :ivar tls: Backend TLS Properties. :vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :ivar circuit_breaker: Backend Circuit Breaker Configuration. + :vartype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker :ivar url: Runtime Url of the Backend. :vartype url: str :ivar protocol: Backend communication protocol. Known values are: "http" and "soap". @@ -6913,6 +7660,7 @@ class BackendUpdateParameterProperties(BackendBaseParameters): "credentials": {"key": "credentials", "type": "BackendCredentialsContract"}, "proxy": {"key": "proxy", "type": "BackendProxyContract"}, "tls": {"key": "tls", "type": "BackendTlsProperties"}, + "circuit_breaker": {"key": "circuitBreaker", "type": "BackendCircuitBreaker"}, "url": {"key": "url", "type": "str"}, "protocol": {"key": "protocol", "type": "str"}, } @@ -6927,26 +7675,29 @@ def __init__( credentials: Optional["_models.BackendCredentialsContract"] = None, proxy: Optional["_models.BackendProxyContract"] = None, tls: Optional["_models.BackendTlsProperties"] = None, + circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None, url: Optional[str] = None, protocol: Optional[Union[str, "_models.BackendProtocol"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword title: Backend Title. :paramtype title: str :keyword description: Backend Description. :paramtype description: str - :keyword resource_id: Management Uri of the Resource in External System. This url can be the + :keyword resource_id: Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. :paramtype resource_id: str :keyword properties: Backend Properties contract. :paramtype properties: ~azure.mgmt.apimanagement.models.BackendProperties :keyword credentials: Backend Credentials Contract Properties. :paramtype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :keyword proxy: Backend Proxy Contract Properties. + :keyword proxy: Backend gateway Contract Properties. :paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract :keyword tls: Backend TLS Properties. :paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :keyword circuit_breaker: Backend Circuit Breaker Configuration. + :paramtype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker :keyword url: Runtime Url of the Backend. :paramtype url: str :keyword protocol: Backend communication protocol. Known values are: "http" and "soap". @@ -6960,6 +7711,7 @@ def __init__( credentials=credentials, proxy=proxy, tls=tls, + circuit_breaker=circuit_breaker, **kwargs ) self.url = url @@ -6973,17 +7725,19 @@ class BackendUpdateParameters(_serialization.Model): :vartype title: str :ivar description: Backend Description. :vartype description: str - :ivar resource_id: Management Uri of the Resource in External System. This url can be the Arm + :ivar resource_id: Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. :vartype resource_id: str :ivar properties: Backend Properties contract. :vartype properties: ~azure.mgmt.apimanagement.models.BackendProperties :ivar credentials: Backend Credentials Contract Properties. :vartype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :ivar proxy: Backend Proxy Contract Properties. + :ivar proxy: Backend gateway Contract Properties. :vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract :ivar tls: Backend TLS Properties. :vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :ivar circuit_breaker: Backend Circuit Breaker Configuration. + :vartype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker :ivar url: Runtime Url of the Backend. :vartype url: str :ivar protocol: Backend communication protocol. Known values are: "http" and "soap". @@ -7005,6 +7759,7 @@ class BackendUpdateParameters(_serialization.Model): "credentials": {"key": "properties.credentials", "type": "BackendCredentialsContract"}, "proxy": {"key": "properties.proxy", "type": "BackendProxyContract"}, "tls": {"key": "properties.tls", "type": "BackendTlsProperties"}, + "circuit_breaker": {"key": "properties.circuitBreaker", "type": "BackendCircuitBreaker"}, "url": {"key": "properties.url", "type": "str"}, "protocol": {"key": "properties.protocol", "type": "str"}, } @@ -7019,26 +7774,29 @@ def __init__( credentials: Optional["_models.BackendCredentialsContract"] = None, proxy: Optional["_models.BackendProxyContract"] = None, tls: Optional["_models.BackendTlsProperties"] = None, + circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None, url: Optional[str] = None, protocol: Optional[Union[str, "_models.BackendProtocol"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword title: Backend Title. :paramtype title: str :keyword description: Backend Description. :paramtype description: str - :keyword resource_id: Management Uri of the Resource in External System. This url can be the + :keyword resource_id: Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. :paramtype resource_id: str :keyword properties: Backend Properties contract. :paramtype properties: ~azure.mgmt.apimanagement.models.BackendProperties :keyword credentials: Backend Credentials Contract Properties. :paramtype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :keyword proxy: Backend Proxy Contract Properties. + :keyword proxy: Backend gateway Contract Properties. :paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract :keyword tls: Backend TLS Properties. :paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :keyword circuit_breaker: Backend Circuit Breaker Configuration. + :paramtype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker :keyword url: Runtime Url of the Backend. :paramtype url: str :keyword protocol: Backend communication protocol. Known values are: "http" and "soap". @@ -7052,6 +7810,7 @@ def __init__( self.credentials = credentials self.proxy = proxy self.tls = tls + self.circuit_breaker = circuit_breaker self.url = url self.protocol = protocol @@ -7071,7 +7830,7 @@ class BodyDiagnosticSettings(_serialization.Model): "bytes": {"key": "bytes", "type": "int"}, } - def __init__(self, *, bytes: Optional[int] = None, **kwargs): + def __init__(self, *, bytes: Optional[int] = None, **kwargs: Any) -> None: """ :keyword bytes: Number of request body bytes to log. :paramtype bytes: int @@ -7103,8 +7862,8 @@ def __init__( value: Optional[List["_models.CacheContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Page values. :paramtype value: list[~azure.mgmt.apimanagement.models.CacheContract] @@ -7119,7 +7878,7 @@ def __init__( self.next_link = next_link -class CacheContract(Resource): +class CacheContract(ProxyResource): """Cache details. Variables are only populated by the server, and will be ignored when sending a request. @@ -7170,8 +7929,8 @@ def __init__( connection_string: Optional[str] = None, use_from_location: Optional[str] = None, resource_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Cache description. :paramtype description: str @@ -7225,8 +7984,8 @@ def __init__( connection_string: Optional[str] = None, use_from_location: Optional[str] = None, resource_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Cache description. :paramtype description: str @@ -7268,8 +8027,8 @@ def __init__( value: Optional[List["_models.CertificateContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Page values. :paramtype value: list[~azure.mgmt.apimanagement.models.CertificateContract] @@ -7319,8 +8078,8 @@ def __init__( encoded_certificate: Optional[str] = None, certificate_password: Optional[str] = None, certificate: Optional["_models.CertificateInformation"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword encoded_certificate: Base64 Encoded certificate. :paramtype encoded_certificate: str @@ -7341,7 +8100,7 @@ def __init__( self.certificate = certificate -class CertificateContract(Resource): +class CertificateContract(ProxyResource): """Certificate details. Variables are only populated by the server, and will be ignored when sending a request. @@ -7388,8 +8147,8 @@ def __init__( thumbprint: Optional[str] = None, expiration_date: Optional[datetime.datetime] = None, key_vault: Optional["_models.KeyVaultContractProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subject: Subject attribute of the certificate. :paramtype subject: str @@ -7431,8 +8190,8 @@ def __init__( data: Optional[str] = None, password: Optional[str] = None, key_vault: Optional["_models.KeyVaultContractCreateProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword data: Base 64 encoded certificate using the application/x-pkcs12 representation. :paramtype data: str @@ -7473,7 +8232,7 @@ class CertificateInformation(_serialization.Model): "subject": {"key": "subject", "type": "str"}, } - def __init__(self, *, expiry: datetime.datetime, thumbprint: str, subject: str, **kwargs): + def __init__(self, *, expiry: datetime.datetime, thumbprint: str, subject: str, **kwargs: Any) -> None: """ :keyword 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. @@ -7489,6 +8248,103 @@ def __init__(self, *, expiry: datetime.datetime, thumbprint: str, subject: str, self.subject = subject +class CircuitBreakerFailureCondition(_serialization.Model): + """The trip conditions of the circuit breaker. + + :ivar count: The threshold for opening the circuit. + :vartype count: int + :ivar percentage: The threshold for opening the circuit. + :vartype percentage: int + :ivar interval: The interval during which the failures are counted. + :vartype interval: ~datetime.timedelta + :ivar status_code_ranges: The status code ranges which are considered as failure. + :vartype status_code_ranges: list[~azure.mgmt.apimanagement.models.FailureStatusCodeRange] + :ivar error_reasons: The error reasons which are considered as failure. + :vartype error_reasons: list[str] + """ + + _validation = { + "status_code_ranges": {"max_items": 10, "min_items": 0}, + "error_reasons": {"max_items": 10, "min_items": 0}, + } + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + "percentage": {"key": "percentage", "type": "int"}, + "interval": {"key": "interval", "type": "duration"}, + "status_code_ranges": {"key": "statusCodeRanges", "type": "[FailureStatusCodeRange]"}, + "error_reasons": {"key": "errorReasons", "type": "[str]"}, + } + + def __init__( + self, + *, + count: Optional[int] = None, + percentage: Optional[int] = None, + interval: Optional[datetime.timedelta] = None, + status_code_ranges: Optional[List["_models.FailureStatusCodeRange"]] = None, + error_reasons: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword count: The threshold for opening the circuit. + :paramtype count: int + :keyword percentage: The threshold for opening the circuit. + :paramtype percentage: int + :keyword interval: The interval during which the failures are counted. + :paramtype interval: ~datetime.timedelta + :keyword status_code_ranges: The status code ranges which are considered as failure. + :paramtype status_code_ranges: list[~azure.mgmt.apimanagement.models.FailureStatusCodeRange] + :keyword error_reasons: The error reasons which are considered as failure. + :paramtype error_reasons: list[str] + """ + super().__init__(**kwargs) + self.count = count + self.percentage = percentage + self.interval = interval + self.status_code_ranges = status_code_ranges + self.error_reasons = error_reasons + + +class CircuitBreakerRule(_serialization.Model): + """Rule configuration to trip the backend. + + :ivar name: The rule name. + :vartype name: str + :ivar failure_condition: The conditions for tripping the circuit breaker. + :vartype failure_condition: ~azure.mgmt.apimanagement.models.CircuitBreakerFailureCondition + :ivar trip_duration: The duration for which the circuit will be tripped. + :vartype trip_duration: ~datetime.timedelta + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "failure_condition": {"key": "failureCondition", "type": "CircuitBreakerFailureCondition"}, + "trip_duration": {"key": "tripDuration", "type": "duration"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + failure_condition: Optional["_models.CircuitBreakerFailureCondition"] = None, + trip_duration: Optional[datetime.timedelta] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The rule name. + :paramtype name: str + :keyword failure_condition: The conditions for tripping the circuit breaker. + :paramtype failure_condition: ~azure.mgmt.apimanagement.models.CircuitBreakerFailureCondition + :keyword trip_duration: The duration for which the circuit will be tripped. + :paramtype trip_duration: ~datetime.timedelta + """ + super().__init__(**kwargs) + self.name = name + self.failure_condition = failure_condition + self.trip_duration = trip_duration + + class ClientSecretContract(_serialization.Model): """Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. @@ -7500,7 +8356,7 @@ class ClientSecretContract(_serialization.Model): "client_secret": {"key": "clientSecret", "type": "str"}, } - def __init__(self, *, client_secret: Optional[str] = None, **kwargs): + def __init__(self, *, client_secret: Optional[str] = None, **kwargs: Any) -> None: """ :keyword client_secret: Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. :paramtype client_secret: str @@ -7553,8 +8409,8 @@ def __init__( preferred_ip_version: Optional[Union[str, "_models.PreferredIPVersion"]] = None, protocol: Optional[Union[str, "_models.ConnectivityCheckProtocol"]] = None, protocol_configuration: Optional["_models.ConnectivityCheckRequestProtocolConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword source: Definitions about the connectivity check origin. Required. :paramtype source: ~azure.mgmt.apimanagement.models.ConnectivityCheckRequestSource @@ -7600,7 +8456,7 @@ class ConnectivityCheckRequestDestination(_serialization.Model): "port": {"key": "port", "type": "int"}, } - def __init__(self, *, address: str, port: int, **kwargs): + def __init__(self, *, address: str, port: int, **kwargs: Any) -> None: """ :keyword address: Destination address. Can either be an IP address or a FQDN. Required. :paramtype address: str @@ -7631,8 +8487,8 @@ def __init__( self, *, http_configuration: Optional["_models.ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword http_configuration: Configuration for HTTP or HTTPS requests. :paramtype http_configuration: @@ -7665,8 +8521,8 @@ def __init__( method: Optional[Union[str, "_models.Method"]] = None, valid_status_codes: Optional[List[int]] = None, headers: Optional[List["_models.HTTPHeader"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword method: The HTTP method to be used. Known values are: "GET" and "POST". :paramtype method: str or ~azure.mgmt.apimanagement.models.Method @@ -7703,7 +8559,7 @@ class ConnectivityCheckRequestSource(_serialization.Model): "instance": {"key": "instance", "type": "int"}, } - def __init__(self, *, region: str, instance: Optional[int] = None, **kwargs): + def __init__(self, *, region: str, instance: Optional[int] = None, **kwargs: Any) -> None: """ :keyword region: The API Management service region from where to start the connectivity check operation. Required. @@ -7758,7 +8614,7 @@ class ConnectivityCheckResponse(_serialization.Model): "probes_failed": {"key": "probesFailed", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.hops = None @@ -7807,7 +8663,7 @@ class ConnectivityHop(_serialization.Model): "issues": {"key": "issues", "type": "[ConnectivityIssue]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -7849,7 +8705,7 @@ class ConnectivityIssue(_serialization.Model): "context": {"key": "context", "type": "[{str}]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.origin = None @@ -7916,8 +8772,8 @@ def __init__( resource_type: str, is_optional: bool, error: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword 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. @@ -7973,14 +8829,14 @@ class ContentItemCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None self.next_link = None -class ContentItemContract(Resource): +class ContentItemContract(ProxyResource): """Content type contract details. Variables are only populated by the server, and will be ignored when sending a request. @@ -8010,7 +8866,7 @@ class ContentItemContract(Resource): "properties": {"key": "properties", "type": "{object}"}, } - def __init__(self, *, properties: Optional[Dict[str, Any]] = None, **kwargs): + def __init__(self, *, properties: Optional[Dict[str, Any]] = None, **kwargs: Any) -> None: """ :keyword properties: Properties of the content item. :paramtype properties: dict[str, any] @@ -8040,14 +8896,14 @@ class ContentTypeCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None self.next_link = None -class ContentTypeContract(Resource): +class ContentTypeContract(ProxyResource): """Content type contract details. Variables are only populated by the server, and will be ignored when sending a request. @@ -8097,8 +8953,8 @@ def __init__( description: Optional[str] = None, schema: Optional[JSON] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id_properties_id: Content type identifier. :paramtype id_properties_id: str @@ -8138,8 +8994,8 @@ def __init__( *, query_params: Optional[List["_models.DataMaskingEntity"]] = None, headers: Optional[List["_models.DataMaskingEntity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword query_params: Masking settings for Url query parameters. :paramtype query_params: list[~azure.mgmt.apimanagement.models.DataMaskingEntity] @@ -8166,8 +9022,12 @@ class DataMaskingEntity(_serialization.Model): } def __init__( - self, *, value: Optional[str] = None, mode: Optional[Union[str, "_models.DataMaskingMode"]] = None, **kwargs - ): + self, + *, + value: Optional[str] = None, + mode: Optional[Union[str, "_models.DataMaskingMode"]] = None, + **kwargs: Any + ) -> None: """ :keyword value: The name of an entity to mask (e.g. a name of a header or a query parameter). :paramtype value: str @@ -8179,7 +9039,7 @@ def __init__( self.mode = mode -class DeletedServiceContract(Resource): +class DeletedServiceContract(ProxyResource): """Deleted API Management Service information. Variables are only populated by the server, and will be ignored when sending a request. @@ -8228,8 +9088,8 @@ def __init__( service_id: Optional[str] = None, scheduled_purge_date: Optional[datetime.datetime] = None, deletion_date: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_id: Fully-qualified API Management Service Resource ID. :paramtype service_id: str @@ -8269,7 +9129,7 @@ class DeletedServicesCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -8292,7 +9152,7 @@ class DeployConfigurationParameters(_serialization.Model): "force": {"key": "properties.force", "type": "bool"}, } - def __init__(self, *, branch: Optional[str] = None, force: Optional[bool] = None, **kwargs): + def __init__(self, *, branch: Optional[str] = None, force: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword branch: The name of the Git branch from which the configuration is to be deployed to the configuration database. @@ -8329,8 +9189,8 @@ def __init__( value: Optional[List["_models.DiagnosticContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Page values. :paramtype value: list[~azure.mgmt.apimanagement.models.DiagnosticContract] @@ -8345,7 +9205,7 @@ def __init__( self.next_link = next_link -class DiagnosticContract(Resource): # pylint: disable=too-many-instance-attributes +class DiagnosticContract(ProxyResource): # pylint: disable=too-many-instance-attributes """Diagnostic details. Variables are only populated by the server, and will be ignored when sending a request. @@ -8421,8 +9281,8 @@ def __init__( verbosity: Optional[Union[str, "_models.Verbosity"]] = None, operation_name_format: Optional[Union[str, "_models.OperationNameFormat"]] = None, metrics: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword always_log: Specifies for what type of messages sampling settings should not apply. "allErrors" @@ -8452,16 +9312,115 @@ def __init__( :paramtype metrics: bool """ super().__init__(**kwargs) - self.always_log = always_log - self.logger_id = logger_id - self.sampling = sampling - self.frontend = frontend - self.backend = backend - self.log_client_ip = log_client_ip - self.http_correlation_protocol = http_correlation_protocol - self.verbosity = verbosity - self.operation_name_format = operation_name_format - self.metrics = metrics + self.always_log = always_log + self.logger_id = logger_id + self.sampling = sampling + self.frontend = frontend + self.backend = backend + self.log_client_ip = log_client_ip + self.http_correlation_protocol = http_correlation_protocol + self.verbosity = verbosity + self.operation_name_format = operation_name_format + self.metrics = metrics + + +class DocumentationCollection(_serialization.Model): + """Paged Documentation list representation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.DocumentationContract] + :ivar next_link: Next page link if any. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DocumentationContract]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class DocumentationContract(ProxyResource): + """Markdown documentation details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar title: documentation title. + :vartype title: str + :ivar content: Markdown documentation content. + :vartype content: 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"}, + "title": {"key": "properties.title", "type": "str"}, + "content": {"key": "properties.content", "type": "str"}, + } + + def __init__(self, *, title: Optional[str] = None, content: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword title: documentation title. + :paramtype title: str + :keyword content: Markdown documentation content. + :paramtype content: str + """ + super().__init__(**kwargs) + self.title = title + self.content = content + + +class DocumentationUpdateContract(_serialization.Model): + """Documentation update contract details. + + :ivar title: documentation title. + :vartype title: str + :ivar content: Markdown documentation content. + :vartype content: str + """ + + _attribute_map = { + "title": {"key": "properties.title", "type": "str"}, + "content": {"key": "properties.content", "type": "str"}, + } + + def __init__(self, *, title: Optional[str] = None, content: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword title: documentation title. + :paramtype title: str + :keyword content: Markdown documentation content. + :paramtype content: str + """ + super().__init__(**kwargs) + self.title = title + self.content = content class EmailTemplateCollection(_serialization.Model): @@ -8487,8 +9446,8 @@ def __init__( value: Optional[List["_models.EmailTemplateContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Page values. :paramtype value: list[~azure.mgmt.apimanagement.models.EmailTemplateContract] @@ -8503,7 +9462,7 @@ def __init__( self.next_link = next_link -class EmailTemplateContract(Resource): +class EmailTemplateContract(ProxyResource): """Email Template details. Variables are only populated by the server, and will be ignored when sending a request. @@ -8561,8 +9520,8 @@ def __init__( title: Optional[str] = None, description: Optional[str] = None, parameters: Optional[List["_models.EmailTemplateParametersContractProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subject: Subject of the Template. :paramtype subject: str @@ -8609,8 +9568,13 @@ class EmailTemplateParametersContractProperties(_serialization.Model): } def __init__( - self, *, name: Optional[str] = None, title: Optional[str] = None, description: Optional[str] = None, **kwargs - ): + self, + *, + name: Optional[str] = None, + title: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword name: Template parameter name. :paramtype name: str @@ -8662,8 +9626,8 @@ def __init__( description: Optional[str] = None, body: Optional[str] = None, parameters: Optional[List["_models.EmailTemplateParametersContractProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subject: Subject of the Template. :paramtype subject: str @@ -8704,8 +9668,8 @@ def __init__( *, domain_name: Optional[str] = None, endpoint_details: Optional[List["_models.EndpointDetail"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword domain_name: The domain name of the dependency. :paramtype domain_name: str @@ -8731,7 +9695,7 @@ class EndpointDetail(_serialization.Model): "region": {"key": "region", "type": "str"}, } - def __init__(self, *, port: Optional[int] = None, region: Optional[str] = None, **kwargs): + def __init__(self, *, port: Optional[int] = None, region: Optional[str] = None, **kwargs: Any) -> None: """ :keyword port: The port an endpoint is connected to. :paramtype port: int @@ -8761,8 +9725,8 @@ class ErrorFieldContract(_serialization.Model): } def __init__( - self, *, code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, **kwargs - ): + self, *, code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword code: Property level error code. :paramtype code: str @@ -8801,8 +9765,8 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, details: Optional[List["_models.ErrorFieldContract"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. @@ -8842,8 +9806,8 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, details: Optional[List["_models.ErrorFieldContract"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. @@ -8859,6 +9823,43 @@ def __init__( self.details = details +class FailureStatusCodeRange(_serialization.Model): + """The failure http status code range. + + :ivar min: The minimum http status code. + :vartype min: int + :ivar max: The maximum http status code. + :vartype max: int + """ + + _validation = { + "min": {"maximum": 599, "minimum": 200}, + "max": {"maximum": 599, "minimum": 200}, + } + + _attribute_map = { + "min": {"key": "min", "type": "int"}, + "max": {"key": "max", "type": "int"}, + } + + def __init__( + self, + *, + min: Optional[int] = None, # pylint: disable=redefined-builtin + max: Optional[int] = None, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: + """ + :keyword min: The minimum http status code. + :paramtype min: int + :keyword max: The maximum http status code. + :paramtype max: int + """ + super().__init__(**kwargs) + self.min = min + self.max = max + + class GatewayCertificateAuthorityCollection(_serialization.Model): """Paged Gateway certificate authority list representation. @@ -8880,14 +9881,14 @@ class GatewayCertificateAuthorityCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None self.next_link = None -class GatewayCertificateAuthorityContract(Resource): +class GatewayCertificateAuthorityContract(ProxyResource): """Gateway certificate authority details. Variables are only populated by the server, and will be ignored when sending a request. @@ -8917,7 +9918,7 @@ class GatewayCertificateAuthorityContract(Resource): "is_trusted": {"key": "properties.isTrusted", "type": "bool"}, } - def __init__(self, *, is_trusted: Optional[bool] = None, **kwargs): + def __init__(self, *, is_trusted: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword is_trusted: Determines whether certificate authority is trusted. :paramtype is_trusted: bool @@ -8950,7 +9951,7 @@ class GatewayCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, count: Optional[int] = None, **kwargs): + def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None: """ :keyword count: Total record count number across all pages. :paramtype count: int @@ -8961,7 +9962,7 @@ def __init__(self, *, count: Optional[int] = None, **kwargs): self.next_link = None -class GatewayContract(Resource): +class GatewayContract(ProxyResource): """Gateway details. Variables are only populated by the server, and will be ignored when sending a request. @@ -9000,8 +10001,8 @@ def __init__( *, location_data: Optional["_models.ResourceLocationDataContract"] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location_data: Gateway location. :paramtype location_data: ~azure.mgmt.apimanagement.models.ResourceLocationDataContract @@ -9034,14 +10035,14 @@ class GatewayHostnameConfigurationCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None self.next_link = None -class GatewayHostnameConfigurationContract(Resource): +class GatewayHostnameConfigurationContract(ProxyResource): """Gateway hostname configuration details. Variables are only populated by the server, and will be ignored when sending a request. @@ -9096,8 +10097,8 @@ def __init__( tls10_enabled: Optional[bool] = None, tls11_enabled: Optional[bool] = None, http2_enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword hostname: Hostname value. Supports valid domain name, partial or full wildcard. :paramtype hostname: str @@ -9140,7 +10141,7 @@ class GatewayKeyRegenerationRequestContract(_serialization.Model): "key_type": {"key": "keyType", "type": "str"}, } - def __init__(self, *, key_type: Union[str, "_models.KeyType"], **kwargs): + def __init__(self, *, key_type: Union[str, "_models.KeyType"], **kwargs: Any) -> None: """ :keyword key_type: The Key being regenerated. Required. Known values are: "primary" and "secondary". @@ -9164,7 +10165,7 @@ class GatewayKeysContract(_serialization.Model): "secondary": {"key": "secondary", "type": "str"}, } - def __init__(self, *, primary: Optional[str] = None, secondary: Optional[str] = None, **kwargs): + def __init__(self, *, primary: Optional[str] = None, secondary: Optional[str] = None, **kwargs: Any) -> None: """ :keyword primary: Primary gateway key. :paramtype primary: str @@ -9187,7 +10188,7 @@ class GatewayTokenContract(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: Shared Access Authentication token value for the Gateway. :paramtype value: str @@ -9220,7 +10221,7 @@ class GatewayTokenRequestContract(_serialization.Model): "expiry": {"key": "expiry", "type": "iso-8601"}, } - def __init__(self, *, key_type: Union[str, "_models.KeyType"], expiry: datetime.datetime, **kwargs): + def __init__(self, *, key_type: Union[str, "_models.KeyType"], expiry: datetime.datetime, **kwargs: Any) -> None: """ :keyword key_type: The Key to be used to generate gateway token. Required. Known values are: "primary" and "secondary". @@ -9246,7 +10247,7 @@ class GenerateSsoUrlResult(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: Redirect Url containing the SSO URL value. :paramtype value: str @@ -9279,7 +10280,7 @@ class GlobalSchemaCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, count: Optional[int] = None, **kwargs): + def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None: """ :keyword count: Total record count number. :paramtype count: int @@ -9290,7 +10291,7 @@ def __init__(self, *, count: Optional[int] = None, **kwargs): self.next_link = None -class GlobalSchemaContract(Resource): +class GlobalSchemaContract(ProxyResource): """Global Schema Contract details. Variables are only populated by the server, and will be ignored when sending a request. @@ -9336,8 +10337,8 @@ def __init__( description: Optional[str] = None, value: Optional[Any] = None, document: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword schema_type: Schema Type. Immutable. Known values are: "xml" and "json". :paramtype schema_type: str or ~azure.mgmt.apimanagement.models.SchemaType @@ -9379,8 +10380,8 @@ def __init__( value: Optional[List["_models.GroupContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Page values. :paramtype value: list[~azure.mgmt.apimanagement.models.GroupContract] @@ -9395,7 +10396,7 @@ def __init__( self.next_link = next_link -class GroupContract(Resource): +class GroupContract(ProxyResource): """Contract details. Variables are only populated by the server, and will be ignored when sending a request. @@ -9450,8 +10451,8 @@ def __init__( description: Optional[str] = None, type_properties_type: Optional[Union[str, "_models.GroupType"]] = None, external_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: Group name. :paramtype display_name: str @@ -9516,8 +10517,8 @@ def __init__( description: Optional[str] = None, type: Optional[Union[str, "_models.GroupType"]] = None, external_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: Group name. Required. :paramtype display_name: str @@ -9571,8 +10572,8 @@ def __init__( description: Optional[str] = None, type: Optional[Union[str, "_models.GroupType"]] = None, external_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: Group name. :paramtype display_name: str @@ -9625,8 +10626,8 @@ def __init__( description: Optional[str] = None, type: Optional[Union[str, "_models.GroupType"]] = None, external_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: Group name. :paramtype display_name: str @@ -9672,7 +10673,7 @@ class HostnameConfiguration(_serialization.Model): # pylint: disable=too-many-i as the Default SSL Certificate. If a client does not send the SNI header, then this will be the certificate that will be challenged. The property is useful if a service has multiple custom hostname enabled and it needs to decide on the default ssl certificate. The setting only - applied to Proxy Hostname Type. + applied to gateway Hostname Type. :vartype default_ssl_binding: bool :ivar negotiate_client_certificate: Specify true to always negotiate client certificate on the hostname. Default Value is false. @@ -9720,8 +10721,8 @@ def __init__( certificate: Optional["_models.CertificateInformation"] = None, certificate_source: Optional[Union[str, "_models.CertificateSource"]] = None, certificate_status: Optional[Union[str, "_models.CertificateStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Hostname type. Required. Known values are: "Proxy", "Portal", "Management", "Scm", and "DeveloperPortal". @@ -9744,7 +10745,7 @@ def __init__( Hostname as the Default SSL Certificate. If a client does not send the SNI header, then this will be the certificate that will be challenged. The property is useful if a service has multiple custom hostname enabled and it needs to decide on the default ssl certificate. The - setting only applied to Proxy Hostname Type. + setting only applied to gateway Hostname Type. :paramtype default_ssl_binding: bool :keyword negotiate_client_certificate: Specify true to always negotiate client certificate on the hostname. Default Value is false. @@ -9793,7 +10794,7 @@ class HTTPHeader(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, name: str, value: str, **kwargs): + def __init__(self, *, name: str, value: str, **kwargs: Any) -> None: """ :keyword name: Header name. Required. :paramtype name: str @@ -9828,8 +10829,8 @@ def __init__( headers: Optional[List[str]] = None, body: Optional["_models.BodyDiagnosticSettings"] = None, data_masking: Optional["_models.DataMasking"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword headers: Array of HTTP Headers to log. :paramtype headers: list[str] @@ -9866,6 +10867,9 @@ class IdentityProviderBaseParameters(_serialization.Model): :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. :vartype password_reset_policy_name: str + :ivar client_library: The client library to be used in the developer portal. Only applies to + AAD and AAD B2C Identity Provider. + :vartype client_library: str """ _validation = { @@ -9874,6 +10878,7 @@ class IdentityProviderBaseParameters(_serialization.Model): "signin_policy_name": {"min_length": 1}, "profile_editing_policy_name": {"min_length": 1}, "password_reset_policy_name": {"min_length": 1}, + "client_library": {"max_length": 16}, } _attribute_map = { @@ -9885,6 +10890,7 @@ class IdentityProviderBaseParameters(_serialization.Model): "signin_policy_name": {"key": "signinPolicyName", "type": "str"}, "profile_editing_policy_name": {"key": "profileEditingPolicyName", "type": "str"}, "password_reset_policy_name": {"key": "passwordResetPolicyName", "type": "str"}, + "client_library": {"key": "clientLibrary", "type": "str"}, } def __init__( @@ -9898,8 +10904,9 @@ def __init__( signin_policy_name: Optional[str] = None, profile_editing_policy_name: Optional[str] = None, password_reset_policy_name: Optional[str] = None, - **kwargs - ): + client_library: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword type: Identity Provider Type identifier. Known values are: "facebook", "google", "microsoft", "twitter", "aad", and "aadB2C". @@ -9922,6 +10929,9 @@ def __init__( :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. :paramtype password_reset_policy_name: str + :keyword client_library: The client library to be used in the developer portal. Only applies to + AAD and AAD B2C Identity Provider. + :paramtype client_library: str """ super().__init__(**kwargs) self.type = type @@ -9932,9 +10942,10 @@ def __init__( self.signin_policy_name = signin_policy_name self.profile_editing_policy_name = profile_editing_policy_name self.password_reset_policy_name = password_reset_policy_name + self.client_library = client_library -class IdentityProviderContract(Resource): # pylint: disable=too-many-instance-attributes +class IdentityProviderContract(ProxyResource): # pylint: disable=too-many-instance-attributes """Identity Provider details. Variables are only populated by the server, and will be ignored when sending a request. @@ -9966,6 +10977,9 @@ class IdentityProviderContract(Resource): # pylint: disable=too-many-instance-a :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. :vartype password_reset_policy_name: str + :ivar client_library: The client library to be used in the developer portal. Only applies to + AAD and AAD B2C Identity Provider. + :vartype client_library: str :ivar client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. :vartype client_id: str @@ -9985,6 +10999,7 @@ class IdentityProviderContract(Resource): # pylint: disable=too-many-instance-a "signin_policy_name": {"min_length": 1}, "profile_editing_policy_name": {"min_length": 1}, "password_reset_policy_name": {"min_length": 1}, + "client_library": {"max_length": 16}, "client_id": {"min_length": 1}, "client_secret": {"min_length": 1}, } @@ -10001,6 +11016,7 @@ class IdentityProviderContract(Resource): # pylint: disable=too-many-instance-a "signin_policy_name": {"key": "properties.signinPolicyName", "type": "str"}, "profile_editing_policy_name": {"key": "properties.profileEditingPolicyName", "type": "str"}, "password_reset_policy_name": {"key": "properties.passwordResetPolicyName", "type": "str"}, + "client_library": {"key": "properties.clientLibrary", "type": "str"}, "client_id": {"key": "properties.clientId", "type": "str"}, "client_secret": {"key": "properties.clientSecret", "type": "str"}, } @@ -10016,10 +11032,11 @@ def __init__( signin_policy_name: Optional[str] = None, profile_editing_policy_name: Optional[str] = None, password_reset_policy_name: Optional[str] = None, + client_library: Optional[str] = None, client_id: Optional[str] = None, client_secret: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_properties_type: Identity Provider Type identifier. Known values are: "facebook", "google", "microsoft", "twitter", "aad", and "aadB2C". @@ -10042,6 +11059,9 @@ def __init__( :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. :paramtype password_reset_policy_name: str + :keyword client_library: The client library to be used in the developer portal. Only applies to + AAD and AAD B2C Identity Provider. + :paramtype client_library: str :keyword client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. :paramtype client_id: str @@ -10060,12 +11080,17 @@ def __init__( self.signin_policy_name = signin_policy_name self.profile_editing_policy_name = profile_editing_policy_name self.password_reset_policy_name = password_reset_policy_name + self.client_library = client_library self.client_id = client_id self.client_secret = client_secret -class IdentityProviderContractProperties(IdentityProviderBaseParameters): - """The external Identity Providers like Facebook, Google, Microsoft, Twitter or Azure Active Directory which can be used to enable access to the API Management service developer portal for all users. +class IdentityProviderContractProperties( + IdentityProviderBaseParameters +): # pylint: disable=too-many-instance-attributes + """The external Identity Providers like Facebook, Google, Microsoft, Twitter or Azure Active + 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. @@ -10088,6 +11113,9 @@ class IdentityProviderContractProperties(IdentityProviderBaseParameters): :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. :vartype password_reset_policy_name: str + :ivar client_library: The client library to be used in the developer portal. Only applies to + AAD and AAD B2C Identity Provider. + :vartype client_library: str :ivar client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. Required. :vartype client_id: str @@ -10104,6 +11132,7 @@ class IdentityProviderContractProperties(IdentityProviderBaseParameters): "signin_policy_name": {"min_length": 1}, "profile_editing_policy_name": {"min_length": 1}, "password_reset_policy_name": {"min_length": 1}, + "client_library": {"max_length": 16}, "client_id": {"required": True, "min_length": 1}, "client_secret": {"min_length": 1}, } @@ -10117,6 +11146,7 @@ class IdentityProviderContractProperties(IdentityProviderBaseParameters): "signin_policy_name": {"key": "signinPolicyName", "type": "str"}, "profile_editing_policy_name": {"key": "profileEditingPolicyName", "type": "str"}, "password_reset_policy_name": {"key": "passwordResetPolicyName", "type": "str"}, + "client_library": {"key": "clientLibrary", "type": "str"}, "client_id": {"key": "clientId", "type": "str"}, "client_secret": {"key": "clientSecret", "type": "str"}, } @@ -10133,9 +11163,10 @@ def __init__( signin_policy_name: Optional[str] = None, profile_editing_policy_name: Optional[str] = None, password_reset_policy_name: Optional[str] = None, + client_library: Optional[str] = None, client_secret: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Identity Provider Type identifier. Known values are: "facebook", "google", "microsoft", "twitter", "aad", and "aadB2C". @@ -10158,6 +11189,9 @@ def __init__( :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. :paramtype password_reset_policy_name: str + :keyword client_library: The client library to be used in the developer portal. Only applies to + AAD and AAD B2C Identity Provider. + :paramtype client_library: str :keyword client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. Required. :paramtype client_id: str @@ -10176,13 +11210,14 @@ def __init__( signin_policy_name=signin_policy_name, profile_editing_policy_name=profile_editing_policy_name, password_reset_policy_name=password_reset_policy_name, + client_library=client_library, **kwargs ) self.client_id = client_id self.client_secret = client_secret -class IdentityProviderCreateContract(Resource): # pylint: disable=too-many-instance-attributes +class IdentityProviderCreateContract(ProxyResource): # pylint: disable=too-many-instance-attributes """Identity Provider details. Variables are only populated by the server, and will be ignored when sending a request. @@ -10214,6 +11249,9 @@ class IdentityProviderCreateContract(Resource): # pylint: disable=too-many-inst :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. :vartype password_reset_policy_name: str + :ivar client_library: The client library to be used in the developer portal. Only applies to + AAD and AAD B2C Identity Provider. + :vartype client_library: str :ivar client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. :vartype client_id: str @@ -10233,6 +11271,7 @@ class IdentityProviderCreateContract(Resource): # pylint: disable=too-many-inst "signin_policy_name": {"min_length": 1}, "profile_editing_policy_name": {"min_length": 1}, "password_reset_policy_name": {"min_length": 1}, + "client_library": {"max_length": 16}, "client_id": {"min_length": 1}, "client_secret": {"min_length": 1}, } @@ -10249,6 +11288,7 @@ class IdentityProviderCreateContract(Resource): # pylint: disable=too-many-inst "signin_policy_name": {"key": "properties.signinPolicyName", "type": "str"}, "profile_editing_policy_name": {"key": "properties.profileEditingPolicyName", "type": "str"}, "password_reset_policy_name": {"key": "properties.passwordResetPolicyName", "type": "str"}, + "client_library": {"key": "properties.clientLibrary", "type": "str"}, "client_id": {"key": "properties.clientId", "type": "str"}, "client_secret": {"key": "properties.clientSecret", "type": "str"}, } @@ -10264,10 +11304,11 @@ def __init__( signin_policy_name: Optional[str] = None, profile_editing_policy_name: Optional[str] = None, password_reset_policy_name: Optional[str] = None, + client_library: Optional[str] = None, client_id: Optional[str] = None, client_secret: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_properties_type: Identity Provider Type identifier. Known values are: "facebook", "google", "microsoft", "twitter", "aad", and "aadB2C". @@ -10290,6 +11331,9 @@ def __init__( :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. :paramtype password_reset_policy_name: str + :keyword client_library: The client library to be used in the developer portal. Only applies to + AAD and AAD B2C Identity Provider. + :paramtype client_library: str :keyword client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. :paramtype client_id: str @@ -10308,12 +11352,17 @@ def __init__( self.signin_policy_name = signin_policy_name self.profile_editing_policy_name = profile_editing_policy_name self.password_reset_policy_name = password_reset_policy_name + self.client_library = client_library self.client_id = client_id self.client_secret = client_secret -class IdentityProviderCreateContractProperties(IdentityProviderBaseParameters): - """The external Identity Providers like Facebook, Google, Microsoft, Twitter or Azure Active Directory which can be used to enable access to the API Management service developer portal for all users. +class IdentityProviderCreateContractProperties( + IdentityProviderBaseParameters +): # pylint: disable=too-many-instance-attributes + """The external Identity Providers like Facebook, Google, Microsoft, Twitter or Azure Active + 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. @@ -10336,6 +11385,9 @@ class IdentityProviderCreateContractProperties(IdentityProviderBaseParameters): :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. :vartype password_reset_policy_name: str + :ivar client_library: The client library to be used in the developer portal. Only applies to + AAD and AAD B2C Identity Provider. + :vartype client_library: str :ivar client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. Required. :vartype client_id: str @@ -10352,6 +11404,7 @@ class IdentityProviderCreateContractProperties(IdentityProviderBaseParameters): "signin_policy_name": {"min_length": 1}, "profile_editing_policy_name": {"min_length": 1}, "password_reset_policy_name": {"min_length": 1}, + "client_library": {"max_length": 16}, "client_id": {"required": True, "min_length": 1}, "client_secret": {"required": True, "min_length": 1}, } @@ -10365,6 +11418,7 @@ class IdentityProviderCreateContractProperties(IdentityProviderBaseParameters): "signin_policy_name": {"key": "signinPolicyName", "type": "str"}, "profile_editing_policy_name": {"key": "profileEditingPolicyName", "type": "str"}, "password_reset_policy_name": {"key": "passwordResetPolicyName", "type": "str"}, + "client_library": {"key": "clientLibrary", "type": "str"}, "client_id": {"key": "clientId", "type": "str"}, "client_secret": {"key": "clientSecret", "type": "str"}, } @@ -10382,8 +11436,9 @@ def __init__( signin_policy_name: Optional[str] = None, profile_editing_policy_name: Optional[str] = None, password_reset_policy_name: Optional[str] = None, - **kwargs - ): + client_library: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword type: Identity Provider Type identifier. Known values are: "facebook", "google", "microsoft", "twitter", "aad", and "aadB2C". @@ -10406,6 +11461,9 @@ def __init__( :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. :paramtype password_reset_policy_name: str + :keyword client_library: The client library to be used in the developer portal. Only applies to + AAD and AAD B2C Identity Provider. + :paramtype client_library: str :keyword client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. Required. :paramtype client_id: str @@ -10424,6 +11482,7 @@ def __init__( signin_policy_name=signin_policy_name, profile_editing_policy_name=profile_editing_policy_name, password_reset_policy_name=password_reset_policy_name, + client_library=client_library, **kwargs ) self.client_id = client_id @@ -10453,8 +11512,8 @@ def __init__( value: Optional[List["_models.IdentityProviderContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Identity Provider configuration values. :paramtype value: list[~azure.mgmt.apimanagement.models.IdentityProviderContract] @@ -10469,7 +11528,7 @@ def __init__( self.next_link = next_link -class IdentityProviderUpdateParameters(_serialization.Model): +class IdentityProviderUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters supplied to update Identity Provider. :ivar type: Identity Provider Type identifier. Known values are: "facebook", "google", @@ -10491,6 +11550,9 @@ class IdentityProviderUpdateParameters(_serialization.Model): :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. :vartype password_reset_policy_name: str + :ivar client_library: The client library to be used in the developer portal. Only applies to + AAD and AAD B2C Identity Provider. + :vartype client_library: str :ivar client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. :vartype client_id: str @@ -10506,6 +11568,7 @@ class IdentityProviderUpdateParameters(_serialization.Model): "signin_policy_name": {"min_length": 1}, "profile_editing_policy_name": {"min_length": 1}, "password_reset_policy_name": {"min_length": 1}, + "client_library": {"max_length": 16}, "client_id": {"min_length": 1}, "client_secret": {"min_length": 1}, } @@ -10519,6 +11582,7 @@ class IdentityProviderUpdateParameters(_serialization.Model): "signin_policy_name": {"key": "properties.signinPolicyName", "type": "str"}, "profile_editing_policy_name": {"key": "properties.profileEditingPolicyName", "type": "str"}, "password_reset_policy_name": {"key": "properties.passwordResetPolicyName", "type": "str"}, + "client_library": {"key": "properties.clientLibrary", "type": "str"}, "client_id": {"key": "properties.clientId", "type": "str"}, "client_secret": {"key": "properties.clientSecret", "type": "str"}, } @@ -10534,10 +11598,11 @@ def __init__( signin_policy_name: Optional[str] = None, profile_editing_policy_name: Optional[str] = None, password_reset_policy_name: Optional[str] = None, + client_library: Optional[str] = None, client_id: Optional[str] = None, client_secret: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Identity Provider Type identifier. Known values are: "facebook", "google", "microsoft", "twitter", "aad", and "aadB2C". @@ -10560,6 +11625,9 @@ def __init__( :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. :paramtype password_reset_policy_name: str + :keyword client_library: The client library to be used in the developer portal. Only applies to + AAD and AAD B2C Identity Provider. + :paramtype client_library: str :keyword client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. :paramtype client_id: str @@ -10577,11 +11645,12 @@ def __init__( self.signin_policy_name = signin_policy_name self.profile_editing_policy_name = profile_editing_policy_name self.password_reset_policy_name = password_reset_policy_name + self.client_library = client_library self.client_id = client_id self.client_secret = client_secret -class IdentityProviderUpdateProperties(IdentityProviderBaseParameters): +class IdentityProviderUpdateProperties(IdentityProviderBaseParameters): # pylint: disable=too-many-instance-attributes """Parameters supplied to the Update Identity Provider operation. :ivar type: Identity Provider Type identifier. Known values are: "facebook", "google", @@ -10603,6 +11672,9 @@ class IdentityProviderUpdateProperties(IdentityProviderBaseParameters): :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. :vartype password_reset_policy_name: str + :ivar client_library: The client library to be used in the developer portal. Only applies to + AAD and AAD B2C Identity Provider. + :vartype client_library: str :ivar client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. :vartype client_id: str @@ -10618,6 +11690,7 @@ class IdentityProviderUpdateProperties(IdentityProviderBaseParameters): "signin_policy_name": {"min_length": 1}, "profile_editing_policy_name": {"min_length": 1}, "password_reset_policy_name": {"min_length": 1}, + "client_library": {"max_length": 16}, "client_id": {"min_length": 1}, "client_secret": {"min_length": 1}, } @@ -10631,6 +11704,7 @@ class IdentityProviderUpdateProperties(IdentityProviderBaseParameters): "signin_policy_name": {"key": "signinPolicyName", "type": "str"}, "profile_editing_policy_name": {"key": "profileEditingPolicyName", "type": "str"}, "password_reset_policy_name": {"key": "passwordResetPolicyName", "type": "str"}, + "client_library": {"key": "clientLibrary", "type": "str"}, "client_id": {"key": "clientId", "type": "str"}, "client_secret": {"key": "clientSecret", "type": "str"}, } @@ -10646,10 +11720,11 @@ def __init__( signin_policy_name: Optional[str] = None, profile_editing_policy_name: Optional[str] = None, password_reset_policy_name: Optional[str] = None, + client_library: Optional[str] = None, client_id: Optional[str] = None, client_secret: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Identity Provider Type identifier. Known values are: "facebook", "google", "microsoft", "twitter", "aad", and "aadB2C". @@ -10672,6 +11747,9 @@ def __init__( :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. :paramtype password_reset_policy_name: str + :keyword client_library: The client library to be used in the developer portal. Only applies to + AAD and AAD B2C Identity Provider. + :paramtype client_library: str :keyword client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. :paramtype client_id: str @@ -10689,6 +11767,7 @@ def __init__( signin_policy_name=signin_policy_name, profile_editing_policy_name=profile_editing_policy_name, password_reset_policy_name=password_reset_policy_name, + client_library=client_library, **kwargs ) self.client_id = client_id @@ -10719,7 +11798,7 @@ class IssueAttachmentCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, count: Optional[int] = None, **kwargs): + def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None: """ :keyword count: Total record count number across all pages. :paramtype count: int @@ -10730,7 +11809,7 @@ def __init__(self, *, count: Optional[int] = None, **kwargs): self.next_link = None -class IssueAttachmentContract(Resource): +class IssueAttachmentContract(ProxyResource): """Issue Attachment Contract details. Variables are only populated by the server, and will be ignored when sending a request. @@ -10773,8 +11852,8 @@ def __init__( title: Optional[str] = None, content_format: Optional[str] = None, content: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword title: Filename by which the binary data will be saved. :paramtype title: str @@ -10814,7 +11893,7 @@ class IssueCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, count: Optional[int] = None, **kwargs): + def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None: """ :keyword count: Total record count number across all pages. :paramtype count: int @@ -10849,7 +11928,7 @@ class IssueCommentCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, count: Optional[int] = None, **kwargs): + def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None: """ :keyword count: Total record count number across all pages. :paramtype count: int @@ -10860,7 +11939,7 @@ def __init__(self, *, count: Optional[int] = None, **kwargs): self.next_link = None -class IssueCommentContract(Resource): +class IssueCommentContract(ProxyResource): """Issue Comment Contract details. Variables are only populated by the server, and will be ignored when sending a request. @@ -10902,8 +11981,8 @@ def __init__( text: Optional[str] = None, created_date: Optional[datetime.datetime] = None, user_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword text: Comment text. :paramtype text: str @@ -10918,7 +11997,7 @@ def __init__( self.user_id = user_id -class IssueContract(Resource): +class IssueContract(ProxyResource): """Issue Contract details. Variables are only populated by the server, and will be ignored when sending a request. @@ -10973,8 +12052,8 @@ def __init__( title: Optional[str] = None, description: Optional[str] = None, user_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_date: Date and time when the issue was created. :paramtype created_date: ~datetime.datetime @@ -11023,8 +12102,8 @@ def __init__( created_date: Optional[datetime.datetime] = None, state: Optional[Union[str, "_models.State"]] = None, api_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_date: Date and time when the issue was created. :paramtype created_date: ~datetime.datetime @@ -11084,8 +12163,8 @@ def __init__( created_date: Optional[datetime.datetime] = None, state: Optional[Union[str, "_models.State"]] = None, api_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_date: Date and time when the issue was created. :paramtype created_date: ~datetime.datetime @@ -11143,8 +12222,8 @@ def __init__( title: Optional[str] = None, description: Optional[str] = None, user_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_date: Date and time when the issue was created. :paramtype created_date: ~datetime.datetime @@ -11205,8 +12284,8 @@ def __init__( title: Optional[str] = None, description: Optional[str] = None, user_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_date: Date and time when the issue was created. :paramtype created_date: ~datetime.datetime @@ -11245,7 +12324,9 @@ class KeyVaultContractCreateProperties(_serialization.Model): "identity_client_id": {"key": "identityClientId", "type": "str"}, } - def __init__(self, *, secret_identifier: Optional[str] = None, identity_client_id: Optional[str] = None, **kwargs): + def __init__( + self, *, secret_identifier: Optional[str] = None, identity_client_id: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword secret_identifier: Key vault secret identifier for fetching secret. Providing a versioned secret will prevent auto-refresh. This requires API Management service to be @@ -11287,8 +12368,8 @@ def __init__( secret_identifier: Optional[str] = None, identity_client_id: Optional[str] = None, last_status: Optional["_models.KeyVaultLastAccessStatusContractProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword secret_identifier: Key vault secret identifier for fetching secret. Providing a versioned secret will prevent auto-refresh. This requires API Management service to be @@ -11329,8 +12410,8 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, time_stamp_utc: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: Last status code for sync and refresh of secret from key vault. :paramtype code: str @@ -11369,8 +12450,8 @@ def __init__( value: Optional[List["_models.LoggerContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Logger values. :paramtype value: list[~azure.mgmt.apimanagement.models.LoggerContract] @@ -11385,7 +12466,7 @@ def __init__( self.next_link = next_link -class LoggerContract(Resource): +class LoggerContract(ProxyResource): """Logger details. Variables are only populated by the server, and will be ignored when sending a request. @@ -11441,8 +12522,8 @@ def __init__( credentials: Optional[Dict[str, str]] = None, is_buffered: Optional[bool] = None, resource_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword logger_type: Logger type. Known values are: "azureEventHub", "applicationInsights", and "azureMonitor". @@ -11497,8 +12578,8 @@ def __init__( description: Optional[str] = None, credentials: Optional[Dict[str, str]] = None, is_buffered: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword logger_type: Logger type. Known values are: "azureEventHub", "applicationInsights", and "azureMonitor". @@ -11541,8 +12622,8 @@ def __init__( value: Optional[List["_models.NamedValueContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Page values. :paramtype value: list[~azure.mgmt.apimanagement.models.NamedValueContract] @@ -11557,7 +12638,7 @@ def __init__( self.next_link = next_link -class NamedValueContract(Resource): +class NamedValueContract(ProxyResource): """NamedValue details. Variables are only populated by the server, and will be ignored when sending a request. @@ -11614,8 +12695,8 @@ def __init__( display_name: Optional[str] = None, value: Optional[str] = None, key_vault: Optional["_models.KeyVaultContractProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Optional tags that when provided can be used to filter the NamedValue list. :paramtype tags: list[str] @@ -11659,7 +12740,7 @@ class NamedValueEntityBaseParameters(_serialization.Model): "secret": {"key": "secret", "type": "bool"}, } - def __init__(self, *, tags: Optional[List[str]] = None, secret: Optional[bool] = None, **kwargs): + def __init__(self, *, tags: Optional[List[str]] = None, secret: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword tags: Optional tags that when provided can be used to filter the NamedValue list. :paramtype tags: list[str] @@ -11715,8 +12796,8 @@ def __init__( secret: Optional[bool] = None, value: Optional[str] = None, key_vault: Optional["_models.KeyVaultContractProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Optional tags that when provided can be used to filter the NamedValue list. :paramtype tags: list[str] @@ -11739,7 +12820,7 @@ def __init__( self.key_vault = key_vault -class NamedValueCreateContract(Resource): +class NamedValueCreateContract(ProxyResource): """NamedValue details. Variables are only populated by the server, and will be ignored when sending a request. @@ -11796,8 +12877,8 @@ def __init__( display_name: Optional[str] = None, value: Optional[str] = None, key_vault: Optional["_models.KeyVaultContractCreateProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Optional tags that when provided can be used to filter the NamedValue list. :paramtype tags: list[str] @@ -11865,8 +12946,8 @@ def __init__( secret: Optional[bool] = None, value: Optional[str] = None, key_vault: Optional["_models.KeyVaultContractCreateProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Optional tags that when provided can be used to filter the NamedValue list. :paramtype tags: list[str] @@ -11900,7 +12981,7 @@ class NamedValueSecretContract(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: This is secret value of the NamedValue entity. :paramtype value: str @@ -11949,8 +13030,8 @@ def __init__( display_name: Optional[str] = None, value: Optional[str] = None, key_vault: Optional["_models.KeyVaultContractCreateProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Optional tags that when provided can be used to filter the NamedValue list. :paramtype tags: list[str] @@ -12012,8 +13093,8 @@ def __init__( display_name: Optional[str] = None, value: Optional[str] = None, key_vault: Optional["_models.KeyVaultContractCreateProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Optional tags that when provided can be used to filter the NamedValue list. :paramtype tags: list[str] @@ -12060,8 +13141,8 @@ class NetworkStatusContract(_serialization.Model): } def __init__( - self, *, dns_servers: List[str], connectivity_status: List["_models.ConnectivityStatusContract"], **kwargs - ): + self, *, dns_servers: List[str], connectivity_status: List["_models.ConnectivityStatusContract"], **kwargs: Any + ) -> None: """ :keyword dns_servers: Gets the list of DNS servers IPV4 addresses. Required. :paramtype dns_servers: list[str] @@ -12098,8 +13179,8 @@ def __init__( *, location: Optional[str] = None, network_status: Optional["_models.NetworkStatusContract"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Location of service. :paramtype location: str @@ -12134,8 +13215,8 @@ def __init__( value: Optional[List["_models.NotificationContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Page values. :paramtype value: list[~azure.mgmt.apimanagement.models.NotificationContract] @@ -12150,7 +13231,7 @@ def __init__( self.next_link = next_link -class NotificationContract(Resource): +class NotificationContract(ProxyResource): """Notification details. Variables are only populated by the server, and will be ignored when sending a request. @@ -12193,8 +13274,8 @@ def __init__( title: Optional[str] = None, description: Optional[str] = None, recipients: Optional["_models.RecipientsContractProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword title: Title of the Notification. :paramtype title: str @@ -12223,7 +13304,9 @@ class OAuth2AuthenticationSettingsContract(_serialization.Model): "scope": {"key": "scope", "type": "str"}, } - def __init__(self, *, authorization_server_id: Optional[str] = None, scope: Optional[str] = None, **kwargs): + def __init__( + self, *, authorization_server_id: Optional[str] = None, scope: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword authorization_server_id: OAuth authorization server identifier. :paramtype authorization_server_id: str @@ -12255,8 +13338,8 @@ def __init__( *, openid_provider_id: Optional[str] = None, bearer_token_sending_methods: Optional[List[Union[str, "_models.BearerTokenSendingMethods"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword openid_provider_id: OAuth authorization server identifier. :paramtype openid_provider_id: str @@ -12292,8 +13375,8 @@ def __init__( value: Optional[List["_models.OpenidConnectProviderContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Page values. :paramtype value: list[~azure.mgmt.apimanagement.models.OpenidConnectProviderContract] @@ -12308,7 +13391,7 @@ def __init__( self.next_link = next_link -class OpenidConnectProviderContract(Resource): +class OpenidConnectProviderContract(ProxyResource): """OpenId Connect Provider details. Variables are only populated by the server, and will be ignored when sending a request. @@ -12331,6 +13414,12 @@ class OpenidConnectProviderContract(Resource): :vartype client_id: str :ivar client_secret: Client Secret of developer console which is the client application. :vartype client_secret: str + :ivar use_in_test_console: If true, the Open ID Connect provider may be used in the developer + portal test console. True by default if no value is provided. + :vartype use_in_test_console: bool + :ivar use_in_api_documentation: If true, the Open ID Connect provider will be used in the API + documentation in the developer portal. False by default if no value is provided. + :vartype use_in_api_documentation: bool """ _validation = { @@ -12349,6 +13438,8 @@ class OpenidConnectProviderContract(Resource): "metadata_endpoint": {"key": "properties.metadataEndpoint", "type": "str"}, "client_id": {"key": "properties.clientId", "type": "str"}, "client_secret": {"key": "properties.clientSecret", "type": "str"}, + "use_in_test_console": {"key": "properties.useInTestConsole", "type": "bool"}, + "use_in_api_documentation": {"key": "properties.useInApiDocumentation", "type": "bool"}, } def __init__( @@ -12359,8 +13450,10 @@ def __init__( metadata_endpoint: Optional[str] = None, client_id: Optional[str] = None, client_secret: Optional[str] = None, - **kwargs - ): + use_in_test_console: Optional[bool] = None, + use_in_api_documentation: Optional[bool] = None, + **kwargs: Any + ) -> None: """ :keyword display_name: User-friendly OpenID Connect Provider name. :paramtype display_name: str @@ -12372,6 +13465,12 @@ def __init__( :paramtype client_id: str :keyword client_secret: Client Secret of developer console which is the client application. :paramtype client_secret: str + :keyword use_in_test_console: If true, the Open ID Connect provider may be used in the + developer portal test console. True by default if no value is provided. + :paramtype use_in_test_console: bool + :keyword use_in_api_documentation: If true, the Open ID Connect provider will be used in the + API documentation in the developer portal. False by default if no value is provided. + :paramtype use_in_api_documentation: bool """ super().__init__(**kwargs) self.display_name = display_name @@ -12379,6 +13478,8 @@ def __init__( self.metadata_endpoint = metadata_endpoint self.client_id = client_id self.client_secret = client_secret + self.use_in_test_console = use_in_test_console + self.use_in_api_documentation = use_in_api_documentation class OpenidConnectProviderUpdateContract(_serialization.Model): @@ -12394,6 +13495,12 @@ class OpenidConnectProviderUpdateContract(_serialization.Model): :vartype client_id: str :ivar client_secret: Client Secret of developer console which is the client application. :vartype client_secret: str + :ivar use_in_test_console: If true, the Open ID Connect provider may be used in the developer + portal test console. True by default if no value is provided. + :vartype use_in_test_console: bool + :ivar use_in_api_documentation: If true, the Open ID Connect provider will be used in the API + documentation in the developer portal. False by default if no value is provided. + :vartype use_in_api_documentation: bool """ _validation = { @@ -12406,6 +13513,8 @@ class OpenidConnectProviderUpdateContract(_serialization.Model): "metadata_endpoint": {"key": "properties.metadataEndpoint", "type": "str"}, "client_id": {"key": "properties.clientId", "type": "str"}, "client_secret": {"key": "properties.clientSecret", "type": "str"}, + "use_in_test_console": {"key": "properties.useInTestConsole", "type": "bool"}, + "use_in_api_documentation": {"key": "properties.useInApiDocumentation", "type": "bool"}, } def __init__( @@ -12416,8 +13525,10 @@ def __init__( metadata_endpoint: Optional[str] = None, client_id: Optional[str] = None, client_secret: Optional[str] = None, - **kwargs - ): + use_in_test_console: Optional[bool] = None, + use_in_api_documentation: Optional[bool] = None, + **kwargs: Any + ) -> None: """ :keyword display_name: User-friendly OpenID Connect Provider name. :paramtype display_name: str @@ -12429,6 +13540,12 @@ def __init__( :paramtype client_id: str :keyword client_secret: Client Secret of developer console which is the client application. :paramtype client_secret: str + :keyword use_in_test_console: If true, the Open ID Connect provider may be used in the + developer portal test console. True by default if no value is provided. + :paramtype use_in_test_console: bool + :keyword use_in_api_documentation: If true, the Open ID Connect provider will be used in the + API documentation in the developer portal. False by default if no value is provided. + :paramtype use_in_api_documentation: bool """ super().__init__(**kwargs) self.display_name = display_name @@ -12436,6 +13553,8 @@ def __init__( self.metadata_endpoint = metadata_endpoint self.client_id = client_id self.client_secret = client_secret + self.use_in_test_console = use_in_test_console + self.use_in_api_documentation = use_in_api_documentation class Operation(_serialization.Model): @@ -12465,8 +13584,8 @@ def __init__( display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, properties: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -12508,7 +13627,7 @@ class OperationCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, count: Optional[int] = None, **kwargs): + def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None: """ :keyword count: Total record count number across all pages. :paramtype count: int @@ -12519,7 +13638,7 @@ def __init__(self, *, count: Optional[int] = None, **kwargs): self.next_link = None -class OperationContract(Resource): # pylint: disable=too-many-instance-attributes +class OperationContract(ProxyResource): # pylint: disable=too-many-instance-attributes """API Operation details. Variables are only populated by the server, and will be ignored when sending a request. @@ -12586,8 +13705,8 @@ def __init__( display_name: Optional[str] = None, method: Optional[str] = None, url_template: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template_parameters: Collection of URL template parameters. :paramtype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] @@ -12654,8 +13773,8 @@ def __init__( request: Optional["_models.RequestContract"] = None, responses: Optional[List["_models.ResponseContract"]] = None, policies: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template_parameters: Collection of URL template parameters. :paramtype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] @@ -12730,8 +13849,8 @@ def __init__( request: Optional["_models.RequestContract"] = None, responses: Optional[List["_models.ResponseContract"]] = None, policies: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template_parameters: Collection of URL template parameters. :paramtype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] @@ -12793,8 +13912,8 @@ def __init__( operation: Optional[str] = None, resource: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Friendly name of the resource provider. :paramtype provider: str @@ -12813,7 +13932,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. + """Result of the request to list REST API operations. It contains a list of operations and a URL + nextLink to get the next set of results. :ivar value: List of operations supported by the resource provider. :vartype value: list[~azure.mgmt.apimanagement.models.Operation] @@ -12826,7 +13946,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of operations supported by the resource provider. :paramtype value: list[~azure.mgmt.apimanagement.models.Operation] @@ -12838,7 +13960,7 @@ def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_li self.next_link = next_link -class OperationResultContract(Resource): +class OperationResultContract(ProxyResource): """Long Running Git Operation Results. Variables are only populated by the server, and will be ignored when sending a request. @@ -12901,8 +14023,8 @@ def __init__( updated: Optional[datetime.datetime] = None, result_info: Optional[str] = None, error: Optional["_models.ErrorResponseBody"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id_properties_id: Operation result identifier. :paramtype id_properties_id: str @@ -12953,8 +14075,8 @@ def __init__( object_type: Optional[str] = None, action: Optional[str] = None, object_key: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword object_type: The type of entity contract. :paramtype object_type: str @@ -13015,7 +14137,7 @@ class OperationTagResourceContractProperties(_serialization.Model): "url_template": {"key": "urlTemplate", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Identifier of the operation in form /operations/{operationId}. :paramtype id: str @@ -13082,8 +14204,8 @@ def __init__( display_name: Optional[str] = None, method: Optional[str] = None, url_template: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template_parameters: Collection of URL template parameters. :paramtype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] @@ -13166,8 +14288,8 @@ def __init__( display_name: Optional[str] = None, method: Optional[str] = None, url_template: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template_parameters: Collection of URL template parameters. :paramtype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] @@ -13202,7 +14324,8 @@ def __init__( class OutboundEnvironmentEndpoint(_serialization.Model): - """Endpoints accessed for a common purpose that the Api Management Service requires outbound network access to. + """Endpoints accessed for a common purpose that the Api Management Service requires outbound + network access to. :ivar category: The type of service accessed by the Api Management Service, e.g., Azure Storage, Azure SQL Database, and Azure Active Directory. @@ -13221,8 +14344,8 @@ def __init__( *, category: Optional[str] = None, endpoints: Optional[List["_models.EndpointDependency"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword category: The type of service accessed by the Api Management Service, e.g., Azure Storage, Azure SQL Database, and Azure Active Directory. @@ -13258,7 +14381,7 @@ class OutboundEnvironmentEndpointList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs: Any) -> None: """ :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.apimanagement.models.OutboundEnvironmentEndpoint] @@ -13322,8 +14445,8 @@ def __init__( schema_id: Optional[str] = None, type_name: Optional[str] = None, examples: Optional[Dict[str, "_models.ParameterExampleContract"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Parameter name. Required. :paramtype name: str @@ -13383,8 +14506,8 @@ def __init__( description: Optional[str] = None, value: Optional[Any] = None, external_value: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword summary: Short description for the example. :paramtype summary: str @@ -13421,8 +14544,8 @@ def __init__( *, request: Optional["_models.HttpMessageDiagnostic"] = None, response: Optional["_models.HttpMessageDiagnostic"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword request: Diagnostic settings for request. :paramtype request: ~azure.mgmt.apimanagement.models.HttpMessageDiagnostic @@ -13457,8 +14580,8 @@ def __init__( value: Optional[List["_models.PolicyContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Policy Contract value. :paramtype value: list[~azure.mgmt.apimanagement.models.PolicyContract] @@ -13473,8 +14596,259 @@ def __init__( self.next_link = next_link -class PolicyContract(Resource): - """Policy Contract details. +class PolicyContract(ProxyResource): + """Policy Contract details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar value: Contents of the Policy as defined by the format. + :vartype value: str + :ivar format: Format of the policyContent. Known values are: "xml", "xml-link", "rawxml", and + "rawxml-link". + :vartype format: str or ~azure.mgmt.apimanagement.models.PolicyContentFormat + """ + + _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"}, + "value": {"key": "properties.value", "type": "str"}, + "format": {"key": "properties.format", "type": "str"}, + } + + def __init__( + self, *, value: Optional[str] = None, format: Union[str, "_models.PolicyContentFormat"] = "xml", **kwargs: Any + ) -> None: + """ + :keyword value: Contents of the Policy as defined by the format. + :paramtype value: str + :keyword format: Format of the policyContent. Known values are: "xml", "xml-link", "rawxml", + and "rawxml-link". + :paramtype format: str or ~azure.mgmt.apimanagement.models.PolicyContentFormat + """ + super().__init__(**kwargs) + self.value = value + self.format = format + + +class PolicyDescriptionCollection(_serialization.Model): + """Descriptions of API Management policies. + + :ivar value: Descriptions of API Management policies. + :vartype value: list[~azure.mgmt.apimanagement.models.PolicyDescriptionContract] + :ivar count: Total record count number. + :vartype count: int + """ + + _attribute_map = { + "value": {"key": "value", "type": "[PolicyDescriptionContract]"}, + "count": {"key": "count", "type": "int"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.PolicyDescriptionContract"]] = None, + count: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Descriptions of API Management policies. + :paramtype value: list[~azure.mgmt.apimanagement.models.PolicyDescriptionContract] + :keyword count: Total record count number. + :paramtype count: int + """ + super().__init__(**kwargs) + self.value = value + self.count = count + + +class PolicyDescriptionContract(ProxyResource): + """Policy description details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar description: Policy description. + :vartype description: str + :ivar scope: Binary OR value of the Snippet scope. + :vartype scope: int + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "description": {"readonly": True}, + "scope": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "scope": {"key": "properties.scope", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.description = None + self.scope = None + + +class PolicyFragmentCollection(_serialization.Model): + """The response of the get policy fragments operation. + + :ivar value: Policy fragment contract value. + :vartype value: list[~azure.mgmt.apimanagement.models.PolicyFragmentContract] + :ivar count: Total record count number. + :vartype count: int + :ivar next_link: Next page link if any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[PolicyFragmentContract]"}, + "count": {"key": "count", "type": "int"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.PolicyFragmentContract"]] = None, + count: Optional[int] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Policy fragment contract value. + :paramtype value: list[~azure.mgmt.apimanagement.models.PolicyFragmentContract] + :keyword count: Total record count number. + :paramtype count: int + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.count = count + self.next_link = next_link + + +class PolicyFragmentContract(ProxyResource): + """Policy fragment contract details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar value: Contents of the policy fragment. + :vartype value: str + :ivar description: Policy fragment description. + :vartype description: str + :ivar format: Format of the policy fragment content. Known values are: "xml" and "rawxml". + :vartype format: str or ~azure.mgmt.apimanagement.models.PolicyFragmentContentFormat + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "description": {"max_length": 1000}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "value": {"key": "properties.value", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "format": {"key": "properties.format", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[str] = None, + description: Optional[str] = None, + format: Optional[Union[str, "_models.PolicyFragmentContentFormat"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Contents of the policy fragment. + :paramtype value: str + :keyword description: Policy fragment description. + :paramtype description: str + :keyword format: Format of the policy fragment content. Known values are: "xml" and "rawxml". + :paramtype format: str or ~azure.mgmt.apimanagement.models.PolicyFragmentContentFormat + """ + super().__init__(**kwargs) + self.value = value + self.description = description + self.format = format + + +class PortalConfigCollection(_serialization.Model): + """The collection of the developer portal configurations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The developer portal configurations. + :vartype value: list[~azure.mgmt.apimanagement.models.PortalConfigContract] + :ivar next_link: Next page link if any. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[PortalConfigContract]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.PortalConfigContract"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The developer portal configurations. + :paramtype value: list[~azure.mgmt.apimanagement.models.PortalConfigContract] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class PortalConfigContract(ProxyResource): + """The developer portal configuration contract. Variables are only populated by the server, and will be ignored when sending a request. @@ -13486,11 +14860,18 @@ class PolicyContract(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar value: Contents of the Policy as defined by the format. - :vartype value: str - :ivar format: Format of the policyContent. Known values are: "xml", "xml-link", "rawxml", and - "rawxml-link". - :vartype format: str or ~azure.mgmt.apimanagement.models.PolicyContentFormat + :ivar enable_basic_auth: Enable or disable Basic authentication method. + :vartype enable_basic_auth: bool + :ivar signin: + :vartype signin: ~azure.mgmt.apimanagement.models.PortalConfigPropertiesSignin + :ivar signup: + :vartype signup: ~azure.mgmt.apimanagement.models.PortalConfigPropertiesSignup + :ivar delegation: The developer portal delegation settings. + :vartype delegation: ~azure.mgmt.apimanagement.models.PortalConfigDelegationProperties + :ivar cors: The developer portal Cross-Origin Resource Sharing (CORS) settings. + :vartype cors: ~azure.mgmt.apimanagement.models.PortalConfigCorsProperties + :ivar csp: The developer portal Content Security Policy (CSP) settings. + :vartype csp: ~azure.mgmt.apimanagement.models.PortalConfigCspProperties """ _validation = { @@ -13503,100 +14884,230 @@ class PolicyContract(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "value": {"key": "properties.value", "type": "str"}, - "format": {"key": "properties.format", "type": "str"}, + "enable_basic_auth": {"key": "properties.enableBasicAuth", "type": "bool"}, + "signin": {"key": "properties.signin", "type": "PortalConfigPropertiesSignin"}, + "signup": {"key": "properties.signup", "type": "PortalConfigPropertiesSignup"}, + "delegation": {"key": "properties.delegation", "type": "PortalConfigDelegationProperties"}, + "cors": {"key": "properties.cors", "type": "PortalConfigCorsProperties"}, + "csp": {"key": "properties.csp", "type": "PortalConfigCspProperties"}, } def __init__( - self, *, value: Optional[str] = None, format: Union[str, "_models.PolicyContentFormat"] = "xml", **kwargs - ): + self, + *, + enable_basic_auth: bool = True, + signin: Optional["_models.PortalConfigPropertiesSignin"] = None, + signup: Optional["_models.PortalConfigPropertiesSignup"] = None, + delegation: Optional["_models.PortalConfigDelegationProperties"] = None, + cors: Optional["_models.PortalConfigCorsProperties"] = None, + csp: Optional["_models.PortalConfigCspProperties"] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Contents of the Policy as defined by the format. - :paramtype value: str - :keyword format: Format of the policyContent. Known values are: "xml", "xml-link", "rawxml", - and "rawxml-link". - :paramtype format: str or ~azure.mgmt.apimanagement.models.PolicyContentFormat + :keyword enable_basic_auth: Enable or disable Basic authentication method. + :paramtype enable_basic_auth: bool + :keyword signin: + :paramtype signin: ~azure.mgmt.apimanagement.models.PortalConfigPropertiesSignin + :keyword signup: + :paramtype signup: ~azure.mgmt.apimanagement.models.PortalConfigPropertiesSignup + :keyword delegation: The developer portal delegation settings. + :paramtype delegation: ~azure.mgmt.apimanagement.models.PortalConfigDelegationProperties + :keyword cors: The developer portal Cross-Origin Resource Sharing (CORS) settings. + :paramtype cors: ~azure.mgmt.apimanagement.models.PortalConfigCorsProperties + :keyword csp: The developer portal Content Security Policy (CSP) settings. + :paramtype csp: ~azure.mgmt.apimanagement.models.PortalConfigCspProperties """ super().__init__(**kwargs) - self.value = value - self.format = format + self.enable_basic_auth = enable_basic_auth + self.signin = signin + self.signup = signup + self.delegation = delegation + self.cors = cors + self.csp = csp -class PolicyDescriptionCollection(_serialization.Model): - """Descriptions of APIM policies. +class PortalConfigCorsProperties(_serialization.Model): + """The developer portal Cross-Origin Resource Sharing (CORS) settings. - :ivar value: Descriptions of APIM policies. - :vartype value: list[~azure.mgmt.apimanagement.models.PolicyDescriptionContract] - :ivar count: Total record count number. - :vartype count: int + :ivar allowed_origins: Allowed origins, e.g. ``https://trusted.com``. + :vartype allowed_origins: list[str] """ _attribute_map = { - "value": {"key": "value", "type": "[PolicyDescriptionContract]"}, - "count": {"key": "count", "type": "int"}, + "allowed_origins": {"key": "allowedOrigins", "type": "[str]"}, + } + + def __init__(self, *, allowed_origins: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword allowed_origins: Allowed origins, e.g. ``https://trusted.com``. + :paramtype allowed_origins: list[str] + """ + super().__init__(**kwargs) + self.allowed_origins = allowed_origins + + +class PortalConfigCspProperties(_serialization.Model): + """The developer portal Content Security Policy (CSP) settings. + + :ivar mode: The mode of the developer portal Content Security Policy (CSP). Known values are: + "enabled", "disabled", and "reportOnly". + :vartype mode: str or ~azure.mgmt.apimanagement.models.PortalSettingsCspMode + :ivar report_uri: The URLs used by the browser to report CSP violations. + :vartype report_uri: list[str] + :ivar allowed_sources: Allowed sources, e.g. ``*.trusted.com``\ , ``trusted.com``\ , + ``https://``. + :vartype allowed_sources: list[str] + """ + + _attribute_map = { + "mode": {"key": "mode", "type": "str"}, + "report_uri": {"key": "reportUri", "type": "[str]"}, + "allowed_sources": {"key": "allowedSources", "type": "[str]"}, } def __init__( self, *, - value: Optional[List["_models.PolicyDescriptionContract"]] = None, - count: Optional[int] = None, - **kwargs - ): + mode: Union[str, "_models.PortalSettingsCspMode"] = "disabled", + report_uri: Optional[List[str]] = None, + allowed_sources: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword mode: The mode of the developer portal Content Security Policy (CSP). Known values + are: "enabled", "disabled", and "reportOnly". + :paramtype mode: str or ~azure.mgmt.apimanagement.models.PortalSettingsCspMode + :keyword report_uri: The URLs used by the browser to report CSP violations. + :paramtype report_uri: list[str] + :keyword allowed_sources: Allowed sources, e.g. ``*.trusted.com``\ , ``trusted.com``\ , + ``https://``. + :paramtype allowed_sources: list[str] """ - :keyword value: Descriptions of APIM policies. - :paramtype value: list[~azure.mgmt.apimanagement.models.PolicyDescriptionContract] - :keyword count: Total record count number. - :paramtype count: int + super().__init__(**kwargs) + self.mode = mode + self.report_uri = report_uri + self.allowed_sources = allowed_sources + + +class PortalConfigDelegationProperties(_serialization.Model): + """PortalConfigDelegationProperties. + + :ivar delegate_registration: Enable or disable delegation for user registration. + :vartype delegate_registration: bool + :ivar delegate_subscription: Enable or disable delegation for product subscriptions. + :vartype delegate_subscription: bool + :ivar delegation_url: A delegation endpoint URL. + :vartype delegation_url: str + :ivar validation_key: A base64-encoded validation key to ensure requests originate from Azure + API Management service. + :vartype validation_key: str + """ + + _attribute_map = { + "delegate_registration": {"key": "delegateRegistration", "type": "bool"}, + "delegate_subscription": {"key": "delegateSubscription", "type": "bool"}, + "delegation_url": {"key": "delegationUrl", "type": "str"}, + "validation_key": {"key": "validationKey", "type": "str"}, + } + + def __init__( + self, + *, + delegate_registration: bool = False, + delegate_subscription: bool = False, + delegation_url: Optional[str] = None, + validation_key: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword delegate_registration: Enable or disable delegation for user registration. + :paramtype delegate_registration: bool + :keyword delegate_subscription: Enable or disable delegation for product subscriptions. + :paramtype delegate_subscription: bool + :keyword delegation_url: A delegation endpoint URL. + :paramtype delegation_url: str + :keyword validation_key: A base64-encoded validation key to ensure requests originate from + Azure API Management service. + :paramtype validation_key: str """ super().__init__(**kwargs) - self.value = value - self.count = count + self.delegate_registration = delegate_registration + self.delegate_subscription = delegate_subscription + self.delegation_url = delegation_url + self.validation_key = validation_key -class PolicyDescriptionContract(Resource): - """Policy description details. +class PortalConfigPropertiesSignin(_serialization.Model): + """PortalConfigPropertiesSignin. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar require: Redirect anonymous users to the sign-in page. + :vartype require: bool + """ - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar description: Policy description. - :vartype description: str - :ivar scope: Binary OR value of the Snippet scope. - :vartype scope: int + _attribute_map = { + "require": {"key": "require", "type": "bool"}, + } + + def __init__(self, *, require: bool = False, **kwargs: Any) -> None: + """ + :keyword require: Redirect anonymous users to the sign-in page. + :paramtype require: bool + """ + super().__init__(**kwargs) + self.require = require + + +class PortalConfigPropertiesSignup(_serialization.Model): + """PortalConfigPropertiesSignup. + + :ivar terms_of_service: Terms of service settings. + :vartype terms_of_service: + ~azure.mgmt.apimanagement.models.PortalConfigTermsOfServiceProperties """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "description": {"readonly": True}, - "scope": {"readonly": True}, + _attribute_map = { + "terms_of_service": {"key": "termsOfService", "type": "PortalConfigTermsOfServiceProperties"}, } + def __init__( + self, *, terms_of_service: Optional["_models.PortalConfigTermsOfServiceProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword terms_of_service: Terms of service settings. + :paramtype terms_of_service: + ~azure.mgmt.apimanagement.models.PortalConfigTermsOfServiceProperties + """ + super().__init__(**kwargs) + self.terms_of_service = terms_of_service + + +class PortalConfigTermsOfServiceProperties(_serialization.Model): + """Terms of service contract properties. + + :ivar text: A terms of service text. + :vartype text: str + :ivar require_consent: Ask user for consent to the terms of service. + :vartype require_consent: bool + """ + _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "scope": {"key": "properties.scope", "type": "int"}, + "text": {"key": "text", "type": "str"}, + "require_consent": {"key": "requireConsent", "type": "bool"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, text: Optional[str] = None, require_consent: bool = False, **kwargs: Any) -> None: + """ + :keyword text: A terms of service text. + :paramtype text: str + :keyword require_consent: Ask user for consent to the terms of service. + :paramtype require_consent: bool + """ super().__init__(**kwargs) - self.description = None - self.scope = None + self.text = text + self.require_consent = require_consent -class PortalDelegationSettings(Resource): +class PortalDelegationSettings(ProxyResource): """Delegation settings for a developer portal. Variables are only populated by the server, and will be ignored when sending a request. @@ -13645,8 +15156,8 @@ def __init__( validation_key: Optional[str] = None, subscriptions: Optional["_models.SubscriptionsDelegationSettingsProperties"] = None, user_registration: Optional["_models.RegistrationDelegationSettingsProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword url: A delegation Url. :paramtype url: str @@ -13688,14 +15199,14 @@ class PortalRevisionCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None self.next_link = None -class PortalRevisionContract(Resource): +class PortalRevisionContract(ProxyResource): """Portal Revision's contract details. Variables are only populated by the server, and will be ignored when sending a request. @@ -13746,7 +15257,7 @@ class PortalRevisionContract(Resource): "updated_date_time": {"key": "properties.updatedDateTime", "type": "iso-8601"}, } - def __init__(self, *, description: Optional[str] = None, is_current: Optional[bool] = None, **kwargs): + def __init__(self, *, description: Optional[str] = None, is_current: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword description: Portal revision description. :paramtype description: str @@ -13763,9 +15274,9 @@ def __init__(self, *, description: Optional[str] = None, is_current: Optional[bo class PortalSettingsCollection(_serialization.Model): - """Descriptions of APIM policies. + """Descriptions of API Management policies. - :ivar value: Descriptions of APIM policies. + :ivar value: Descriptions of API Management policies. :vartype value: list[~azure.mgmt.apimanagement.models.PortalSettingsContract] :ivar count: Total record count number. :vartype count: int @@ -13777,10 +15288,14 @@ class PortalSettingsCollection(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PortalSettingsContract"]] = None, count: Optional[int] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PortalSettingsContract"]] = None, + count: Optional[int] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Descriptions of APIM policies. + :keyword value: Descriptions of API Management policies. :paramtype value: list[~azure.mgmt.apimanagement.models.PortalSettingsContract] :keyword count: Total record count number. :paramtype count: int @@ -13790,7 +15305,7 @@ def __init__( self.count = count -class PortalSettingsContract(Resource): +class PortalSettingsContract(ProxyResource): """Portal Settings for the Developer Portal. Variables are only populated by the server, and will be ignored when sending a request. @@ -13847,8 +15362,8 @@ def __init__( user_registration: Optional["_models.RegistrationDelegationSettingsProperties"] = None, enabled: Optional[bool] = None, terms_of_service: Optional["_models.TermsOfServiceProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword url: A delegation Url. :paramtype url: str @@ -13886,7 +15401,7 @@ class PortalSettingValidationKeyContract(_serialization.Model): "validation_key": {"key": "validationKey", "type": "str"}, } - def __init__(self, *, validation_key: Optional[str] = None, **kwargs): + def __init__(self, *, validation_key: Optional[str] = None, **kwargs: Any) -> None: """ :keyword validation_key: This is secret value of the validation key in portal settings. :paramtype validation_key: str @@ -13895,7 +15410,7 @@ def __init__(self, *, validation_key: Optional[str] = None, **kwargs): self.validation_key = validation_key -class PortalSigninSettings(Resource): +class PortalSigninSettings(ProxyResource): """Sign-In settings for the Developer Portal. Variables are only populated by the server, and will be ignored when sending a request. @@ -13925,7 +15440,7 @@ class PortalSigninSettings(Resource): "enabled": {"key": "properties.enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Redirect Anonymous users to the Sign-In page. :paramtype enabled: bool @@ -13934,7 +15449,7 @@ def __init__(self, *, enabled: Optional[bool] = None, **kwargs): self.enabled = enabled -class PortalSignupSettings(Resource): +class PortalSignupSettings(ProxyResource): """Sign-Up settings for a developer portal. Variables are only populated by the server, and will be ignored when sending a request. @@ -13972,8 +15487,8 @@ def __init__( *, enabled: Optional[bool] = None, terms_of_service: Optional["_models.TermsOfServiceProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Allow users to sign up on a developer portal. :paramtype enabled: bool @@ -14002,7 +15517,7 @@ class PrivateEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -14052,115 +15567,268 @@ class PrivateEndpointConnection(Resource): "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } - def __init__( - self, - *, - private_endpoint: Optional["_models.PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs - ): + def __init__( + self, + *, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + **kwargs: Any + ) -> None: + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.apimanagement.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState + """ + super().__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None + + +class PrivateEndpointConnectionListResult(_serialization.Model): + """List of private endpoint connection associated with the specified storage account. + + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.apimanagement.models.PrivateEndpointConnection] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, + } + + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.apimanagement.models.PrivateEndpointConnection] + """ + super().__init__(**kwargs) + self.value = value + + +class PrivateEndpointConnectionRequest(_serialization.Model): + """A request to approve or reject a private endpoint connection. + + :ivar id: Private Endpoint Connection Resource Id. + :vartype id: str + :ivar properties: The connection state of the private endpoint connection. + :vartype properties: + ~azure.mgmt.apimanagement.models.PrivateEndpointConnectionRequestProperties + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "properties": {"key": "properties", "type": "PrivateEndpointConnectionRequestProperties"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + properties: Optional["_models.PrivateEndpointConnectionRequestProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Private Endpoint Connection Resource Id. + :paramtype id: str + :keyword properties: The connection state of the private endpoint connection. + :paramtype properties: + ~azure.mgmt.apimanagement.models.PrivateEndpointConnectionRequestProperties + """ + super().__init__(**kwargs) + self.id = id + self.properties = properties + + +class PrivateEndpointConnectionRequestProperties(_serialization.Model): + """The connection state of the private endpoint connection. + + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState + """ + + _attribute_map = { + "private_link_service_connection_state": { + "key": "privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, + } + + def __init__( + self, + *, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + **kwargs: Any + ) -> None: + """ + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState + """ + super().__init__(**kwargs) + self.private_link_service_connection_state = private_link_service_connection_state + + +class PrivateLinkResource(Resource): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "group_id": {"readonly": True}, + "required_members": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "properties.groupId", "type": "str"}, + "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, + "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, + } + + def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs: Any) -> None: """ - :keyword private_endpoint: The resource of private end point. - :paramtype private_endpoint: ~azure.mgmt.apimanagement.models.PrivateEndpoint - :keyword private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :paramtype private_link_service_connection_state: - ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] """ super().__init__(**kwargs) - self.private_endpoint = private_endpoint - self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state = None + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names -class PrivateEndpointConnectionListResult(_serialization.Model): - """List of private endpoint connection associated with the specified storage account. +class PrivateLinkResourceListResult(_serialization.Model): + """A list of private link resources. - :ivar value: Array of private endpoint connections. - :vartype value: list[~azure.mgmt.apimanagement.models.PrivateEndpointConnection] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.apimanagement.models.PrivateLinkResource] """ _attribute_map = { - "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: """ - :keyword value: Array of private endpoint connections. - :paramtype value: list[~azure.mgmt.apimanagement.models.PrivateEndpointConnection] + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.apimanagement.models.PrivateLinkResource] """ super().__init__(**kwargs) self.value = value -class PrivateEndpointConnectionRequest(_serialization.Model): - """A request to approve or reject a private endpoint connection. +class PrivateLinkServiceConnectionState(_serialization.Model): + """A collection of information about the state of the connection between service consumer and + provider. - :ivar id: Private Endpoint Connection Resource Id. - :vartype id: str - :ivar properties: The connection state of the private endpoint connection. - :vartype properties: - ~azure.mgmt.apimanagement.models.PrivateEndpointConnectionRequestProperties + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Known values are: "Pending", "Approved", and "Rejected". + :vartype status: str or ~azure.mgmt.apimanagement.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str """ _attribute_map = { - "id": {"key": "id", "type": "str"}, - "properties": {"key": "properties", "type": "PrivateEndpointConnectionRequestProperties"}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "actions_required": {"key": "actionsRequired", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - properties: Optional["_models.PrivateEndpointConnectionRequestProperties"] = None, - **kwargs - ): + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword id: Private Endpoint Connection Resource Id. - :paramtype id: str - :keyword properties: The connection state of the private endpoint connection. - :paramtype properties: - ~azure.mgmt.apimanagement.models.PrivateEndpointConnectionRequestProperties + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Known values are: "Pending", "Approved", and "Rejected". + :paramtype status: str or + ~azure.mgmt.apimanagement.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str """ super().__init__(**kwargs) - self.id = id - self.properties = properties + self.status = status + self.description = description + self.actions_required = actions_required -class PrivateEndpointConnectionRequestProperties(_serialization.Model): - """The connection state of the private endpoint connection. +class ProductCollection(_serialization.Model): + """Paged Products list representation. - :ivar private_link_service_connection_state: A collection of information about the state of the - connection between service consumer and provider. - :vartype private_link_service_connection_state: - ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.ProductContract] + :ivar count: Total record count number across all pages. + :vartype count: int + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { - "private_link_service_connection_state": { - "key": "privateLinkServiceConnectionState", - "type": "PrivateLinkServiceConnectionState", - }, + "value": {"key": "value", "type": "[ProductContract]"}, + "count": {"key": "count", "type": "int"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( self, *, - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs - ): + value: Optional[List["_models.ProductContract"]] = None, + count: Optional[int] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :paramtype private_link_service_connection_state: - ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.ProductContract] + :keyword count: Total record count number across all pages. + :paramtype count: int + :keyword next_link: Next page link if any. + :paramtype next_link: str """ super().__init__(**kwargs) - self.private_link_service_connection_state = private_link_service_connection_state + self.value = value + self.count = count + self.next_link = next_link -class PrivateLinkResource(Resource): - """A private link resource. +class ProductContract(ProxyResource): + """Product details. Variables are only populated by the server, and will be ignored when sending a request. @@ -14172,158 +15840,419 @@ class PrivateLinkResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :ivar required_zone_names: The private link resource Private link DNS zone name. - :vartype required_zone_names: list[str] + :ivar description: Product description. May include HTML formatting tags. + :vartype description: str + :ivar terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :vartype terms: str + :ivar subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :vartype subscription_required: bool + :ivar approval_required: whether subscription approval is required. If false, new subscriptions + will be approved automatically enabling developers to call the product’s APIs immediately after + subscribing. If true, administrators must manually approve the subscription before the + developer can any of the product’s APIs. Can be present only if subscriptionRequired property + is present and has a value of false. + :vartype approval_required: bool + :ivar subscriptions_limit: Whether the number of subscriptions a user can have to this product + at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present + only if subscriptionRequired property is present and has a value of false. + :vartype subscriptions_limit: int + :ivar state: whether product is published or not. Published products are discoverable by users + of developer portal. Non published products are visible only to administrators. Default state + of Product is notPublished. Known values are: "notPublished" and "published". + :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState + :ivar display_name: Product name. + :vartype display_name: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "description": {"max_length": 1000}, + "display_name": {"max_length": 300, "min_length": 1}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "terms": {"key": "properties.terms", "type": "str"}, + "subscription_required": {"key": "properties.subscriptionRequired", "type": "bool"}, + "approval_required": {"key": "properties.approvalRequired", "type": "bool"}, + "subscriptions_limit": {"key": "properties.subscriptionsLimit", "type": "int"}, + "state": {"key": "properties.state", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + terms: Optional[str] = None, + subscription_required: Optional[bool] = None, + approval_required: Optional[bool] = None, + subscriptions_limit: Optional[int] = None, + state: Optional[Union[str, "_models.ProductState"]] = None, + display_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: Product description. May include HTML formatting tags. + :paramtype description: str + :keyword terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :paramtype terms: str + :keyword subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :paramtype subscription_required: bool + :keyword approval_required: whether subscription approval is required. If false, new + subscriptions will be approved automatically enabling developers to call the product’s APIs + immediately after subscribing. If true, administrators must manually approve the subscription + before the developer can any of the product’s APIs. Can be present only if subscriptionRequired + property is present and has a value of false. + :paramtype approval_required: bool + :keyword subscriptions_limit: Whether the number of subscriptions a user can have to this + product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be + present only if subscriptionRequired property is present and has a value of false. + :paramtype subscriptions_limit: int + :keyword state: whether product is published or not. Published products are discoverable by + users of developer portal. Non published products are visible only to administrators. Default + state of Product is notPublished. Known values are: "notPublished" and "published". + :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState + :keyword display_name: Product name. + :paramtype display_name: str + """ + super().__init__(**kwargs) + self.description = description + self.terms = terms + self.subscription_required = subscription_required + self.approval_required = approval_required + self.subscriptions_limit = subscriptions_limit + self.state = state + self.display_name = display_name + + +class ProductEntityBaseParameters(_serialization.Model): + """Product Entity Base Parameters. + + :ivar description: Product description. May include HTML formatting tags. + :vartype description: str + :ivar terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :vartype terms: str + :ivar subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :vartype subscription_required: bool + :ivar approval_required: whether subscription approval is required. If false, new subscriptions + will be approved automatically enabling developers to call the product’s APIs immediately after + subscribing. If true, administrators must manually approve the subscription before the + developer can any of the product’s APIs. Can be present only if subscriptionRequired property + is present and has a value of false. + :vartype approval_required: bool + :ivar subscriptions_limit: Whether the number of subscriptions a user can have to this product + at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present + only if subscriptionRequired property is present and has a value of false. + :vartype subscriptions_limit: int + :ivar state: whether product is published or not. Published products are discoverable by users + of developer portal. Non published products are visible only to administrators. Default state + of Product is notPublished. Known values are: "notPublished" and "published". + :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "group_id": {"readonly": True}, - "required_members": {"readonly": True}, + "description": {"max_length": 1000}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "group_id": {"key": "properties.groupId", "type": "str"}, - "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, - "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, + "description": {"key": "description", "type": "str"}, + "terms": {"key": "terms", "type": "str"}, + "subscription_required": {"key": "subscriptionRequired", "type": "bool"}, + "approval_required": {"key": "approvalRequired", "type": "bool"}, + "subscriptions_limit": {"key": "subscriptionsLimit", "type": "int"}, + "state": {"key": "state", "type": "str"}, } - def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs): + def __init__( + self, + *, + description: Optional[str] = None, + terms: Optional[str] = None, + subscription_required: Optional[bool] = None, + approval_required: Optional[bool] = None, + subscriptions_limit: Optional[int] = None, + state: Optional[Union[str, "_models.ProductState"]] = None, + **kwargs: Any + ) -> None: """ - :keyword required_zone_names: The private link resource Private link DNS zone name. - :paramtype required_zone_names: list[str] + :keyword description: Product description. May include HTML formatting tags. + :paramtype description: str + :keyword terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :paramtype terms: str + :keyword subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :paramtype subscription_required: bool + :keyword approval_required: whether subscription approval is required. If false, new + subscriptions will be approved automatically enabling developers to call the product’s APIs + immediately after subscribing. If true, administrators must manually approve the subscription + before the developer can any of the product’s APIs. Can be present only if subscriptionRequired + property is present and has a value of false. + :paramtype approval_required: bool + :keyword subscriptions_limit: Whether the number of subscriptions a user can have to this + product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be + present only if subscriptionRequired property is present and has a value of false. + :paramtype subscriptions_limit: int + :keyword state: whether product is published or not. Published products are discoverable by + users of developer portal. Non published products are visible only to administrators. Default + state of Product is notPublished. Known values are: "notPublished" and "published". + :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState """ super().__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = required_zone_names - - -class PrivateLinkResourceListResult(_serialization.Model): - """A list of private link resources. - - :ivar value: Array of private link resources. - :vartype value: list[~azure.mgmt.apimanagement.models.PrivateLinkResource] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateLinkResource]"}, - } + self.description = description + self.terms = terms + self.subscription_required = subscription_required + self.approval_required = approval_required + self.subscriptions_limit = subscriptions_limit + self.state = state - def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): - """ - :keyword value: Array of private link resources. - :paramtype value: list[~azure.mgmt.apimanagement.models.PrivateLinkResource] - """ - super().__init__(**kwargs) - self.value = value +class ProductContractProperties(ProductEntityBaseParameters): + """Product profile. -class PrivateLinkServiceConnectionState(_serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. + All required parameters must be populated in order to send to Azure. - :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Known values are: "Pending", "Approved", and "Rejected". - :vartype status: str or ~azure.mgmt.apimanagement.models.PrivateEndpointServiceConnectionStatus - :ivar description: The reason for approval/rejection of the connection. + :ivar description: Product description. May include HTML formatting tags. :vartype description: str - :ivar actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :vartype actions_required: str + :ivar terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :vartype terms: str + :ivar subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :vartype subscription_required: bool + :ivar approval_required: whether subscription approval is required. If false, new subscriptions + will be approved automatically enabling developers to call the product’s APIs immediately after + subscribing. If true, administrators must manually approve the subscription before the + developer can any of the product’s APIs. Can be present only if subscriptionRequired property + is present and has a value of false. + :vartype approval_required: bool + :ivar subscriptions_limit: Whether the number of subscriptions a user can have to this product + at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present + only if subscriptionRequired property is present and has a value of false. + :vartype subscriptions_limit: int + :ivar state: whether product is published or not. Published products are discoverable by users + of developer portal. Non published products are visible only to administrators. Default state + of Product is notPublished. Known values are: "notPublished" and "published". + :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState + :ivar display_name: Product name. Required. + :vartype display_name: str """ + _validation = { + "description": {"max_length": 1000}, + "display_name": {"required": True, "max_length": 300, "min_length": 1}, + } + _attribute_map = { - "status": {"key": "status", "type": "str"}, "description": {"key": "description", "type": "str"}, - "actions_required": {"key": "actionsRequired", "type": "str"}, + "terms": {"key": "terms", "type": "str"}, + "subscription_required": {"key": "subscriptionRequired", "type": "bool"}, + "approval_required": {"key": "approvalRequired", "type": "bool"}, + "subscriptions_limit": {"key": "subscriptionsLimit", "type": "int"}, + "state": {"key": "state", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, } def __init__( self, *, - status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, + display_name: str, description: Optional[str] = None, - actions_required: Optional[str] = None, - **kwargs - ): + terms: Optional[str] = None, + subscription_required: Optional[bool] = None, + approval_required: Optional[bool] = None, + subscriptions_limit: Optional[int] = None, + state: Optional[Union[str, "_models.ProductState"]] = None, + **kwargs: Any + ) -> None: """ - :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the - owner of the service. Known values are: "Pending", "Approved", and "Rejected". - :paramtype status: str or - ~azure.mgmt.apimanagement.models.PrivateEndpointServiceConnectionStatus - :keyword description: The reason for approval/rejection of the connection. + :keyword description: Product description. May include HTML formatting tags. :paramtype description: str - :keyword actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :paramtype actions_required: str + :keyword terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :paramtype terms: str + :keyword subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :paramtype subscription_required: bool + :keyword approval_required: whether subscription approval is required. If false, new + subscriptions will be approved automatically enabling developers to call the product’s APIs + immediately after subscribing. If true, administrators must manually approve the subscription + before the developer can any of the product’s APIs. Can be present only if subscriptionRequired + property is present and has a value of false. + :paramtype approval_required: bool + :keyword subscriptions_limit: Whether the number of subscriptions a user can have to this + product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be + present only if subscriptionRequired property is present and has a value of false. + :paramtype subscriptions_limit: int + :keyword state: whether product is published or not. Published products are discoverable by + users of developer portal. Non published products are visible only to administrators. Default + state of Product is notPublished. Known values are: "notPublished" and "published". + :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState + :keyword display_name: Product name. Required. + :paramtype display_name: str """ - super().__init__(**kwargs) - self.status = status - self.description = description - self.actions_required = actions_required + super().__init__( + description=description, + terms=terms, + subscription_required=subscription_required, + approval_required=approval_required, + subscriptions_limit=subscriptions_limit, + state=state, + **kwargs + ) + self.display_name = display_name -class ProductCollection(_serialization.Model): - """Paged Products list representation. +class ProductTagResourceContractProperties(ProductEntityBaseParameters): + """Product profile. - :ivar value: Page values. - :vartype value: list[~azure.mgmt.apimanagement.models.ProductContract] - :ivar count: Total record count number across all pages. - :vartype count: int - :ivar next_link: Next page link if any. - :vartype next_link: str + All required parameters must be populated in order to send to Azure. + + :ivar description: Product description. May include HTML formatting tags. + :vartype description: str + :ivar terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :vartype terms: str + :ivar subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :vartype subscription_required: bool + :ivar approval_required: whether subscription approval is required. If false, new subscriptions + will be approved automatically enabling developers to call the product’s APIs immediately after + subscribing. If true, administrators must manually approve the subscription before the + developer can any of the product’s APIs. Can be present only if subscriptionRequired property + is present and has a value of false. + :vartype approval_required: bool + :ivar subscriptions_limit: Whether the number of subscriptions a user can have to this product + at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present + only if subscriptionRequired property is present and has a value of false. + :vartype subscriptions_limit: int + :ivar state: whether product is published or not. Published products are discoverable by users + of developer portal. Non published products are visible only to administrators. Default state + of Product is notPublished. Known values are: "notPublished" and "published". + :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState + :ivar id: Identifier of the product in the form of /products/{productId}. + :vartype id: str + :ivar name: Product name. Required. + :vartype name: str """ + _validation = { + "description": {"max_length": 1000}, + "name": {"required": True, "max_length": 300, "min_length": 1}, + } + _attribute_map = { - "value": {"key": "value", "type": "[ProductContract]"}, - "count": {"key": "count", "type": "int"}, - "next_link": {"key": "nextLink", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "terms": {"key": "terms", "type": "str"}, + "subscription_required": {"key": "subscriptionRequired", "type": "bool"}, + "approval_required": {"key": "approvalRequired", "type": "bool"}, + "subscriptions_limit": {"key": "subscriptionsLimit", "type": "int"}, + "state": {"key": "state", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, } def __init__( self, *, - value: Optional[List["_models.ProductContract"]] = None, - count: Optional[int] = None, - next_link: Optional[str] = None, - **kwargs - ): + name: str, + description: Optional[str] = None, + terms: Optional[str] = None, + subscription_required: Optional[bool] = None, + approval_required: Optional[bool] = None, + subscriptions_limit: Optional[int] = None, + state: Optional[Union[str, "_models.ProductState"]] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: """ - :keyword value: Page values. - :paramtype value: list[~azure.mgmt.apimanagement.models.ProductContract] - :keyword count: Total record count number across all pages. - :paramtype count: int - :keyword next_link: Next page link if any. - :paramtype next_link: str + :keyword description: Product description. May include HTML formatting tags. + :paramtype description: str + :keyword terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :paramtype terms: str + :keyword subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :paramtype subscription_required: bool + :keyword approval_required: whether subscription approval is required. If false, new + subscriptions will be approved automatically enabling developers to call the product’s APIs + immediately after subscribing. If true, administrators must manually approve the subscription + before the developer can any of the product’s APIs. Can be present only if subscriptionRequired + property is present and has a value of false. + :paramtype approval_required: bool + :keyword subscriptions_limit: Whether the number of subscriptions a user can have to this + product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be + present only if subscriptionRequired property is present and has a value of false. + :paramtype subscriptions_limit: int + :keyword state: whether product is published or not. Published products are discoverable by + users of developer portal. Non published products are visible only to administrators. Default + state of Product is notPublished. Known values are: "notPublished" and "published". + :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState + :keyword id: Identifier of the product in the form of /products/{productId}. + :paramtype id: str + :keyword name: Product name. Required. + :paramtype name: str """ - super().__init__(**kwargs) - self.value = value - self.count = count - self.next_link = next_link - + super().__init__( + description=description, + terms=terms, + subscription_required=subscription_required, + approval_required=approval_required, + subscriptions_limit=subscriptions_limit, + state=state, + **kwargs + ) + self.id = id + self.name = name -class ProductContract(Resource): - """Product details. - Variables are only populated by the server, and will be ignored when sending a request. +class ProductUpdateParameters(_serialization.Model): + """Product Update parameters. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str :ivar description: Product description. May include HTML formatting tags. :vartype description: str :ivar terms: Product terms of use. Developers trying to subscribe to the product will be @@ -14355,17 +16284,11 @@ class ProductContract(Resource): """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, "description": {"max_length": 1000}, "display_name": {"max_length": 300, "min_length": 1}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "terms": {"key": "properties.terms", "type": "str"}, "subscription_required": {"key": "properties.subscriptionRequired", "type": "bool"}, @@ -14385,8 +16308,8 @@ def __init__( subscriptions_limit: Optional[int] = None, state: Optional[Union[str, "_models.ProductState"]] = None, display_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Product description. May include HTML formatting tags. :paramtype description: str @@ -14427,8 +16350,8 @@ def __init__( self.display_name = display_name -class ProductEntityBaseParameters(_serialization.Model): - """Product Entity Base Parameters. +class ProductUpdateProperties(ProductEntityBaseParameters): + """Parameters supplied to the Update Product operation. :ivar description: Product description. May include HTML formatting tags. :vartype description: str @@ -14456,10 +16379,13 @@ class ProductEntityBaseParameters(_serialization.Model): of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Known values are: "notPublished" and "published". :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState + :ivar display_name: Product name. + :vartype display_name: str """ _validation = { "description": {"max_length": 1000}, + "display_name": {"max_length": 300, "min_length": 1}, } _attribute_map = { @@ -14469,6 +16395,7 @@ class ProductEntityBaseParameters(_serialization.Model): "approval_required": {"key": "approvalRequired", "type": "bool"}, "subscriptions_limit": {"key": "subscriptionsLimit", "type": "int"}, "state": {"key": "state", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, } def __init__( @@ -14480,8 +16407,9 @@ def __init__( approval_required: Optional[bool] = None, subscriptions_limit: Optional[int] = None, state: Optional[Union[str, "_models.ProductState"]] = None, - **kwargs - ): + display_name: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword description: Product description. May include HTML formatting tags. :paramtype description: str @@ -14509,438 +16437,321 @@ def __init__( users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Known values are: "notPublished" and "published". :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState + :keyword display_name: Product name. + :paramtype display_name: str + """ + super().__init__( + description=description, + terms=terms, + subscription_required=subscription_required, + approval_required=approval_required, + subscriptions_limit=subscriptions_limit, + state=state, + **kwargs + ) + self.display_name = display_name + + +class QuotaCounterCollection(_serialization.Model): + """Paged Quota Counter list representation. + + :ivar value: Quota counter values. + :vartype value: list[~azure.mgmt.apimanagement.models.QuotaCounterContract] + :ivar count: Total record count number across all pages. + :vartype count: int + :ivar next_link: Next page link if any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[QuotaCounterContract]"}, + "count": {"key": "count", "type": "int"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.QuotaCounterContract"]] = None, + count: Optional[int] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Quota counter values. + :paramtype value: list[~azure.mgmt.apimanagement.models.QuotaCounterContract] + :keyword count: Total record count number across all pages. + :paramtype count: int + :keyword next_link: Next page link if any. + :paramtype next_link: str """ super().__init__(**kwargs) - self.description = description - self.terms = terms - self.subscription_required = subscription_required - self.approval_required = approval_required - self.subscriptions_limit = subscriptions_limit - self.state = state + self.value = value + self.count = count + self.next_link = next_link -class ProductContractProperties(ProductEntityBaseParameters): - """Product profile. +class QuotaCounterContract(_serialization.Model): + """Quota counter details. All required parameters must be populated in order to send to Azure. - :ivar description: Product description. May include HTML formatting tags. - :vartype description: str - :ivar terms: Product terms of use. Developers trying to subscribe to the product will be - presented and required to accept these terms before they can complete the subscription process. - :vartype terms: str - :ivar subscription_required: Whether a product subscription is required for accessing APIs - included in this product. If true, the product is referred to as "protected" and a valid - subscription key is required for a request to an API included in the product to succeed. If - false, the product is referred to as "open" and requests to an API included in the product can - be made without a subscription key. If property is omitted when creating a new product it's - value is assumed to be true. - :vartype subscription_required: bool - :ivar approval_required: whether subscription approval is required. If false, new subscriptions - will be approved automatically enabling developers to call the product’s APIs immediately after - subscribing. If true, administrators must manually approve the subscription before the - developer can any of the product’s APIs. Can be present only if subscriptionRequired property - is present and has a value of false. - :vartype approval_required: bool - :ivar subscriptions_limit: Whether the number of subscriptions a user can have to this product - at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present - only if subscriptionRequired property is present and has a value of false. - :vartype subscriptions_limit: int - :ivar state: whether product is published or not. Published products are discoverable by users - of developer portal. Non published products are visible only to administrators. Default state - of Product is notPublished. Known values are: "notPublished" and "published". - :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState - :ivar display_name: Product name. Required. - :vartype display_name: str + :ivar counter_key: The Key value of the Counter. Must not be empty. Required. + :vartype counter_key: str + :ivar period_key: Identifier of the Period for which the counter was collected. Must not be + empty. Required. + :vartype period_key: str + :ivar period_start_time: The date of the start of Counter Period. The date conforms to the + following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. Required. + :vartype period_start_time: ~datetime.datetime + :ivar period_end_time: The date of the end of Counter Period. The date conforms to the + following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. Required. + :vartype period_end_time: ~datetime.datetime + :ivar value: Quota Value Properties. + :vartype value: ~azure.mgmt.apimanagement.models.QuotaCounterValueContractProperties + """ + + _validation = { + "counter_key": {"required": True, "min_length": 1}, + "period_key": {"required": True, "min_length": 1}, + "period_start_time": {"required": True}, + "period_end_time": {"required": True}, + } + + _attribute_map = { + "counter_key": {"key": "counterKey", "type": "str"}, + "period_key": {"key": "periodKey", "type": "str"}, + "period_start_time": {"key": "periodStartTime", "type": "iso-8601"}, + "period_end_time": {"key": "periodEndTime", "type": "iso-8601"}, + "value": {"key": "value", "type": "QuotaCounterValueContractProperties"}, + } + + def __init__( + self, + *, + counter_key: str, + period_key: str, + period_start_time: datetime.datetime, + period_end_time: datetime.datetime, + value: Optional["_models.QuotaCounterValueContractProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword counter_key: The Key value of the Counter. Must not be empty. Required. + :paramtype counter_key: str + :keyword period_key: Identifier of the Period for which the counter was collected. Must not be + empty. Required. + :paramtype period_key: str + :keyword period_start_time: The date of the start of Counter Period. The date conforms to the + following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. Required. + :paramtype period_start_time: ~datetime.datetime + :keyword period_end_time: The date of the end of Counter Period. The date conforms to the + following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. Required. + :paramtype period_end_time: ~datetime.datetime + :keyword value: Quota Value Properties. + :paramtype value: ~azure.mgmt.apimanagement.models.QuotaCounterValueContractProperties + """ + super().__init__(**kwargs) + self.counter_key = counter_key + self.period_key = period_key + self.period_start_time = period_start_time + self.period_end_time = period_end_time + self.value = value + + +class QuotaCounterValueContract(_serialization.Model): + """Quota counter value details. + + :ivar calls_count: Number of times Counter was called. + :vartype calls_count: int + :ivar kb_transferred: Data Transferred in KiloBytes. + :vartype kb_transferred: float """ - _validation = { - "description": {"max_length": 1000}, - "display_name": {"required": True, "max_length": 300, "min_length": 1}, - } + _attribute_map = { + "calls_count": {"key": "value.callsCount", "type": "int"}, + "kb_transferred": {"key": "value.kbTransferred", "type": "float"}, + } + + def __init__( + self, *, calls_count: Optional[int] = None, kb_transferred: Optional[float] = None, **kwargs: Any + ) -> None: + """ + :keyword calls_count: Number of times Counter was called. + :paramtype calls_count: int + :keyword kb_transferred: Data Transferred in KiloBytes. + :paramtype kb_transferred: float + """ + super().__init__(**kwargs) + self.calls_count = calls_count + self.kb_transferred = kb_transferred + + +class QuotaCounterValueContractProperties(_serialization.Model): + """Quota counter value details. + + :ivar calls_count: Number of times Counter was called. + :vartype calls_count: int + :ivar kb_transferred: Data Transferred in KiloBytes. + :vartype kb_transferred: float + """ _attribute_map = { - "description": {"key": "description", "type": "str"}, - "terms": {"key": "terms", "type": "str"}, - "subscription_required": {"key": "subscriptionRequired", "type": "bool"}, - "approval_required": {"key": "approvalRequired", "type": "bool"}, - "subscriptions_limit": {"key": "subscriptionsLimit", "type": "int"}, - "state": {"key": "state", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, + "calls_count": {"key": "callsCount", "type": "int"}, + "kb_transferred": {"key": "kbTransferred", "type": "float"}, } def __init__( - self, - *, - display_name: str, - description: Optional[str] = None, - terms: Optional[str] = None, - subscription_required: Optional[bool] = None, - approval_required: Optional[bool] = None, - subscriptions_limit: Optional[int] = None, - state: Optional[Union[str, "_models.ProductState"]] = None, - **kwargs - ): + self, *, calls_count: Optional[int] = None, kb_transferred: Optional[float] = None, **kwargs: Any + ) -> None: """ - :keyword description: Product description. May include HTML formatting tags. - :paramtype description: str - :keyword terms: Product terms of use. Developers trying to subscribe to the product will be - presented and required to accept these terms before they can complete the subscription process. - :paramtype terms: str - :keyword subscription_required: Whether a product subscription is required for accessing APIs - included in this product. If true, the product is referred to as "protected" and a valid - subscription key is required for a request to an API included in the product to succeed. If - false, the product is referred to as "open" and requests to an API included in the product can - be made without a subscription key. If property is omitted when creating a new product it's - value is assumed to be true. - :paramtype subscription_required: bool - :keyword approval_required: whether subscription approval is required. If false, new - subscriptions will be approved automatically enabling developers to call the product’s APIs - immediately after subscribing. If true, administrators must manually approve the subscription - before the developer can any of the product’s APIs. Can be present only if subscriptionRequired - property is present and has a value of false. - :paramtype approval_required: bool - :keyword subscriptions_limit: Whether the number of subscriptions a user can have to this - product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be - present only if subscriptionRequired property is present and has a value of false. - :paramtype subscriptions_limit: int - :keyword state: whether product is published or not. Published products are discoverable by - users of developer portal. Non published products are visible only to administrators. Default - state of Product is notPublished. Known values are: "notPublished" and "published". - :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState - :keyword display_name: Product name. Required. - :paramtype display_name: str + :keyword calls_count: Number of times Counter was called. + :paramtype calls_count: int + :keyword kb_transferred: Data Transferred in KiloBytes. + :paramtype kb_transferred: float """ - super().__init__( - description=description, - terms=terms, - subscription_required=subscription_required, - approval_required=approval_required, - subscriptions_limit=subscriptions_limit, - state=state, - **kwargs - ) - self.display_name = display_name - + super().__init__(**kwargs) + self.calls_count = calls_count + self.kb_transferred = kb_transferred -class ProductTagResourceContractProperties(ProductEntityBaseParameters): - """Product profile. - All required parameters must be populated in order to send to Azure. +class QuotaCounterValueUpdateContract(_serialization.Model): + """Quota counter value details. - :ivar description: Product description. May include HTML formatting tags. - :vartype description: str - :ivar terms: Product terms of use. Developers trying to subscribe to the product will be - presented and required to accept these terms before they can complete the subscription process. - :vartype terms: str - :ivar subscription_required: Whether a product subscription is required for accessing APIs - included in this product. If true, the product is referred to as "protected" and a valid - subscription key is required for a request to an API included in the product to succeed. If - false, the product is referred to as "open" and requests to an API included in the product can - be made without a subscription key. If property is omitted when creating a new product it's - value is assumed to be true. - :vartype subscription_required: bool - :ivar approval_required: whether subscription approval is required. If false, new subscriptions - will be approved automatically enabling developers to call the product’s APIs immediately after - subscribing. If true, administrators must manually approve the subscription before the - developer can any of the product’s APIs. Can be present only if subscriptionRequired property - is present and has a value of false. - :vartype approval_required: bool - :ivar subscriptions_limit: Whether the number of subscriptions a user can have to this product - at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present - only if subscriptionRequired property is present and has a value of false. - :vartype subscriptions_limit: int - :ivar state: whether product is published or not. Published products are discoverable by users - of developer portal. Non published products are visible only to administrators. Default state - of Product is notPublished. Known values are: "notPublished" and "published". - :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState - :ivar id: Identifier of the product in the form of /products/{productId}. - :vartype id: str - :ivar name: Product name. Required. - :vartype name: str + :ivar calls_count: Number of times Counter was called. + :vartype calls_count: int + :ivar kb_transferred: Data Transferred in KiloBytes. + :vartype kb_transferred: float """ - _validation = { - "description": {"max_length": 1000}, - "name": {"required": True, "max_length": 300, "min_length": 1}, + _attribute_map = { + "calls_count": {"key": "properties.callsCount", "type": "int"}, + "kb_transferred": {"key": "properties.kbTransferred", "type": "float"}, } + def __init__( + self, *, calls_count: Optional[int] = None, kb_transferred: Optional[float] = None, **kwargs: Any + ) -> None: + """ + :keyword calls_count: Number of times Counter was called. + :paramtype calls_count: int + :keyword kb_transferred: Data Transferred in KiloBytes. + :paramtype kb_transferred: float + """ + super().__init__(**kwargs) + self.calls_count = calls_count + self.kb_transferred = kb_transferred + + +class RecipientEmailCollection(_serialization.Model): + """Paged Recipient User list representation. + + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.RecipientEmailContract] + :ivar count: Total record count number across all pages. + :vartype count: int + :ivar next_link: Next page link if any. + :vartype next_link: str + """ + _attribute_map = { - "description": {"key": "description", "type": "str"}, - "terms": {"key": "terms", "type": "str"}, - "subscription_required": {"key": "subscriptionRequired", "type": "bool"}, - "approval_required": {"key": "approvalRequired", "type": "bool"}, - "subscriptions_limit": {"key": "subscriptionsLimit", "type": "int"}, - "state": {"key": "state", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "[RecipientEmailContract]"}, + "count": {"key": "count", "type": "int"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( self, *, - name: str, - description: Optional[str] = None, - terms: Optional[str] = None, - subscription_required: Optional[bool] = None, - approval_required: Optional[bool] = None, - subscriptions_limit: Optional[int] = None, - state: Optional[Union[str, "_models.ProductState"]] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs - ): + value: Optional[List["_models.RecipientEmailContract"]] = None, + count: Optional[int] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword description: Product description. May include HTML formatting tags. - :paramtype description: str - :keyword terms: Product terms of use. Developers trying to subscribe to the product will be - presented and required to accept these terms before they can complete the subscription process. - :paramtype terms: str - :keyword subscription_required: Whether a product subscription is required for accessing APIs - included in this product. If true, the product is referred to as "protected" and a valid - subscription key is required for a request to an API included in the product to succeed. If - false, the product is referred to as "open" and requests to an API included in the product can - be made without a subscription key. If property is omitted when creating a new product it's - value is assumed to be true. - :paramtype subscription_required: bool - :keyword approval_required: whether subscription approval is required. If false, new - subscriptions will be approved automatically enabling developers to call the product’s APIs - immediately after subscribing. If true, administrators must manually approve the subscription - before the developer can any of the product’s APIs. Can be present only if subscriptionRequired - property is present and has a value of false. - :paramtype approval_required: bool - :keyword subscriptions_limit: Whether the number of subscriptions a user can have to this - product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be - present only if subscriptionRequired property is present and has a value of false. - :paramtype subscriptions_limit: int - :keyword state: whether product is published or not. Published products are discoverable by - users of developer portal. Non published products are visible only to administrators. Default - state of Product is notPublished. Known values are: "notPublished" and "published". - :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState - :keyword id: Identifier of the product in the form of /products/{productId}. - :paramtype id: str - :keyword name: Product name. Required. - :paramtype name: str + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.RecipientEmailContract] + :keyword count: Total record count number across all pages. + :paramtype count: int + :keyword next_link: Next page link if any. + :paramtype next_link: str """ - super().__init__( - description=description, - terms=terms, - subscription_required=subscription_required, - approval_required=approval_required, - subscriptions_limit=subscriptions_limit, - state=state, - **kwargs - ) - self.id = id - self.name = name + super().__init__(**kwargs) + self.value = value + self.count = count + self.next_link = next_link -class ProductUpdateParameters(_serialization.Model): - """Product Update parameters. +class RecipientEmailContract(ProxyResource): + """Recipient Email details. - :ivar description: Product description. May include HTML formatting tags. - :vartype description: str - :ivar terms: Product terms of use. Developers trying to subscribe to the product will be - presented and required to accept these terms before they can complete the subscription process. - :vartype terms: str - :ivar subscription_required: Whether a product subscription is required for accessing APIs - included in this product. If true, the product is referred to as "protected" and a valid - subscription key is required for a request to an API included in the product to succeed. If - false, the product is referred to as "open" and requests to an API included in the product can - be made without a subscription key. If property is omitted when creating a new product it's - value is assumed to be true. - :vartype subscription_required: bool - :ivar approval_required: whether subscription approval is required. If false, new subscriptions - will be approved automatically enabling developers to call the product’s APIs immediately after - subscribing. If true, administrators must manually approve the subscription before the - developer can any of the product’s APIs. Can be present only if subscriptionRequired property - is present and has a value of false. - :vartype approval_required: bool - :ivar subscriptions_limit: Whether the number of subscriptions a user can have to this product - at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present - only if subscriptionRequired property is present and has a value of false. - :vartype subscriptions_limit: int - :ivar state: whether product is published or not. Published products are discoverable by users - of developer portal. Non published products are visible only to administrators. Default state - of Product is notPublished. Known values are: "notPublished" and "published". - :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState - :ivar display_name: Product name. - :vartype display_name: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar email: User Email subscribed to notification. + :vartype email: str """ _validation = { - "description": {"max_length": 1000}, - "display_name": {"max_length": 300, "min_length": 1}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - "description": {"key": "properties.description", "type": "str"}, - "terms": {"key": "properties.terms", "type": "str"}, - "subscription_required": {"key": "properties.subscriptionRequired", "type": "bool"}, - "approval_required": {"key": "properties.approvalRequired", "type": "bool"}, - "subscriptions_limit": {"key": "properties.subscriptionsLimit", "type": "int"}, - "state": {"key": "properties.state", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "email": {"key": "properties.email", "type": "str"}, } - def __init__( - self, - *, - description: Optional[str] = None, - terms: Optional[str] = None, - subscription_required: Optional[bool] = None, - approval_required: Optional[bool] = None, - subscriptions_limit: Optional[int] = None, - state: Optional[Union[str, "_models.ProductState"]] = None, - display_name: Optional[str] = None, - **kwargs - ): + def __init__(self, *, email: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword description: Product description. May include HTML formatting tags. - :paramtype description: str - :keyword terms: Product terms of use. Developers trying to subscribe to the product will be - presented and required to accept these terms before they can complete the subscription process. - :paramtype terms: str - :keyword subscription_required: Whether a product subscription is required for accessing APIs - included in this product. If true, the product is referred to as "protected" and a valid - subscription key is required for a request to an API included in the product to succeed. If - false, the product is referred to as "open" and requests to an API included in the product can - be made without a subscription key. If property is omitted when creating a new product it's - value is assumed to be true. - :paramtype subscription_required: bool - :keyword approval_required: whether subscription approval is required. If false, new - subscriptions will be approved automatically enabling developers to call the product’s APIs - immediately after subscribing. If true, administrators must manually approve the subscription - before the developer can any of the product’s APIs. Can be present only if subscriptionRequired - property is present and has a value of false. - :paramtype approval_required: bool - :keyword subscriptions_limit: Whether the number of subscriptions a user can have to this - product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be - present only if subscriptionRequired property is present and has a value of false. - :paramtype subscriptions_limit: int - :keyword state: whether product is published or not. Published products are discoverable by - users of developer portal. Non published products are visible only to administrators. Default - state of Product is notPublished. Known values are: "notPublished" and "published". - :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState - :keyword display_name: Product name. - :paramtype display_name: str + :keyword email: User Email subscribed to notification. + :paramtype email: str """ super().__init__(**kwargs) - self.description = description - self.terms = terms - self.subscription_required = subscription_required - self.approval_required = approval_required - self.subscriptions_limit = subscriptions_limit - self.state = state - self.display_name = display_name + self.email = email -class ProductUpdateProperties(ProductEntityBaseParameters): - """Parameters supplied to the Update Product operation. +class RecipientsContractProperties(_serialization.Model): + """Notification Parameter contract. - :ivar description: Product description. May include HTML formatting tags. - :vartype description: str - :ivar terms: Product terms of use. Developers trying to subscribe to the product will be - presented and required to accept these terms before they can complete the subscription process. - :vartype terms: str - :ivar subscription_required: Whether a product subscription is required for accessing APIs - included in this product. If true, the product is referred to as "protected" and a valid - subscription key is required for a request to an API included in the product to succeed. If - false, the product is referred to as "open" and requests to an API included in the product can - be made without a subscription key. If property is omitted when creating a new product it's - value is assumed to be true. - :vartype subscription_required: bool - :ivar approval_required: whether subscription approval is required. If false, new subscriptions - will be approved automatically enabling developers to call the product’s APIs immediately after - subscribing. If true, administrators must manually approve the subscription before the - developer can any of the product’s APIs. Can be present only if subscriptionRequired property - is present and has a value of false. - :vartype approval_required: bool - :ivar subscriptions_limit: Whether the number of subscriptions a user can have to this product - at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present - only if subscriptionRequired property is present and has a value of false. - :vartype subscriptions_limit: int - :ivar state: whether product is published or not. Published products are discoverable by users - of developer portal. Non published products are visible only to administrators. Default state - of Product is notPublished. Known values are: "notPublished" and "published". - :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState - :ivar display_name: Product name. - :vartype display_name: str + :ivar emails: List of Emails subscribed for the notification. + :vartype emails: list[str] + :ivar users: List of Users subscribed for the notification. + :vartype users: list[str] """ - _validation = { - "description": {"max_length": 1000}, - "display_name": {"max_length": 300, "min_length": 1}, - } - _attribute_map = { - "description": {"key": "description", "type": "str"}, - "terms": {"key": "terms", "type": "str"}, - "subscription_required": {"key": "subscriptionRequired", "type": "bool"}, - "approval_required": {"key": "approvalRequired", "type": "bool"}, - "subscriptions_limit": {"key": "subscriptionsLimit", "type": "int"}, - "state": {"key": "state", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, + "emails": {"key": "emails", "type": "[str]"}, + "users": {"key": "users", "type": "[str]"}, } - def __init__( - self, - *, - description: Optional[str] = None, - terms: Optional[str] = None, - subscription_required: Optional[bool] = None, - approval_required: Optional[bool] = None, - subscriptions_limit: Optional[int] = None, - state: Optional[Union[str, "_models.ProductState"]] = None, - display_name: Optional[str] = None, - **kwargs - ): + def __init__(self, *, emails: Optional[List[str]] = None, users: Optional[List[str]] = None, **kwargs: Any) -> None: """ - :keyword description: Product description. May include HTML formatting tags. - :paramtype description: str - :keyword terms: Product terms of use. Developers trying to subscribe to the product will be - presented and required to accept these terms before they can complete the subscription process. - :paramtype terms: str - :keyword subscription_required: Whether a product subscription is required for accessing APIs - included in this product. If true, the product is referred to as "protected" and a valid - subscription key is required for a request to an API included in the product to succeed. If - false, the product is referred to as "open" and requests to an API included in the product can - be made without a subscription key. If property is omitted when creating a new product it's - value is assumed to be true. - :paramtype subscription_required: bool - :keyword approval_required: whether subscription approval is required. If false, new - subscriptions will be approved automatically enabling developers to call the product’s APIs - immediately after subscribing. If true, administrators must manually approve the subscription - before the developer can any of the product’s APIs. Can be present only if subscriptionRequired - property is present and has a value of false. - :paramtype approval_required: bool - :keyword subscriptions_limit: Whether the number of subscriptions a user can have to this - product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be - present only if subscriptionRequired property is present and has a value of false. - :paramtype subscriptions_limit: int - :keyword state: whether product is published or not. Published products are discoverable by - users of developer portal. Non published products are visible only to administrators. Default - state of Product is notPublished. Known values are: "notPublished" and "published". - :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState - :keyword display_name: Product name. - :paramtype display_name: str + :keyword emails: List of Emails subscribed for the notification. + :paramtype emails: list[str] + :keyword users: List of Users subscribed for the notification. + :paramtype users: list[str] """ - super().__init__( - description=description, - terms=terms, - subscription_required=subscription_required, - approval_required=approval_required, - subscriptions_limit=subscriptions_limit, - state=state, - **kwargs - ) - self.display_name = display_name + super().__init__(**kwargs) + self.emails = emails + self.users = users -class QuotaCounterCollection(_serialization.Model): - """Paged Quota Counter list representation. +class RecipientUserCollection(_serialization.Model): + """Paged Recipient User list representation. - :ivar value: Quota counter values. - :vartype value: list[~azure.mgmt.apimanagement.models.QuotaCounterContract] + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.RecipientUserContract] :ivar count: Total record count number across all pages. :vartype count: int :ivar next_link: Next page link if any. @@ -14948,7 +16759,7 @@ class QuotaCounterCollection(_serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "[QuotaCounterContract]"}, + "value": {"key": "value", "type": "[RecipientUserContract]"}, "count": {"key": "count", "type": "int"}, "next_link": {"key": "nextLink", "type": "str"}, } @@ -14956,14 +16767,14 @@ class QuotaCounterCollection(_serialization.Model): def __init__( self, *, - value: Optional[List["_models.QuotaCounterContract"]] = None, + value: Optional[List["_models.RecipientUserContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword value: Quota counter values. - :paramtype value: list[~azure.mgmt.apimanagement.models.QuotaCounterContract] + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.RecipientUserContract] :keyword count: Total record count number across all pages. :paramtype count: int :keyword next_link: Next page link if any. @@ -14975,157 +16786,222 @@ def __init__( self.next_link = next_link -class QuotaCounterContract(_serialization.Model): - """Quota counter details. +class RecipientUserContract(ProxyResource): + """Recipient User details. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar counter_key: The Key value of the Counter. Must not be empty. Required. - :vartype counter_key: str - :ivar period_key: Identifier of the Period for which the counter was collected. Must not be - empty. Required. - :vartype period_key: str - :ivar period_start_time: The date of the start of Counter Period. The date conforms to the - following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. Required. - :vartype period_start_time: ~datetime.datetime - :ivar period_end_time: The date of the end of Counter Period. The date conforms to the - following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. Required. - :vartype period_end_time: ~datetime.datetime - :ivar value: Quota Value Properties. - :vartype value: ~azure.mgmt.apimanagement.models.QuotaCounterValueContractProperties + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar user_id: API Management UserId subscribed to notification. + :vartype user_id: str """ _validation = { - "counter_key": {"required": True, "min_length": 1}, - "period_key": {"required": True, "min_length": 1}, - "period_start_time": {"required": True}, - "period_end_time": {"required": True}, + "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"}, + "user_id": {"key": "properties.userId", "type": "str"}, + } + + def __init__(self, *, user_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword user_id: API Management UserId subscribed to notification. + :paramtype user_id: str + """ + super().__init__(**kwargs) + self.user_id = user_id + + +class RegionContract(_serialization.Model): + """Region profile. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Region name. + :vartype name: str + :ivar is_master_region: whether Region is the master region. + :vartype is_master_region: bool + :ivar is_deleted: whether Region is deleted. + :vartype is_deleted: bool + """ + + _validation = { + "name": {"readonly": True}, } _attribute_map = { - "counter_key": {"key": "counterKey", "type": "str"}, - "period_key": {"key": "periodKey", "type": "str"}, - "period_start_time": {"key": "periodStartTime", "type": "iso-8601"}, - "period_end_time": {"key": "periodEndTime", "type": "iso-8601"}, - "value": {"key": "value", "type": "QuotaCounterValueContractProperties"}, + "name": {"key": "name", "type": "str"}, + "is_master_region": {"key": "isMasterRegion", "type": "bool"}, + "is_deleted": {"key": "isDeleted", "type": "bool"}, } def __init__( - self, - *, - counter_key: str, - period_key: str, - period_start_time: datetime.datetime, - period_end_time: datetime.datetime, - value: Optional["_models.QuotaCounterValueContractProperties"] = None, - **kwargs - ): + self, *, is_master_region: Optional[bool] = None, is_deleted: Optional[bool] = None, **kwargs: Any + ) -> None: """ - :keyword counter_key: The Key value of the Counter. Must not be empty. Required. - :paramtype counter_key: str - :keyword period_key: Identifier of the Period for which the counter was collected. Must not be - empty. Required. - :paramtype period_key: str - :keyword period_start_time: The date of the start of Counter Period. The date conforms to the - following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. Required. - :paramtype period_start_time: ~datetime.datetime - :keyword period_end_time: The date of the end of Counter Period. The date conforms to the - following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. Required. - :paramtype period_end_time: ~datetime.datetime - :keyword value: Quota Value Properties. - :paramtype value: ~azure.mgmt.apimanagement.models.QuotaCounterValueContractProperties + :keyword is_master_region: whether Region is the master region. + :paramtype is_master_region: bool + :keyword is_deleted: whether Region is deleted. + :paramtype is_deleted: bool """ super().__init__(**kwargs) - self.counter_key = counter_key - self.period_key = period_key - self.period_start_time = period_start_time - self.period_end_time = period_end_time - self.value = value + self.name = None + self.is_master_region = is_master_region + self.is_deleted = is_deleted -class QuotaCounterValueContract(_serialization.Model): - """Quota counter value details. +class RegionListResult(_serialization.Model): + """Lists Regions operation response details. - :ivar calls_count: Number of times Counter was called. - :vartype calls_count: int - :ivar kb_transferred: Data Transferred in KiloBytes. - :vartype kb_transferred: float + :ivar value: Lists of Regions. + :vartype value: list[~azure.mgmt.apimanagement.models.RegionContract] + :ivar count: Total record count number across all pages. + :vartype count: int + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { - "calls_count": {"key": "value.callsCount", "type": "int"}, - "kb_transferred": {"key": "value.kbTransferred", "type": "float"}, + "value": {"key": "value", "type": "[RegionContract]"}, + "count": {"key": "count", "type": "int"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, calls_count: Optional[int] = None, kb_transferred: Optional[float] = None, **kwargs): + def __init__( + self, + *, + value: Optional[List["_models.RegionContract"]] = None, + count: Optional[int] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword calls_count: Number of times Counter was called. - :paramtype calls_count: int - :keyword kb_transferred: Data Transferred in KiloBytes. - :paramtype kb_transferred: float + :keyword value: Lists of Regions. + :paramtype value: list[~azure.mgmt.apimanagement.models.RegionContract] + :keyword count: Total record count number across all pages. + :paramtype count: int + :keyword next_link: Next page link if any. + :paramtype next_link: str """ super().__init__(**kwargs) - self.calls_count = calls_count - self.kb_transferred = kb_transferred + self.value = value + self.count = count + self.next_link = next_link -class QuotaCounterValueContractProperties(_serialization.Model): - """Quota counter value details. +class RegistrationDelegationSettingsProperties(_serialization.Model): + """User registration delegation settings properties. - :ivar calls_count: Number of times Counter was called. - :vartype calls_count: int - :ivar kb_transferred: Data Transferred in KiloBytes. - :vartype kb_transferred: float + :ivar enabled: Enable or disable delegation for user registration. + :vartype enabled: bool """ _attribute_map = { - "calls_count": {"key": "callsCount", "type": "int"}, - "kb_transferred": {"key": "kbTransferred", "type": "float"}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__(self, *, calls_count: Optional[int] = None, kb_transferred: Optional[float] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ - :keyword calls_count: Number of times Counter was called. - :paramtype calls_count: int - :keyword kb_transferred: Data Transferred in KiloBytes. - :paramtype kb_transferred: float + :keyword enabled: Enable or disable delegation for user registration. + :paramtype enabled: bool """ super().__init__(**kwargs) - self.calls_count = calls_count - self.kb_transferred = kb_transferred + self.enabled = enabled -class QuotaCounterValueUpdateContract(_serialization.Model): - """Quota counter value details. +class RemotePrivateEndpointConnectionWrapper(_serialization.Model): + """Remote Private Endpoint Connection resource. - :ivar calls_count: Number of times Counter was called. - :vartype calls_count: int - :ivar kb_transferred: Data Transferred in KiloBytes. - :vartype kb_transferred: float + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Private Endpoint connection resource id. + :vartype id: str + :ivar name: Private Endpoint Connection Name. + :vartype name: str + :ivar type: Private Endpoint Connection Resource Type. + :vartype type: str + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.apimanagement.models.ArmIdWrapper + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + :vartype provisioning_state: str + :ivar group_ids: All the Group ids. + :vartype group_ids: list[str] """ + _validation = { + "provisioning_state": {"readonly": True}, + "group_ids": {"readonly": True}, + } + _attribute_map = { - "calls_count": {"key": "properties.callsCount", "type": "int"}, - "kb_transferred": {"key": "properties.kbTransferred", "type": "float"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "ArmIdWrapper"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "group_ids": {"key": "properties.groupIds", "type": "[str]"}, } - def __init__(self, *, calls_count: Optional[int] = None, kb_transferred: Optional[float] = None, **kwargs): + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + private_endpoint: Optional["_models.ArmIdWrapper"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + **kwargs: Any + ) -> None: """ - :keyword calls_count: Number of times Counter was called. - :paramtype calls_count: int - :keyword kb_transferred: Data Transferred in KiloBytes. - :paramtype kb_transferred: float + :keyword id: Private Endpoint connection resource id. + :paramtype id: str + :keyword name: Private Endpoint Connection Name. + :paramtype name: str + :keyword type: Private Endpoint Connection Resource Type. + :paramtype type: str + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.apimanagement.models.ArmIdWrapper + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState """ super().__init__(**kwargs) - self.calls_count = calls_count - self.kb_transferred = kb_transferred + self.id = id + self.name = name + self.type = type + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None + self.group_ids = None -class RecipientEmailCollection(_serialization.Model): - """Paged Recipient User list representation. +class ReportCollection(_serialization.Model): + """Paged Report records list representation. :ivar value: Page values. - :vartype value: list[~azure.mgmt.apimanagement.models.RecipientEmailContract] + :vartype value: list[~azure.mgmt.apimanagement.models.ReportRecordContract] :ivar count: Total record count number across all pages. :vartype count: int :ivar next_link: Next page link if any. @@ -15133,904 +17009,895 @@ class RecipientEmailCollection(_serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "[RecipientEmailContract]"}, - "count": {"key": "count", "type": "int"}, - "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ReportRecordContract]"}, + "count": {"key": "count", "type": "int"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ReportRecordContract"]] = None, + count: Optional[int] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.ReportRecordContract] + :keyword count: Total record count number across all pages. + :paramtype count: int + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.count = count + self.next_link = next_link + + +class ReportRecordContract(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Report data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name depending on report endpoint specifies product, API, operation or developer + name. + :vartype name: str + :ivar timestamp: Start of aggregation period. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :vartype timestamp: ~datetime.datetime + :ivar interval: Length of aggregation period. Interval must be multiple of 15 minutes and may + not be zero. The value should be in ISO 8601 format + (http://en.wikipedia.org/wiki/ISO_8601#Durations). + :vartype interval: str + :ivar country: Country to which this record data is related. + :vartype country: str + :ivar region: Country region to which this record data is related. + :vartype region: str + :ivar zip: Zip code to which this record data is related. + :vartype zip: str + :ivar user_id: User identifier path. /users/{userId}. + :vartype user_id: str + :ivar product_id: Product identifier path. /products/{productId}. + :vartype product_id: str + :ivar api_id: API identifier path. /apis/{apiId}. + :vartype api_id: str + :ivar operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. + :vartype operation_id: str + :ivar api_region: API region identifier. + :vartype api_region: str + :ivar subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. + :vartype subscription_id: str + :ivar call_count_success: Number of successful calls. This includes calls returning + HttpStatusCode <= 301 and HttpStatusCode.NotModified and HttpStatusCode.TemporaryRedirect. + :vartype call_count_success: int + :ivar call_count_blocked: Number of calls blocked due to invalid credentials. This includes + calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and + HttpStatusCode.TooManyRequests. + :vartype call_count_blocked: int + :ivar call_count_failed: Number of calls failed due to gateway or backend errors. This includes + calls returning HttpStatusCode.BadRequest(400) and any Code between + HttpStatusCode.InternalServerError (500) and 600. + :vartype call_count_failed: int + :ivar call_count_other: Number of other calls. + :vartype call_count_other: int + :ivar call_count_total: Total number of calls. + :vartype call_count_total: int + :ivar bandwidth: Bandwidth consumed. + :vartype bandwidth: int + :ivar cache_hit_count: Number of times when content was served from cache policy. + :vartype cache_hit_count: int + :ivar cache_miss_count: Number of times content was fetched from backend. + :vartype cache_miss_count: int + :ivar api_time_avg: Average time it took to process request. + :vartype api_time_avg: float + :ivar api_time_min: Minimum time it took to process request. + :vartype api_time_min: float + :ivar api_time_max: Maximum time it took to process request. + :vartype api_time_max: float + :ivar service_time_avg: Average time it took to process request on backend. + :vartype service_time_avg: float + :ivar service_time_min: Minimum time it took to process request on backend. + :vartype service_time_min: float + :ivar service_time_max: Maximum time it took to process request on backend. + :vartype service_time_max: float + """ + + _validation = { + "user_id": {"readonly": True}, + "product_id": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "timestamp": {"key": "timestamp", "type": "iso-8601"}, + "interval": {"key": "interval", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "region": {"key": "region", "type": "str"}, + "zip": {"key": "zip", "type": "str"}, + "user_id": {"key": "userId", "type": "str"}, + "product_id": {"key": "productId", "type": "str"}, + "api_id": {"key": "apiId", "type": "str"}, + "operation_id": {"key": "operationId", "type": "str"}, + "api_region": {"key": "apiRegion", "type": "str"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, + "call_count_success": {"key": "callCountSuccess", "type": "int"}, + "call_count_blocked": {"key": "callCountBlocked", "type": "int"}, + "call_count_failed": {"key": "callCountFailed", "type": "int"}, + "call_count_other": {"key": "callCountOther", "type": "int"}, + "call_count_total": {"key": "callCountTotal", "type": "int"}, + "bandwidth": {"key": "bandwidth", "type": "int"}, + "cache_hit_count": {"key": "cacheHitCount", "type": "int"}, + "cache_miss_count": {"key": "cacheMissCount", "type": "int"}, + "api_time_avg": {"key": "apiTimeAvg", "type": "float"}, + "api_time_min": {"key": "apiTimeMin", "type": "float"}, + "api_time_max": {"key": "apiTimeMax", "type": "float"}, + "service_time_avg": {"key": "serviceTimeAvg", "type": "float"}, + "service_time_min": {"key": "serviceTimeMin", "type": "float"}, + "service_time_max": {"key": "serviceTimeMax", "type": "float"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, - value: Optional[List["_models.RecipientEmailContract"]] = None, - count: Optional[int] = None, - next_link: Optional[str] = None, - **kwargs - ): + name: Optional[str] = None, + timestamp: Optional[datetime.datetime] = None, + interval: Optional[str] = None, + country: Optional[str] = None, + region: Optional[str] = None, + zip: Optional[str] = None, + api_id: Optional[str] = None, + operation_id: Optional[str] = None, + api_region: Optional[str] = None, + subscription_id: Optional[str] = None, + call_count_success: Optional[int] = None, + call_count_blocked: Optional[int] = None, + call_count_failed: Optional[int] = None, + call_count_other: Optional[int] = None, + call_count_total: Optional[int] = None, + bandwidth: Optional[int] = None, + cache_hit_count: Optional[int] = None, + cache_miss_count: Optional[int] = None, + api_time_avg: Optional[float] = None, + api_time_min: Optional[float] = None, + api_time_max: Optional[float] = None, + service_time_avg: Optional[float] = None, + service_time_min: Optional[float] = None, + service_time_max: Optional[float] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Page values. - :paramtype value: list[~azure.mgmt.apimanagement.models.RecipientEmailContract] - :keyword count: Total record count number across all pages. - :paramtype count: int - :keyword next_link: Next page link if any. - :paramtype next_link: str + :keyword name: Name depending on report endpoint specifies product, API, operation or developer + name. + :paramtype name: str + :keyword timestamp: Start of aggregation period. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype timestamp: ~datetime.datetime + :keyword interval: Length of aggregation period. Interval must be multiple of 15 minutes and + may not be zero. The value should be in ISO 8601 format + (http://en.wikipedia.org/wiki/ISO_8601#Durations). + :paramtype interval: str + :keyword country: Country to which this record data is related. + :paramtype country: str + :keyword region: Country region to which this record data is related. + :paramtype region: str + :keyword zip: Zip code to which this record data is related. + :paramtype zip: str + :keyword api_id: API identifier path. /apis/{apiId}. + :paramtype api_id: str + :keyword operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. + :paramtype operation_id: str + :keyword api_region: API region identifier. + :paramtype api_region: str + :keyword subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. + :paramtype subscription_id: str + :keyword call_count_success: Number of successful calls. This includes calls returning + HttpStatusCode <= 301 and HttpStatusCode.NotModified and HttpStatusCode.TemporaryRedirect. + :paramtype call_count_success: int + :keyword call_count_blocked: Number of calls blocked due to invalid credentials. This includes + calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and + HttpStatusCode.TooManyRequests. + :paramtype call_count_blocked: int + :keyword call_count_failed: Number of calls failed due to gateway or backend errors. This + includes calls returning HttpStatusCode.BadRequest(400) and any Code between + HttpStatusCode.InternalServerError (500) and 600. + :paramtype call_count_failed: int + :keyword call_count_other: Number of other calls. + :paramtype call_count_other: int + :keyword call_count_total: Total number of calls. + :paramtype call_count_total: int + :keyword bandwidth: Bandwidth consumed. + :paramtype bandwidth: int + :keyword cache_hit_count: Number of times when content was served from cache policy. + :paramtype cache_hit_count: int + :keyword cache_miss_count: Number of times content was fetched from backend. + :paramtype cache_miss_count: int + :keyword api_time_avg: Average time it took to process request. + :paramtype api_time_avg: float + :keyword api_time_min: Minimum time it took to process request. + :paramtype api_time_min: float + :keyword api_time_max: Maximum time it took to process request. + :paramtype api_time_max: float + :keyword service_time_avg: Average time it took to process request on backend. + :paramtype service_time_avg: float + :keyword service_time_min: Minimum time it took to process request on backend. + :paramtype service_time_min: float + :keyword service_time_max: Maximum time it took to process request on backend. + :paramtype service_time_max: float """ super().__init__(**kwargs) - self.value = value - self.count = count - self.next_link = next_link + self.name = name + self.timestamp = timestamp + self.interval = interval + self.country = country + self.region = region + self.zip = zip + self.user_id = None + self.product_id = None + self.api_id = api_id + self.operation_id = operation_id + self.api_region = api_region + self.subscription_id = subscription_id + self.call_count_success = call_count_success + self.call_count_blocked = call_count_blocked + self.call_count_failed = call_count_failed + self.call_count_other = call_count_other + self.call_count_total = call_count_total + self.bandwidth = bandwidth + self.cache_hit_count = cache_hit_count + self.cache_miss_count = cache_miss_count + self.api_time_avg = api_time_avg + self.api_time_min = api_time_min + self.api_time_max = api_time_max + self.service_time_avg = service_time_avg + self.service_time_min = service_time_min + self.service_time_max = service_time_max -class RecipientEmailContract(Resource): - """Recipient Email details. +class RepresentationContract(_serialization.Model): + """Operation request/response representation details. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar email: User Email subscribed to notification. - :vartype email: str + :ivar content_type: Specifies a registered or custom content type for this representation, e.g. + application/xml. Required. + :vartype content_type: str + :ivar schema_id: Schema identifier. Applicable only if 'contentType' value is neither + 'application/x-www-form-urlencoded' nor 'multipart/form-data'. + :vartype schema_id: str + :ivar type_name: Type name defined by the schema. Applicable only if 'contentType' value is + neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. + :vartype type_name: str + :ivar form_parameters: Collection of form parameters. Required if 'contentType' value is either + 'application/x-www-form-urlencoded' or 'multipart/form-data'.. + :vartype form_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar examples: Exampled defined for the representation. + :vartype examples: dict[str, ~azure.mgmt.apimanagement.models.ParameterExampleContract] """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, + "content_type": {"required": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "email": {"key": "properties.email", "type": "str"}, + "content_type": {"key": "contentType", "type": "str"}, + "schema_id": {"key": "schemaId", "type": "str"}, + "type_name": {"key": "typeName", "type": "str"}, + "form_parameters": {"key": "formParameters", "type": "[ParameterContract]"}, + "examples": {"key": "examples", "type": "{ParameterExampleContract}"}, } - def __init__(self, *, email: Optional[str] = None, **kwargs): + def __init__( + self, + *, + content_type: str, + schema_id: Optional[str] = None, + type_name: Optional[str] = None, + form_parameters: Optional[List["_models.ParameterContract"]] = None, + examples: Optional[Dict[str, "_models.ParameterExampleContract"]] = None, + **kwargs: Any + ) -> None: """ - :keyword email: User Email subscribed to notification. - :paramtype email: str + :keyword content_type: Specifies a registered or custom content type for this representation, + e.g. application/xml. Required. + :paramtype content_type: str + :keyword schema_id: Schema identifier. Applicable only if 'contentType' value is neither + 'application/x-www-form-urlencoded' nor 'multipart/form-data'. + :paramtype schema_id: str + :keyword type_name: Type name defined by the schema. Applicable only if 'contentType' value is + neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. + :paramtype type_name: str + :keyword form_parameters: Collection of form parameters. Required if 'contentType' value is + either 'application/x-www-form-urlencoded' or 'multipart/form-data'.. + :paramtype form_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword examples: Exampled defined for the representation. + :paramtype examples: dict[str, ~azure.mgmt.apimanagement.models.ParameterExampleContract] """ super().__init__(**kwargs) - self.email = email + self.content_type = content_type + self.schema_id = schema_id + self.type_name = type_name + self.form_parameters = form_parameters + self.examples = examples -class RecipientsContractProperties(_serialization.Model): - """Notification Parameter contract. +class RequestContract(_serialization.Model): + """Operation request details. - :ivar emails: List of Emails subscribed for the notification. - :vartype emails: list[str] - :ivar users: List of Users subscribed for the notification. - :vartype users: list[str] + :ivar description: Operation request description. + :vartype description: str + :ivar query_parameters: Collection of operation request query parameters. + :vartype query_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar headers: Collection of operation request headers. + :vartype headers: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar representations: Collection of operation request representations. + :vartype representations: list[~azure.mgmt.apimanagement.models.RepresentationContract] """ _attribute_map = { - "emails": {"key": "emails", "type": "[str]"}, - "users": {"key": "users", "type": "[str]"}, + "description": {"key": "description", "type": "str"}, + "query_parameters": {"key": "queryParameters", "type": "[ParameterContract]"}, + "headers": {"key": "headers", "type": "[ParameterContract]"}, + "representations": {"key": "representations", "type": "[RepresentationContract]"}, } - def __init__(self, *, emails: Optional[List[str]] = None, users: Optional[List[str]] = None, **kwargs): + def __init__( + self, + *, + description: Optional[str] = None, + query_parameters: Optional[List["_models.ParameterContract"]] = None, + headers: Optional[List["_models.ParameterContract"]] = None, + representations: Optional[List["_models.RepresentationContract"]] = None, + **kwargs: Any + ) -> None: """ - :keyword emails: List of Emails subscribed for the notification. - :paramtype emails: list[str] - :keyword users: List of Users subscribed for the notification. - :paramtype users: list[str] + :keyword description: Operation request description. + :paramtype description: str + :keyword query_parameters: Collection of operation request query parameters. + :paramtype query_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword headers: Collection of operation request headers. + :paramtype headers: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword representations: Collection of operation request representations. + :paramtype representations: list[~azure.mgmt.apimanagement.models.RepresentationContract] """ super().__init__(**kwargs) - self.emails = emails - self.users = users + self.description = description + self.query_parameters = query_parameters + self.headers = headers + self.representations = representations -class RecipientUserCollection(_serialization.Model): - """Paged Recipient User list representation. +class RequestReportCollection(_serialization.Model): + """Paged Report records list representation. :ivar value: Page values. - :vartype value: list[~azure.mgmt.apimanagement.models.RecipientUserContract] + :vartype value: list[~azure.mgmt.apimanagement.models.RequestReportRecordContract] :ivar count: Total record count number across all pages. :vartype count: int - :ivar next_link: Next page link if any. - :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[RecipientUserContract]"}, + "value": {"key": "value", "type": "[RequestReportRecordContract]"}, "count": {"key": "count", "type": "int"}, - "next_link": {"key": "nextLink", "type": "str"}, } def __init__( self, *, - value: Optional[List["_models.RecipientUserContract"]] = None, + value: Optional[List["_models.RequestReportRecordContract"]] = None, count: Optional[int] = None, - next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Page values. - :paramtype value: list[~azure.mgmt.apimanagement.models.RecipientUserContract] + :paramtype value: list[~azure.mgmt.apimanagement.models.RequestReportRecordContract] :keyword count: Total record count number across all pages. :paramtype count: int - :keyword next_link: Next page link if any. - :paramtype next_link: str """ super().__init__(**kwargs) self.value = value self.count = count - self.next_link = next_link -class RecipientUserContract(Resource): - """Recipient User details. +class RequestReportRecordContract(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Request Report data. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar user_id: API Management UserId subscribed to notification. + :ivar api_id: API identifier path. /apis/{apiId}. + :vartype api_id: str + :ivar operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. + :vartype operation_id: str + :ivar product_id: Product identifier path. /products/{productId}. + :vartype product_id: str + :ivar user_id: User identifier path. /users/{userId}. :vartype user_id: str + :ivar method: The HTTP method associated with this request.. + :vartype method: str + :ivar url: The full URL associated with this request. + :vartype url: str + :ivar ip_address: The client IP address associated with this request. + :vartype ip_address: str + :ivar backend_response_code: The HTTP status code received by the gateway as a result of + forwarding this request to the backend. + :vartype backend_response_code: str + :ivar response_code: The HTTP status code returned by the gateway. + :vartype response_code: int + :ivar response_size: The size of the response returned by the gateway. + :vartype response_size: int + :ivar timestamp: The date and time when this request was received by the gateway in ISO 8601 + format. + :vartype timestamp: ~datetime.datetime + :ivar cache: Specifies if response cache was involved in generating the response. If the value + is none, the cache was not used. If the value is hit, cached response was returned. If the + value is miss, the cache was used but lookup resulted in a miss and request was fulfilled by + the backend. + :vartype cache: str + :ivar api_time: The total time it took to process this request. + :vartype api_time: float + :ivar service_time: he time it took to forward this request to the backend and get the response + back. + :vartype service_time: float + :ivar api_region: Azure region where the gateway that processed this request is located. + :vartype api_region: str + :ivar subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. + :vartype subscription_id: str + :ivar request_id: Request Identifier. + :vartype request_id: str + :ivar request_size: The size of this request.. + :vartype request_size: int """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, + "product_id": {"readonly": True}, + "user_id": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_id": {"key": "properties.userId", "type": "str"}, + "api_id": {"key": "apiId", "type": "str"}, + "operation_id": {"key": "operationId", "type": "str"}, + "product_id": {"key": "productId", "type": "str"}, + "user_id": {"key": "userId", "type": "str"}, + "method": {"key": "method", "type": "str"}, + "url": {"key": "url", "type": "str"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "backend_response_code": {"key": "backendResponseCode", "type": "str"}, + "response_code": {"key": "responseCode", "type": "int"}, + "response_size": {"key": "responseSize", "type": "int"}, + "timestamp": {"key": "timestamp", "type": "iso-8601"}, + "cache": {"key": "cache", "type": "str"}, + "api_time": {"key": "apiTime", "type": "float"}, + "service_time": {"key": "serviceTime", "type": "float"}, + "api_region": {"key": "apiRegion", "type": "str"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, + "request_id": {"key": "requestId", "type": "str"}, + "request_size": {"key": "requestSize", "type": "int"}, } - def __init__(self, *, user_id: Optional[str] = None, **kwargs): + def __init__( + self, + *, + api_id: Optional[str] = None, + operation_id: Optional[str] = None, + method: Optional[str] = None, + url: Optional[str] = None, + ip_address: Optional[str] = None, + backend_response_code: Optional[str] = None, + response_code: Optional[int] = None, + response_size: Optional[int] = None, + timestamp: Optional[datetime.datetime] = None, + cache: Optional[str] = None, + api_time: Optional[float] = None, + service_time: Optional[float] = None, + api_region: Optional[str] = None, + subscription_id: Optional[str] = None, + request_id: Optional[str] = None, + request_size: Optional[int] = None, + **kwargs: Any + ) -> None: """ - :keyword user_id: API Management UserId subscribed to notification. - :paramtype user_id: str + :keyword api_id: API identifier path. /apis/{apiId}. + :paramtype api_id: str + :keyword operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. + :paramtype operation_id: str + :keyword method: The HTTP method associated with this request.. + :paramtype method: str + :keyword url: The full URL associated with this request. + :paramtype url: str + :keyword ip_address: The client IP address associated with this request. + :paramtype ip_address: str + :keyword backend_response_code: The HTTP status code received by the gateway as a result of + forwarding this request to the backend. + :paramtype backend_response_code: str + :keyword response_code: The HTTP status code returned by the gateway. + :paramtype response_code: int + :keyword response_size: The size of the response returned by the gateway. + :paramtype response_size: int + :keyword timestamp: The date and time when this request was received by the gateway in ISO 8601 + format. + :paramtype timestamp: ~datetime.datetime + :keyword cache: Specifies if response cache was involved in generating the response. If the + value is none, the cache was not used. If the value is hit, cached response was returned. If + the value is miss, the cache was used but lookup resulted in a miss and request was fulfilled + by the backend. + :paramtype cache: str + :keyword api_time: The total time it took to process this request. + :paramtype api_time: float + :keyword service_time: he time it took to forward this request to the backend and get the + response back. + :paramtype service_time: float + :keyword api_region: Azure region where the gateway that processed this request is located. + :paramtype api_region: str + :keyword subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. + :paramtype subscription_id: str + :keyword request_id: Request Identifier. + :paramtype request_id: str + :keyword request_size: The size of this request.. + :paramtype request_size: int """ super().__init__(**kwargs) - self.user_id = user_id + self.api_id = api_id + self.operation_id = operation_id + self.product_id = None + self.user_id = None + self.method = method + self.url = url + self.ip_address = ip_address + self.backend_response_code = backend_response_code + self.response_code = response_code + self.response_size = response_size + self.timestamp = timestamp + self.cache = cache + self.api_time = api_time + self.service_time = service_time + self.api_region = api_region + self.subscription_id = subscription_id + self.request_id = request_id + self.request_size = request_size -class RegionContract(_serialization.Model): - """Region profile. +class ResolverCollection(_serialization.Model): + """Paged Resolver list representation. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Region name. - :vartype name: str - :ivar is_master_region: whether Region is the master region. - :vartype is_master_region: bool - :ivar is_deleted: whether Region is deleted. - :vartype is_deleted: bool - """ - - _validation = { - "name": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_master_region": {"key": "isMasterRegion", "type": "bool"}, - "is_deleted": {"key": "isDeleted", "type": "bool"}, - } - - def __init__(self, *, is_master_region: Optional[bool] = None, is_deleted: Optional[bool] = None, **kwargs): - """ - :keyword is_master_region: whether Region is the master region. - :paramtype is_master_region: bool - :keyword is_deleted: whether Region is deleted. - :paramtype is_deleted: bool - """ - super().__init__(**kwargs) - self.name = None - self.is_master_region = is_master_region - self.is_deleted = is_deleted - - -class RegionListResult(_serialization.Model): - """Lists Regions operation response details. - - :ivar value: Lists of Regions. - :vartype value: list[~azure.mgmt.apimanagement.models.RegionContract] + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.ResolverContract] :ivar count: Total record count number across all pages. :vartype count: int :ivar next_link: Next page link if any. :vartype next_link: str """ + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + _attribute_map = { - "value": {"key": "value", "type": "[RegionContract]"}, + "value": {"key": "value", "type": "[ResolverContract]"}, "count": {"key": "count", "type": "int"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.RegionContract"]] = None, - count: Optional[int] = None, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None: """ - :keyword value: Lists of Regions. - :paramtype value: list[~azure.mgmt.apimanagement.models.RegionContract] :keyword count: Total record count number across all pages. :paramtype count: int - :keyword next_link: Next page link if any. - :paramtype next_link: str """ super().__init__(**kwargs) - self.value = value + self.value = None self.count = count - self.next_link = next_link - - -class RegistrationDelegationSettingsProperties(_serialization.Model): - """User registration delegation settings properties. - - :ivar enabled: Enable or disable delegation for user registration. - :vartype enabled: bool - """ - - _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, - } - - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): - """ - :keyword enabled: Enable or disable delegation for user registration. - :paramtype enabled: bool - """ - super().__init__(**kwargs) - self.enabled = enabled + self.next_link = None -class RemotePrivateEndpointConnectionWrapper(_serialization.Model): - """Remote Private Endpoint Connection resource. +class ResolverContract(ProxyResource): + """GraphQL API Resolver details. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Private Endpoint connection resource id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Private Endpoint Connection Name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Private Endpoint Connection Resource Type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar private_endpoint: The resource of private end point. - :vartype private_endpoint: ~azure.mgmt.apimanagement.models.ArmIdWrapper - :ivar private_link_service_connection_state: A collection of information about the state of the - connection between service consumer and provider. - :vartype private_link_service_connection_state: - ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - :vartype provisioning_state: str - :ivar group_ids: All the Group ids. - :vartype group_ids: list[str] + :ivar display_name: Resolver Name. + :vartype display_name: str + :ivar path: Path is type/field being resolved. + :vartype path: str + :ivar description: Description of the resolver. May include HTML formatting tags. + :vartype description: str """ _validation = { - "provisioning_state": {"readonly": True}, - "group_ids": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "display_name": {"max_length": 300, "min_length": 1}, + "path": {"max_length": 300, "min_length": 1}, + "description": {"max_length": 1000}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "private_endpoint": {"key": "properties.privateEndpoint", "type": "ArmIdWrapper"}, - "private_link_service_connection_state": { - "key": "properties.privateLinkServiceConnectionState", - "type": "PrivateLinkServiceConnectionState", - }, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "group_ids": {"key": "properties.groupIds", "type": "[str]"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - type: Optional[str] = None, - private_endpoint: Optional["_models.ArmIdWrapper"] = None, - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs - ): - """ - :keyword id: Private Endpoint connection resource id. - :paramtype id: str - :keyword name: Private Endpoint Connection Name. - :paramtype name: str - :keyword type: Private Endpoint Connection Resource Type. - :paramtype type: str - :keyword private_endpoint: The resource of private end point. - :paramtype private_endpoint: ~azure.mgmt.apimanagement.models.ArmIdWrapper - :keyword private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :paramtype private_link_service_connection_state: - ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.type = type - self.private_endpoint = private_endpoint - self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state = None - self.group_ids = None - - -class ReportCollection(_serialization.Model): - """Paged Report records list representation. - - :ivar value: Page values. - :vartype value: list[~azure.mgmt.apimanagement.models.ReportRecordContract] - :ivar count: Total record count number across all pages. - :vartype count: int - :ivar next_link: Next page link if any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ReportRecordContract]"}, - "count": {"key": "count", "type": "int"}, - "next_link": {"key": "nextLink", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "path": {"key": "properties.path", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, } def __init__( self, *, - value: Optional[List["_models.ReportRecordContract"]] = None, - count: Optional[int] = None, - next_link: Optional[str] = None, - **kwargs - ): + display_name: Optional[str] = None, + path: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Page values. - :paramtype value: list[~azure.mgmt.apimanagement.models.ReportRecordContract] - :keyword count: Total record count number across all pages. - :paramtype count: int - :keyword next_link: Next page link if any. - :paramtype next_link: str + :keyword display_name: Resolver Name. + :paramtype display_name: str + :keyword path: Path is type/field being resolved. + :paramtype path: str + :keyword description: Description of the resolver. May include HTML formatting tags. + :paramtype description: str """ super().__init__(**kwargs) - self.value = value - self.count = count - self.next_link = next_link + self.display_name = display_name + self.path = path + self.description = description -class ReportRecordContract(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Report data. +class ResolverResultContract(ProxyResource): + """Long Running Git Resolver Results. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Name depending on report endpoint specifies product, API, operation or developer - name. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. :vartype name: str - :ivar timestamp: Start of aggregation period. The date conforms to the following format: + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar id_properties_id: Resolver result identifier. + :vartype id_properties_id: str + :ivar status: Status of an async resolver. Known values are: "Started", "InProgress", + "Succeeded", and "Failed". + :vartype status: str or ~azure.mgmt.apimanagement.models.AsyncResolverStatus + :ivar started: Start time of an async resolver. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :vartype timestamp: ~datetime.datetime - :ivar interval: Length of aggregation period. Interval must be multiple of 15 minutes and may - not be zero. The value should be in ISO 8601 format - (http://en.wikipedia.org/wiki/ISO_8601#Durations). - :vartype interval: str - :ivar country: Country to which this record data is related. - :vartype country: str - :ivar region: Country region to which this record data is related. - :vartype region: str - :ivar zip: Zip code to which this record data is related. - :vartype zip: str - :ivar user_id: User identifier path. /users/{userId}. - :vartype user_id: str - :ivar product_id: Product identifier path. /products/{productId}. - :vartype product_id: str - :ivar api_id: API identifier path. /apis/{apiId}. - :vartype api_id: str - :ivar operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. - :vartype operation_id: str - :ivar api_region: API region identifier. - :vartype api_region: str - :ivar subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. - :vartype subscription_id: str - :ivar call_count_success: Number of successful calls. This includes calls returning - HttpStatusCode <= 301 and HttpStatusCode.NotModified and HttpStatusCode.TemporaryRedirect. - :vartype call_count_success: int - :ivar call_count_blocked: Number of calls blocked due to invalid credentials. This includes - calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and - HttpStatusCode.TooManyRequests. - :vartype call_count_blocked: int - :ivar call_count_failed: Number of calls failed due to proxy or backend errors. This includes - calls returning HttpStatusCode.BadRequest(400) and any Code between - HttpStatusCode.InternalServerError (500) and 600. - :vartype call_count_failed: int - :ivar call_count_other: Number of other calls. - :vartype call_count_other: int - :ivar call_count_total: Total number of calls. - :vartype call_count_total: int - :ivar bandwidth: Bandwidth consumed. - :vartype bandwidth: int - :ivar cache_hit_count: Number of times when content was served from cache policy. - :vartype cache_hit_count: int - :ivar cache_miss_count: Number of times content was fetched from backend. - :vartype cache_miss_count: int - :ivar api_time_avg: Average time it took to process request. - :vartype api_time_avg: float - :ivar api_time_min: Minimum time it took to process request. - :vartype api_time_min: float - :ivar api_time_max: Maximum time it took to process request. - :vartype api_time_max: float - :ivar service_time_avg: Average time it took to process request on backend. - :vartype service_time_avg: float - :ivar service_time_min: Minimum time it took to process request on backend. - :vartype service_time_min: float - :ivar service_time_max: Maximum time it took to process request on backend. - :vartype service_time_max: float + :vartype started: ~datetime.datetime + :ivar updated: Last update time of an async resolver. The date conforms to the following + format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :vartype updated: ~datetime.datetime + :ivar result_info: Optional result info. + :vartype result_info: str + :ivar error: Error Body Contract. + :vartype error: ~azure.mgmt.apimanagement.models.ErrorResponseBody + :ivar action_log: This property if only provided as part of the TenantConfiguration_Validate + resolver. It contains the log the entities which will be updated/created/deleted as part of the + TenantConfiguration_Deploy resolver. + :vartype action_log: list[~azure.mgmt.apimanagement.models.ResolverResultLogItemContract] """ _validation = { - "user_id": {"readonly": True}, - "product_id": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "action_log": {"readonly": True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "timestamp": {"key": "timestamp", "type": "iso-8601"}, - "interval": {"key": "interval", "type": "str"}, - "country": {"key": "country", "type": "str"}, - "region": {"key": "region", "type": "str"}, - "zip": {"key": "zip", "type": "str"}, - "user_id": {"key": "userId", "type": "str"}, - "product_id": {"key": "productId", "type": "str"}, - "api_id": {"key": "apiId", "type": "str"}, - "operation_id": {"key": "operationId", "type": "str"}, - "api_region": {"key": "apiRegion", "type": "str"}, - "subscription_id": {"key": "subscriptionId", "type": "str"}, - "call_count_success": {"key": "callCountSuccess", "type": "int"}, - "call_count_blocked": {"key": "callCountBlocked", "type": "int"}, - "call_count_failed": {"key": "callCountFailed", "type": "int"}, - "call_count_other": {"key": "callCountOther", "type": "int"}, - "call_count_total": {"key": "callCountTotal", "type": "int"}, - "bandwidth": {"key": "bandwidth", "type": "int"}, - "cache_hit_count": {"key": "cacheHitCount", "type": "int"}, - "cache_miss_count": {"key": "cacheMissCount", "type": "int"}, - "api_time_avg": {"key": "apiTimeAvg", "type": "float"}, - "api_time_min": {"key": "apiTimeMin", "type": "float"}, - "api_time_max": {"key": "apiTimeMax", "type": "float"}, - "service_time_avg": {"key": "serviceTimeAvg", "type": "float"}, - "service_time_min": {"key": "serviceTimeMin", "type": "float"}, - "service_time_max": {"key": "serviceTimeMax", "type": "float"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "id_properties_id": {"key": "properties.id", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "started": {"key": "properties.started", "type": "iso-8601"}, + "updated": {"key": "properties.updated", "type": "iso-8601"}, + "result_info": {"key": "properties.resultInfo", "type": "str"}, + "error": {"key": "properties.error", "type": "ErrorResponseBody"}, + "action_log": {"key": "properties.actionLog", "type": "[ResolverResultLogItemContract]"}, } - def __init__( # pylint: disable=too-many-locals + def __init__( self, *, - name: Optional[str] = None, - timestamp: Optional[datetime.datetime] = None, - interval: Optional[str] = None, - country: Optional[str] = None, - region: Optional[str] = None, - zip: Optional[str] = None, - api_id: Optional[str] = None, - operation_id: Optional[str] = None, - api_region: Optional[str] = None, - subscription_id: Optional[str] = None, - call_count_success: Optional[int] = None, - call_count_blocked: Optional[int] = None, - call_count_failed: Optional[int] = None, - call_count_other: Optional[int] = None, - call_count_total: Optional[int] = None, - bandwidth: Optional[int] = None, - cache_hit_count: Optional[int] = None, - cache_miss_count: Optional[int] = None, - api_time_avg: Optional[float] = None, - api_time_min: Optional[float] = None, - api_time_max: Optional[float] = None, - service_time_avg: Optional[float] = None, - service_time_min: Optional[float] = None, - service_time_max: Optional[float] = None, - **kwargs - ): + id_properties_id: Optional[str] = None, + status: Optional[Union[str, "_models.AsyncResolverStatus"]] = None, + started: Optional[datetime.datetime] = None, + updated: Optional[datetime.datetime] = None, + result_info: Optional[str] = None, + error: Optional["_models.ErrorResponseBody"] = None, + **kwargs: Any + ) -> None: """ - :keyword name: Name depending on report endpoint specifies product, API, operation or developer - name. - :paramtype name: str - :keyword timestamp: Start of aggregation period. The date conforms to the following format: + :keyword id_properties_id: Resolver result identifier. + :paramtype id_properties_id: str + :keyword status: Status of an async resolver. Known values are: "Started", "InProgress", + "Succeeded", and "Failed". + :paramtype status: str or ~azure.mgmt.apimanagement.models.AsyncResolverStatus + :keyword started: Start time of an async resolver. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :paramtype timestamp: ~datetime.datetime - :keyword interval: Length of aggregation period. Interval must be multiple of 15 minutes and - may not be zero. The value should be in ISO 8601 format - (http://en.wikipedia.org/wiki/ISO_8601#Durations). - :paramtype interval: str - :keyword country: Country to which this record data is related. - :paramtype country: str - :keyword region: Country region to which this record data is related. - :paramtype region: str - :keyword zip: Zip code to which this record data is related. - :paramtype zip: str - :keyword api_id: API identifier path. /apis/{apiId}. - :paramtype api_id: str - :keyword operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. - :paramtype operation_id: str - :keyword api_region: API region identifier. - :paramtype api_region: str - :keyword subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. - :paramtype subscription_id: str - :keyword call_count_success: Number of successful calls. This includes calls returning - HttpStatusCode <= 301 and HttpStatusCode.NotModified and HttpStatusCode.TemporaryRedirect. - :paramtype call_count_success: int - :keyword call_count_blocked: Number of calls blocked due to invalid credentials. This includes - calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and - HttpStatusCode.TooManyRequests. - :paramtype call_count_blocked: int - :keyword call_count_failed: Number of calls failed due to proxy or backend errors. This - includes calls returning HttpStatusCode.BadRequest(400) and any Code between - HttpStatusCode.InternalServerError (500) and 600. - :paramtype call_count_failed: int - :keyword call_count_other: Number of other calls. - :paramtype call_count_other: int - :keyword call_count_total: Total number of calls. - :paramtype call_count_total: int - :keyword bandwidth: Bandwidth consumed. - :paramtype bandwidth: int - :keyword cache_hit_count: Number of times when content was served from cache policy. - :paramtype cache_hit_count: int - :keyword cache_miss_count: Number of times content was fetched from backend. - :paramtype cache_miss_count: int - :keyword api_time_avg: Average time it took to process request. - :paramtype api_time_avg: float - :keyword api_time_min: Minimum time it took to process request. - :paramtype api_time_min: float - :keyword api_time_max: Maximum time it took to process request. - :paramtype api_time_max: float - :keyword service_time_avg: Average time it took to process request on backend. - :paramtype service_time_avg: float - :keyword service_time_min: Minimum time it took to process request on backend. - :paramtype service_time_min: float - :keyword service_time_max: Maximum time it took to process request on backend. - :paramtype service_time_max: float + :paramtype started: ~datetime.datetime + :keyword updated: Last update time of an async resolver. The date conforms to the following + format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype updated: ~datetime.datetime + :keyword result_info: Optional result info. + :paramtype result_info: str + :keyword error: Error Body Contract. + :paramtype error: ~azure.mgmt.apimanagement.models.ErrorResponseBody """ super().__init__(**kwargs) - self.name = name - self.timestamp = timestamp - self.interval = interval - self.country = country - self.region = region - self.zip = zip - self.user_id = None - self.product_id = None - self.api_id = api_id - self.operation_id = operation_id - self.api_region = api_region - self.subscription_id = subscription_id - self.call_count_success = call_count_success - self.call_count_blocked = call_count_blocked - self.call_count_failed = call_count_failed - self.call_count_other = call_count_other - self.call_count_total = call_count_total - self.bandwidth = bandwidth - self.cache_hit_count = cache_hit_count - self.cache_miss_count = cache_miss_count - self.api_time_avg = api_time_avg - self.api_time_min = api_time_min - self.api_time_max = api_time_max - self.service_time_avg = service_time_avg - self.service_time_min = service_time_min - self.service_time_max = service_time_max - + self.id_properties_id = id_properties_id + self.status = status + self.started = started + self.updated = updated + self.result_info = result_info + self.error = error + self.action_log = None -class RepresentationContract(_serialization.Model): - """Operation request/response representation details. - All required parameters must be populated in order to send to Azure. +class ResolverResultLogItemContract(_serialization.Model): + """Log of the entity being created, updated or deleted. - :ivar content_type: Specifies a registered or custom content type for this representation, e.g. - application/xml. Required. - :vartype content_type: str - :ivar schema_id: Schema identifier. Applicable only if 'contentType' value is neither - 'application/x-www-form-urlencoded' nor 'multipart/form-data'. - :vartype schema_id: str - :ivar type_name: Type name defined by the schema. Applicable only if 'contentType' value is - neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. - :vartype type_name: str - :ivar form_parameters: Collection of form parameters. Required if 'contentType' value is either - 'application/x-www-form-urlencoded' or 'multipart/form-data'.. - :vartype form_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] - :ivar examples: Exampled defined for the representation. - :vartype examples: dict[str, ~azure.mgmt.apimanagement.models.ParameterExampleContract] + :ivar object_type: The type of entity contract. + :vartype object_type: str + :ivar action: Action like create/update/delete. + :vartype action: str + :ivar object_key: Identifier of the entity being created/updated/deleted. + :vartype object_key: str """ - _validation = { - "content_type": {"required": True}, - } - _attribute_map = { - "content_type": {"key": "contentType", "type": "str"}, - "schema_id": {"key": "schemaId", "type": "str"}, - "type_name": {"key": "typeName", "type": "str"}, - "form_parameters": {"key": "formParameters", "type": "[ParameterContract]"}, - "examples": {"key": "examples", "type": "{ParameterExampleContract}"}, + "object_type": {"key": "objectType", "type": "str"}, + "action": {"key": "action", "type": "str"}, + "object_key": {"key": "objectKey", "type": "str"}, } def __init__( self, *, - content_type: str, - schema_id: Optional[str] = None, - type_name: Optional[str] = None, - form_parameters: Optional[List["_models.ParameterContract"]] = None, - examples: Optional[Dict[str, "_models.ParameterExampleContract"]] = None, - **kwargs - ): + object_type: Optional[str] = None, + action: Optional[str] = None, + object_key: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword content_type: Specifies a registered or custom content type for this representation, - e.g. application/xml. Required. - :paramtype content_type: str - :keyword schema_id: Schema identifier. Applicable only if 'contentType' value is neither - 'application/x-www-form-urlencoded' nor 'multipart/form-data'. - :paramtype schema_id: str - :keyword type_name: Type name defined by the schema. Applicable only if 'contentType' value is - neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. - :paramtype type_name: str - :keyword form_parameters: Collection of form parameters. Required if 'contentType' value is - either 'application/x-www-form-urlencoded' or 'multipart/form-data'.. - :paramtype form_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] - :keyword examples: Exampled defined for the representation. - :paramtype examples: dict[str, ~azure.mgmt.apimanagement.models.ParameterExampleContract] + :keyword object_type: The type of entity contract. + :paramtype object_type: str + :keyword action: Action like create/update/delete. + :paramtype action: str + :keyword object_key: Identifier of the entity being created/updated/deleted. + :paramtype object_key: str """ super().__init__(**kwargs) - self.content_type = content_type - self.schema_id = schema_id - self.type_name = type_name - self.form_parameters = form_parameters - self.examples = examples + self.object_type = object_type + self.action = action + self.object_key = object_key -class RequestContract(_serialization.Model): - """Operation request details. +class ResolverUpdateContract(_serialization.Model): + """GraphQL API Resolver Update Contract details. - :ivar description: Operation request description. + :ivar display_name: Resolver Name. + :vartype display_name: str + :ivar path: Path is type/field being resolved. + :vartype path: str + :ivar description: Description of the resolver. May include HTML formatting tags. :vartype description: str - :ivar query_parameters: Collection of operation request query parameters. - :vartype query_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] - :ivar headers: Collection of operation request headers. - :vartype headers: list[~azure.mgmt.apimanagement.models.ParameterContract] - :ivar representations: Collection of operation request representations. - :vartype representations: list[~azure.mgmt.apimanagement.models.RepresentationContract] """ + _validation = { + "display_name": {"max_length": 300, "min_length": 1}, + "path": {"max_length": 300, "min_length": 1}, + "description": {"max_length": 1000}, + } + _attribute_map = { - "description": {"key": "description", "type": "str"}, - "query_parameters": {"key": "queryParameters", "type": "[ParameterContract]"}, - "headers": {"key": "headers", "type": "[ParameterContract]"}, - "representations": {"key": "representations", "type": "[RepresentationContract]"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "path": {"key": "properties.path", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, } def __init__( self, *, + display_name: Optional[str] = None, + path: Optional[str] = None, description: Optional[str] = None, - query_parameters: Optional[List["_models.ParameterContract"]] = None, - headers: Optional[List["_models.ParameterContract"]] = None, - representations: Optional[List["_models.RepresentationContract"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword description: Operation request description. + :keyword display_name: Resolver Name. + :paramtype display_name: str + :keyword path: Path is type/field being resolved. + :paramtype path: str + :keyword description: Description of the resolver. May include HTML formatting tags. :paramtype description: str - :keyword query_parameters: Collection of operation request query parameters. - :paramtype query_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] - :keyword headers: Collection of operation request headers. - :paramtype headers: list[~azure.mgmt.apimanagement.models.ParameterContract] - :keyword representations: Collection of operation request representations. - :paramtype representations: list[~azure.mgmt.apimanagement.models.RepresentationContract] """ super().__init__(**kwargs) + self.display_name = display_name + self.path = path self.description = description - self.query_parameters = query_parameters - self.headers = headers - self.representations = representations -class RequestReportCollection(_serialization.Model): - """Paged Report records list representation. +class ResourceCollection(_serialization.Model): + """A collection of resources. - :ivar value: Page values. - :vartype value: list[~azure.mgmt.apimanagement.models.RequestReportRecordContract] - :ivar count: Total record count number across all pages. + :ivar value: A collection of resources. + :vartype value: list[~azure.mgmt.apimanagement.models.ResourceCollectionValueItem] + :ivar count: Total record count number. :vartype count: int + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[RequestReportRecordContract]"}, + "value": {"key": "value", "type": "[ResourceCollectionValueItem]"}, "count": {"key": "count", "type": "int"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( self, *, - value: Optional[List["_models.RequestReportRecordContract"]] = None, + value: Optional[List["_models.ResourceCollectionValueItem"]] = None, count: Optional[int] = None, - **kwargs - ): + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Page values. - :paramtype value: list[~azure.mgmt.apimanagement.models.RequestReportRecordContract] - :keyword count: Total record count number across all pages. + :keyword value: A collection of resources. + :paramtype value: list[~azure.mgmt.apimanagement.models.ResourceCollectionValueItem] + :keyword count: Total record count number. :paramtype count: int + :keyword next_link: Next page link if any. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value self.count = count + self.next_link = next_link -class RequestReportRecordContract(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Request Report data. +class ResourceCollectionValueItem(ProxyResource): + """ResourceCollectionValueItem. Variables are only populated by the server, and will be ignored when sending a request. - :ivar api_id: API identifier path. /apis/{apiId}. - :vartype api_id: str - :ivar operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. - :vartype operation_id: str - :ivar product_id: Product identifier path. /products/{productId}. - :vartype product_id: str - :ivar user_id: User identifier path. /users/{userId}. - :vartype user_id: str - :ivar method: The HTTP method associated with this request.. - :vartype method: str - :ivar url: The full URL associated with this request. - :vartype url: str - :ivar ip_address: The client IP address associated with this request. - :vartype ip_address: str - :ivar backend_response_code: The HTTP status code received by the gateway as a result of - forwarding this request to the backend. - :vartype backend_response_code: str - :ivar response_code: The HTTP status code returned by the gateway. - :vartype response_code: int - :ivar response_size: The size of the response returned by the gateway. - :vartype response_size: int - :ivar timestamp: The date and time when this request was received by the gateway in ISO 8601 - format. - :vartype timestamp: ~datetime.datetime - :ivar cache: Specifies if response cache was involved in generating the response. If the value - is none, the cache was not used. If the value is hit, cached response was returned. If the - value is miss, the cache was used but lookup resulted in a miss and request was fulfilled by - the backend. - :vartype cache: str - :ivar api_time: The total time it took to process this request. - :vartype api_time: float - :ivar service_time: he time it took to forward this request to the backend and get the response - back. - :vartype service_time: float - :ivar api_region: Azure region where the gateway that processed this request is located. - :vartype api_region: str - :ivar subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. - :vartype subscription_id: str - :ivar request_id: Request Identifier. - :vartype request_id: str - :ivar request_size: The size of this request.. - :vartype request_size: int + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str """ _validation = { - "product_id": {"readonly": True}, - "user_id": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - "api_id": {"key": "apiId", "type": "str"}, - "operation_id": {"key": "operationId", "type": "str"}, - "product_id": {"key": "productId", "type": "str"}, - "user_id": {"key": "userId", "type": "str"}, - "method": {"key": "method", "type": "str"}, - "url": {"key": "url", "type": "str"}, - "ip_address": {"key": "ipAddress", "type": "str"}, - "backend_response_code": {"key": "backendResponseCode", "type": "str"}, - "response_code": {"key": "responseCode", "type": "int"}, - "response_size": {"key": "responseSize", "type": "int"}, - "timestamp": {"key": "timestamp", "type": "iso-8601"}, - "cache": {"key": "cache", "type": "str"}, - "api_time": {"key": "apiTime", "type": "float"}, - "service_time": {"key": "serviceTime", "type": "float"}, - "api_region": {"key": "apiRegion", "type": "str"}, - "subscription_id": {"key": "subscriptionId", "type": "str"}, - "request_id": {"key": "requestId", "type": "str"}, - "request_size": {"key": "requestSize", "type": "int"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - api_id: Optional[str] = None, - operation_id: Optional[str] = None, - method: Optional[str] = None, - url: Optional[str] = None, - ip_address: Optional[str] = None, - backend_response_code: Optional[str] = None, - response_code: Optional[int] = None, - response_size: Optional[int] = None, - timestamp: Optional[datetime.datetime] = None, - cache: Optional[str] = None, - api_time: Optional[float] = None, - service_time: Optional[float] = None, - api_region: Optional[str] = None, - subscription_id: Optional[str] = None, - request_id: Optional[str] = None, - request_size: Optional[int] = None, - **kwargs - ): - """ - :keyword api_id: API identifier path. /apis/{apiId}. - :paramtype api_id: str - :keyword operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. - :paramtype operation_id: str - :keyword method: The HTTP method associated with this request.. - :paramtype method: str - :keyword url: The full URL associated with this request. - :paramtype url: str - :keyword ip_address: The client IP address associated with this request. - :paramtype ip_address: str - :keyword backend_response_code: The HTTP status code received by the gateway as a result of - forwarding this request to the backend. - :paramtype backend_response_code: str - :keyword response_code: The HTTP status code returned by the gateway. - :paramtype response_code: int - :keyword response_size: The size of the response returned by the gateway. - :paramtype response_size: int - :keyword timestamp: The date and time when this request was received by the gateway in ISO 8601 - format. - :paramtype timestamp: ~datetime.datetime - :keyword cache: Specifies if response cache was involved in generating the response. If the - value is none, the cache was not used. If the value is hit, cached response was returned. If - the value is miss, the cache was used but lookup resulted in a miss and request was fulfilled - by the backend. - :paramtype cache: str - :keyword api_time: The total time it took to process this request. - :paramtype api_time: float - :keyword service_time: he time it took to forward this request to the backend and get the - response back. - :paramtype service_time: float - :keyword api_region: Azure region where the gateway that processed this request is located. - :paramtype api_region: str - :keyword subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. - :paramtype subscription_id: str - :keyword request_id: Request Identifier. - :paramtype request_id: str - :keyword request_size: The size of this request.. - :paramtype request_size: int - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.api_id = api_id - self.operation_id = operation_id - self.product_id = None - self.user_id = None - self.method = method - self.url = url - self.ip_address = ip_address - self.backend_response_code = backend_response_code - self.response_code = response_code - self.response_size = response_size - self.timestamp = timestamp - self.cache = cache - self.api_time = api_time - self.service_time = service_time - self.api_region = api_region - self.subscription_id = subscription_id - self.request_id = request_id - self.request_size = request_size class ResourceLocationDataContract(_serialization.Model): @@ -16069,8 +17936,8 @@ def __init__( city: Optional[str] = None, district: Optional[str] = None, country_or_region: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: A canonical name for the geographic or physical location. Required. :paramtype name: str @@ -16100,7 +17967,7 @@ class ResourceSku(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Optional[Union[str, "_models.SkuType"]] = None, **kwargs): + def __init__(self, *, name: Optional[Union[str, "_models.SkuType"]] = None, **kwargs: Any) -> None: """ :keyword name: Name of the Sku. Known values are: "Developer", "Standard", "Premium", "Basic", "Consumption", and "Isolated". @@ -16140,7 +18007,7 @@ class ResourceSkuCapacity(_serialization.Model): "scale_type": {"key": "scaleType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.minimum = None @@ -16174,7 +18041,7 @@ class ResourceSkuResult(_serialization.Model): "capacity": {"key": "capacity", "type": "ResourceSkuCapacity"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.resource_type = None @@ -16202,7 +18069,9 @@ class ResourceSkuResults(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.ResourceSkuResult"], next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: List["_models.ResourceSkuResult"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of skus available for the service. Required. :paramtype value: list[~azure.mgmt.apimanagement.models.ResourceSkuResult] @@ -16247,8 +18116,8 @@ def __init__( description: Optional[str] = None, representations: Optional[List["_models.RepresentationContract"]] = None, headers: Optional[List["_models.ParameterContract"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status_code: Operation response HTTP status code. Required. :paramtype status_code: int @@ -16289,8 +18158,8 @@ def __init__( *, sampling_type: Optional[Union[str, "_models.SamplingType"]] = None, percentage: Optional[float] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sampling_type: Sampling type. "fixed" :paramtype sampling_type: str or ~azure.mgmt.apimanagement.models.SamplingType @@ -16317,7 +18186,7 @@ class SaveConfigurationParameter(_serialization.Model): "force": {"key": "properties.force", "type": "bool"}, } - def __init__(self, *, branch: Optional[str] = None, force: Optional[bool] = None, **kwargs): + def __init__(self, *, branch: Optional[str] = None, force: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword branch: The name of the Git branch in which to commit the current configuration snapshot. @@ -16355,7 +18224,7 @@ class SchemaCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, count: Optional[int] = None, **kwargs): + def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None: """ :keyword count: Total record count number. :paramtype count: int @@ -16366,7 +18235,7 @@ def __init__(self, *, count: Optional[int] = None, **kwargs): self.next_link = None -class SchemaContract(Resource): +class SchemaContract(ProxyResource): """API Schema Contract details. Variables are only populated by the server, and will be ignored when sending a request. @@ -16419,8 +18288,8 @@ def __init__( value: Optional[str] = None, definitions: Optional[JSON] = None, components: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword content_type: Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml).
@@ -16469,8 +18338,8 @@ def __init__( value: Optional[List["_models.SubscriptionContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Page values. :paramtype value: list[~azure.mgmt.apimanagement.models.SubscriptionContract] @@ -16485,7 +18354,7 @@ def __init__( self.next_link = next_link -class SubscriptionContract(Resource): # pylint: disable=too-many-instance-attributes +class SubscriptionContract(ProxyResource): # pylint: disable=too-many-instance-attributes """Subscription details. Variables are only populated by the server, and will be ignored when sending a request. @@ -16591,8 +18460,8 @@ def __init__( secondary_key: Optional[str] = None, state_comment: Optional[str] = None, allow_tracing: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword owner_id: The user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{userId} where {userId} is a user identifier. @@ -16711,8 +18580,8 @@ def __init__( secondary_key: Optional[str] = None, state: Optional[Union[str, "_models.SubscriptionState"]] = None, allow_tracing: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword owner_id: User (user id path) for whom subscription is being created in form /users/{userId}. @@ -16763,7 +18632,7 @@ class SubscriptionKeyParameterNamesContract(_serialization.Model): "query": {"key": "query", "type": "str"}, } - def __init__(self, *, header: Optional[str] = None, query: Optional[str] = None, **kwargs): + def __init__(self, *, header: Optional[str] = None, query: Optional[str] = None, **kwargs: Any) -> None: """ :keyword header: Subscription key header name. :paramtype header: str @@ -16794,7 +18663,9 @@ class SubscriptionKeysContract(_serialization.Model): "secondary_key": {"key": "secondaryKey", "type": "str"}, } - def __init__(self, *, primary_key: Optional[str] = None, secondary_key: Optional[str] = None, **kwargs): + def __init__( + self, *, primary_key: Optional[str] = None, secondary_key: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword primary_key: Subscription primary key. :paramtype primary_key: str @@ -16817,7 +18688,7 @@ class SubscriptionsDelegationSettingsProperties(_serialization.Model): "enabled": {"key": "enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Enable or disable delegation for subscriptions. :paramtype enabled: bool @@ -16888,8 +18759,8 @@ def __init__( state: Optional[Union[str, "_models.SubscriptionState"]] = None, state_comment: Optional[str] = None, allow_tracing: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword owner_id: User identifier path: /users/{userId}. :paramtype owner_id: str @@ -16969,8 +18840,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -17019,8 +18890,8 @@ def __init__( value: Optional[List["_models.TagContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Page values. :paramtype value: list[~azure.mgmt.apimanagement.models.TagContract] @@ -17035,7 +18906,7 @@ def __init__( self.next_link = next_link -class TagContract(Resource): +class TagContract(ProxyResource): """Tag Contract details. Variables are only populated by the server, and will be ignored when sending a request. @@ -17066,7 +18937,7 @@ class TagContract(Resource): "display_name": {"key": "properties.displayName", "type": "str"}, } - def __init__(self, *, display_name: Optional[str] = None, **kwargs): + def __init__(self, *, display_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword display_name: Tag name. :paramtype display_name: str @@ -17090,7 +18961,7 @@ class TagCreateUpdateParameters(_serialization.Model): "display_name": {"key": "properties.displayName", "type": "str"}, } - def __init__(self, *, display_name: Optional[str] = None, **kwargs): + def __init__(self, *, display_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword display_name: Tag name. :paramtype display_name: str @@ -17126,8 +18997,8 @@ def __init__( description: Optional[str] = None, external_docs_url: Optional[str] = None, external_docs_description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of the Tag. :paramtype description: str @@ -17165,8 +19036,8 @@ def __init__( value: Optional[List["_models.TagDescriptionContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Page values. :paramtype value: list[~azure.mgmt.apimanagement.models.TagDescriptionContract] @@ -17181,7 +19052,7 @@ def __init__( self.next_link = next_link -class TagDescriptionContract(Resource): +class TagDescriptionContract(ProxyResource): """Contract details. Variables are only populated by the server, and will be ignored when sending a request. @@ -17233,8 +19104,8 @@ def __init__( external_docs_description: Optional[str] = None, tag_id: Optional[str] = None, display_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of the Tag. :paramtype description: str @@ -17291,8 +19162,8 @@ def __init__( external_docs_description: Optional[str] = None, tag_id: Optional[str] = None, display_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of the Tag. :paramtype description: str @@ -17342,8 +19213,8 @@ def __init__( description: Optional[str] = None, external_docs_url: Optional[str] = None, external_docs_description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description of the Tag. :paramtype description: str @@ -17381,8 +19252,8 @@ def __init__( value: Optional[List["_models.TagResourceContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Page values. :paramtype value: list[~azure.mgmt.apimanagement.models.TagResourceContract] @@ -17430,8 +19301,8 @@ def __init__( api: Optional["_models.ApiTagResourceContractProperties"] = None, operation: Optional["_models.OperationTagResourceContractProperties"] = None, product: Optional["_models.ProductTagResourceContractProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tag: Tag associated with the resource. Required. :paramtype tag: ~azure.mgmt.apimanagement.models.TagResourceContractProperties @@ -17468,8 +19339,12 @@ class TagResourceContractProperties(_serialization.Model): } def __init__( - self, *, id: Optional[str] = None, name: Optional[str] = None, **kwargs # pylint: disable=redefined-builtin - ): + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword id: Tag identifier. :paramtype id: str @@ -17481,7 +19356,7 @@ def __init__( self.name = name -class TenantConfigurationSyncStateContract(Resource): # pylint: disable=too-many-instance-attributes +class TenantConfigurationSyncStateContract(ProxyResource): # pylint: disable=too-many-instance-attributes """Result of Tenant Configuration Sync State. Variables are only populated by the server, and will be ignored when sending a request. @@ -17546,8 +19421,8 @@ def __init__( sync_date: Optional[datetime.datetime] = None, configuration_change_date: Optional[datetime.datetime] = None, last_operation_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword branch: The name of Git branch. :paramtype branch: str @@ -17602,14 +19477,14 @@ class TenantSettingsCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None self.next_link = None -class TenantSettingsContract(Resource): +class TenantSettingsContract(ProxyResource): """Tenant Settings. Variables are only populated by the server, and will be ignored when sending a request. @@ -17639,7 +19514,7 @@ class TenantSettingsContract(Resource): "settings": {"key": "properties.settings", "type": "{str}"}, } - def __init__(self, *, settings: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, settings: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword settings: Tenant settings. :paramtype settings: dict[str, str] @@ -17671,8 +19546,8 @@ def __init__( text: Optional[str] = None, enabled: Optional[bool] = None, consent_required: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword text: A terms of service text. :paramtype text: str @@ -17708,7 +19583,7 @@ class TokenBodyParameterContract(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, name: str, value: str, **kwargs): + def __init__(self, *, name: str, value: str, **kwargs: Any) -> None: """ :keyword name: body parameter name. Required. :paramtype name: str @@ -17743,8 +19618,8 @@ def __init__( value: Optional[List["_models.UserContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Page values. :paramtype value: list[~azure.mgmt.apimanagement.models.UserContract] @@ -17759,7 +19634,7 @@ def __init__( self.next_link = next_link -class UserContract(Resource): # pylint: disable=too-many-instance-attributes +class UserContract(ProxyResource): # pylint: disable=too-many-instance-attributes """User details. Variables are only populated by the server, and will be ignored when sending a request. @@ -17824,8 +19699,8 @@ def __init__( last_name: Optional[str] = None, email: Optional[str] = None, registration_date: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword 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 @@ -17881,8 +19756,8 @@ def __init__( state: Union[str, "_models.UserState"] = "active", note: Optional[str] = None, identities: Optional[List["_models.UserIdentityContract"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword 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 @@ -17950,8 +19825,8 @@ def __init__( last_name: Optional[str] = None, email: Optional[str] = None, registration_date: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword 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 @@ -18039,8 +19914,8 @@ def __init__( password: Optional[str] = None, app_type: Optional[Union[str, "_models.AppType"]] = None, confirmation: Optional[Union[str, "_models.Confirmation"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword 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 @@ -18132,8 +20007,8 @@ def __init__( password: Optional[str] = None, app_type: Optional[Union[str, "_models.AppType"]] = None, confirmation: Optional[Union[str, "_models.Confirmation"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword 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 @@ -18194,8 +20069,8 @@ def __init__( value: Optional[List["_models.UserIdentityContract"]] = None, count: Optional[int] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: User Identity values. :paramtype value: list[~azure.mgmt.apimanagement.models.UserIdentityContract] @@ -18225,8 +20100,12 @@ class UserIdentityContract(_serialization.Model): } def __init__( - self, *, provider: Optional[str] = None, id: Optional[str] = None, **kwargs # pylint: disable=redefined-builtin - ): + self, + *, + provider: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: """ :keyword provider: Identity provider name. :paramtype provider: str @@ -18252,7 +20131,7 @@ class UserIdentityProperties(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, *, principal_id: Optional[str] = None, client_id: Optional[str] = None, **kwargs): + def __init__(self, *, principal_id: Optional[str] = None, client_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword principal_id: The principal id of user assigned identity. :paramtype principal_id: str @@ -18286,8 +20165,8 @@ def __init__( *, key_type: Optional[Union[str, "_models.KeyType"]] = None, expiry: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_type: The Key to be used to generate token for user. Known values are: "primary" and "secondary". @@ -18313,7 +20192,7 @@ class UserTokenResult(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: Shared Access Authorization token for the User. :paramtype value: str @@ -18369,8 +20248,8 @@ def __init__( password: Optional[str] = None, first_name: Optional[str] = None, last_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword 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 @@ -18447,8 +20326,8 @@ def __init__( password: Optional[str] = None, first_name: Optional[str] = None, last_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword 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 @@ -18503,7 +20382,7 @@ class VirtualNetworkConfiguration(_serialization.Model): "subnet_resource_id": {"key": "subnetResourceId", "type": "str"}, } - def __init__(self, *, subnet_resource_id: Optional[str] = None, **kwargs): + def __init__(self, *, subnet_resource_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword subnet_resource_id: The full resource ID of a subnet in a virtual network to deploy the API Management service in. @@ -18515,6 +20394,113 @@ def __init__(self, *, subnet_resource_id: Optional[str] = None, **kwargs): self.subnet_resource_id = subnet_resource_id +class WikiCollection(_serialization.Model): + """Paged Wiki list representation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.WikiContract] + :ivar next_link: Next page link if any. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[WikiContract]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class WikiContract(ProxyResource): + """Wiki properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar documents: Collection wiki documents included into this wiki. + :vartype documents: list[~azure.mgmt.apimanagement.models.WikiDocumentationContract] + """ + + _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"}, + "documents": {"key": "properties.documents", "type": "[WikiDocumentationContract]"}, + } + + def __init__(self, *, documents: Optional[List["_models.WikiDocumentationContract"]] = None, **kwargs: Any) -> None: + """ + :keyword documents: Collection wiki documents included into this wiki. + :paramtype documents: list[~azure.mgmt.apimanagement.models.WikiDocumentationContract] + """ + super().__init__(**kwargs) + self.documents = documents + + +class WikiDocumentationContract(_serialization.Model): + """Wiki documentation details. + + :ivar documentation_id: Documentation Identifier. + :vartype documentation_id: str + """ + + _attribute_map = { + "documentation_id": {"key": "documentationId", "type": "str"}, + } + + def __init__(self, *, documentation_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword documentation_id: Documentation Identifier. + :paramtype documentation_id: str + """ + super().__init__(**kwargs) + self.documentation_id = documentation_id + + +class WikiUpdateContract(_serialization.Model): + """Wiki update contract details. + + :ivar documents: Collection wiki documents included into this wiki. + :vartype documents: list[~azure.mgmt.apimanagement.models.WikiDocumentationContract] + """ + + _attribute_map = { + "documents": {"key": "properties.documents", "type": "[WikiDocumentationContract]"}, + } + + def __init__(self, *, documents: Optional[List["_models.WikiDocumentationContract"]] = None, **kwargs: Any) -> None: + """ + :keyword documents: Collection wiki documents included into this wiki. + :paramtype documents: list[~azure.mgmt.apimanagement.models.WikiDocumentationContract] + """ + super().__init__(**kwargs) + self.documents = documents + + class X509CertificateName(_serialization.Model): """Properties of server X509Names. @@ -18529,7 +20515,9 @@ class X509CertificateName(_serialization.Model): "issuer_certificate_thumbprint": {"key": "issuerCertificateThumbprint", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, issuer_certificate_thumbprint: Optional[str] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, issuer_certificate_thumbprint: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword name: Common Name of the Certificate. :paramtype name: str diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/__init__.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/__init__.py index 898ea8cdf532..e5a76b36240c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/__init__.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/__init__.py @@ -12,6 +12,8 @@ from ._api_operation_operations import ApiOperationOperations from ._api_operation_policy_operations import ApiOperationPolicyOperations from ._tag_operations import TagOperations +from ._graph_ql_api_resolver_operations import GraphQLApiResolverOperations +from ._graph_ql_api_resolver_policy_operations import GraphQLApiResolverPolicyOperations from ._api_product_operations import ApiProductOperations from ._api_policy_operations import ApiPolicyOperations from ._api_schema_operations import ApiSchemaOperations @@ -21,8 +23,14 @@ from ._api_issue_attachment_operations import ApiIssueAttachmentOperations from ._api_tag_description_operations import ApiTagDescriptionOperations from ._operation_operations import OperationOperations +from ._api_wiki_operations import ApiWikiOperations +from ._api_wikis_operations import ApiWikisOperations from ._api_export_operations import ApiExportOperations from ._api_version_set_operations import ApiVersionSetOperations +from ._authorization_provider_operations import AuthorizationProviderOperations +from ._authorization_operations import AuthorizationOperations +from ._authorization_login_links_operations import AuthorizationLoginLinksOperations +from ._authorization_access_policy_operations import AuthorizationAccessPolicyOperations from ._authorization_server_operations import AuthorizationServerOperations from ._backend_operations import BackendOperations from ._cache_operations import CacheOperations @@ -35,6 +43,7 @@ from ._api_management_service_skus_operations import ApiManagementServiceSkusOperations from ._api_management_service_operations import ApiManagementServiceOperations from ._diagnostic_operations import DiagnosticOperations +from ._documentation_operations import DocumentationOperations from ._email_template_operations import EmailTemplateOperations from ._gateway_operations import GatewayOperations from ._gateway_hostname_configuration_operations import GatewayHostnameConfigurationOperations @@ -54,6 +63,8 @@ from ._outbound_network_dependencies_endpoints_operations import OutboundNetworkDependenciesEndpointsOperations from ._policy_operations import PolicyOperations from ._policy_description_operations import PolicyDescriptionOperations +from ._policy_fragment_operations import PolicyFragmentOperations +from ._portal_config_operations import PortalConfigOperations from ._portal_revision_operations import PortalRevisionOperations from ._portal_settings_operations import PortalSettingsOperations from ._sign_in_settings_operations import SignInSettingsOperations @@ -65,6 +76,8 @@ from ._product_group_operations import ProductGroupOperations from ._product_subscriptions_operations import ProductSubscriptionsOperations from ._product_policy_operations import ProductPolicyOperations +from ._product_wiki_operations import ProductWikiOperations +from ._product_wikis_operations import ProductWikisOperations from ._quota_by_counter_keys_operations import QuotaByCounterKeysOperations from ._quota_by_period_keys_operations import QuotaByPeriodKeysOperations from ._region_operations import RegionOperations @@ -84,7 +97,7 @@ from ._user_confirmation_password_operations import UserConfirmationPasswordOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -94,6 +107,8 @@ "ApiOperationOperations", "ApiOperationPolicyOperations", "TagOperations", + "GraphQLApiResolverOperations", + "GraphQLApiResolverPolicyOperations", "ApiProductOperations", "ApiPolicyOperations", "ApiSchemaOperations", @@ -103,8 +118,14 @@ "ApiIssueAttachmentOperations", "ApiTagDescriptionOperations", "OperationOperations", + "ApiWikiOperations", + "ApiWikisOperations", "ApiExportOperations", "ApiVersionSetOperations", + "AuthorizationProviderOperations", + "AuthorizationOperations", + "AuthorizationLoginLinksOperations", + "AuthorizationAccessPolicyOperations", "AuthorizationServerOperations", "BackendOperations", "CacheOperations", @@ -117,6 +138,7 @@ "ApiManagementServiceSkusOperations", "ApiManagementServiceOperations", "DiagnosticOperations", + "DocumentationOperations", "EmailTemplateOperations", "GatewayOperations", "GatewayHostnameConfigurationOperations", @@ -136,6 +158,8 @@ "OutboundNetworkDependenciesEndpointsOperations", "PolicyOperations", "PolicyDescriptionOperations", + "PolicyFragmentOperations", + "PortalConfigOperations", "PortalRevisionOperations", "PortalSettingsOperations", "SignInSettingsOperations", @@ -147,6 +171,8 @@ "ProductGroupOperations", "ProductSubscriptionsOperations", "ProductPolicyOperations", + "ProductWikiOperations", + "ProductWikisOperations", "QuotaByCounterKeysOperations", "QuotaByPeriodKeysOperations", "RegionOperations", 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 91f6861dbb34..13c216e67614 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +50,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -74,10 +71,10 @@ def build_list_by_service_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -100,7 +97,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +106,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -122,10 +121,10 @@ def build_get_entity_tag_request( "diagnosticId": _SERIALIZER.url( "diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +141,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -151,7 +150,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -164,10 +165,10 @@ def build_get_request( "diagnosticId": _SERIALIZER.url( "diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -191,8 +192,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -201,7 +202,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -214,10 +217,10 @@ def build_create_or_update_request( "diagnosticId": _SERIALIZER.url( "diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -245,8 +248,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -255,7 +258,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -268,10 +273,10 @@ def build_update_request( "diagnosticId": _SERIALIZER.url( "diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -298,7 +303,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -307,7 +312,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -320,10 +327,10 @@ def build_delete_request( "diagnosticId": _SERIALIZER.url( "diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -367,7 +374,8 @@ def list_by_service( ) -> Iterable["_models.DiagnosticContract"]: """Lists all diagnostics of an API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -391,10 +399,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiagnosticCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DiagnosticCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -421,7 +427,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -437,7 +443,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -445,14 +451,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DiagnosticCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -465,7 +472,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics" + } @distributed_trace def get_entity_tag( @@ -473,7 +482,8 @@ def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -499,10 +509,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -516,10 +524,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -536,7 +545,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" + } @distributed_trace def get( @@ -544,7 +555,8 @@ def get( ) -> _models.DiagnosticContract: """Gets the details of the Diagnostic for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -570,10 +582,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiagnosticContract] + 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( resource_group_name=resource_group_name, @@ -587,10 +597,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -610,7 +621,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" + } @overload def create_or_update( @@ -627,7 +640,8 @@ def create_or_update( ) -> _models.DiagnosticContract: """Creates a new Diagnostic for an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -666,7 +680,8 @@ def create_or_update( ) -> _models.DiagnosticContract: """Creates a new Diagnostic for an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -703,7 +718,8 @@ def create_or_update( ) -> _models.DiagnosticContract: """Creates a new Diagnostic for an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -713,7 +729,8 @@ 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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a DiagnosticContract type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -737,11 +754,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiagnosticContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -767,10 +782,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -792,11 +808,13 @@ def create_or_update( deserialized = self._deserialize("DiagnosticContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" + } @overload def update( @@ -813,7 +831,8 @@ def update( ) -> _models.DiagnosticContract: """Updates the details of the Diagnostic for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -852,7 +871,8 @@ def update( ) -> _models.DiagnosticContract: """Updates the details of the Diagnostic for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -889,7 +909,8 @@ def update( ) -> _models.DiagnosticContract: """Updates the details of the Diagnostic for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -902,7 +923,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: Diagnostic Update parameters. Is either a model type or a IO type. Required. + :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. @@ -923,11 +945,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiagnosticContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -953,10 +973,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -976,7 +997,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -984,7 +1007,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified Diagnostic from an API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1013,10 +1037,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1031,10 +1053,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1047,4 +1070,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}" + } 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 5c8802876921..806fb9fb366a 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +47,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -71,10 +68,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["format"] = _SERIALIZER.query("format", format, "str") @@ -119,7 +116,8 @@ def get( """Gets the details of the API specified by its identifier in the format specified to the Storage Blob with SAS Key valid for 5 minutes. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -148,10 +146,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiExportResult] + 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( resource_group_name=resource_group_name, @@ -166,10 +162,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,4 +183,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" + } 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 56375cf17224..86ba555a3488 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +51,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +60,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -78,10 +75,10 @@ def build_list_by_service_request( "issueId": _SERIALIZER.url( "issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -110,7 +107,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +116,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -135,10 +134,10 @@ def build_get_entity_tag_request( "attachmentId": _SERIALIZER.url( "attachment_id", attachment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -161,7 +160,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +169,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -186,10 +187,10 @@ def build_get_request( "attachmentId": _SERIALIZER.url( "attachment_id", attachment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -214,8 +215,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -224,7 +225,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -240,10 +243,10 @@ def build_create_or_update_request( "attachmentId": _SERIALIZER.url( "attachment_id", attachment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -272,7 +275,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -281,7 +284,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -297,10 +302,10 @@ def build_delete_request( "attachmentId": _SERIALIZER.url( "attachment_id", attachment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -345,7 +350,8 @@ def list_by_service( ) -> Iterable["_models.IssueAttachmentContract"]: """Lists all attachments for the Issue associated with the specified API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -374,10 +380,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueAttachmentCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IssueAttachmentCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -405,7 +409,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -421,7 +425,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -429,14 +433,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IssueAttachmentCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -449,7 +454,9 @@ 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"} # type: ignore + 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( @@ -458,7 +465,8 @@ def get_entity_tag( """Gets the entity state (Etag) version of the issue Attachment for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -487,10 +495,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -505,10 +511,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -525,7 +532,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) 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}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}" + } @distributed_trace def get( @@ -533,7 +542,8 @@ def get( ) -> _models.IssueAttachmentContract: """Gets the details of the issue Attachment for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -562,10 +572,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueAttachmentContract] + 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( resource_group_name=resource_group_name, @@ -580,10 +588,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -603,7 +612,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}" + } @overload def create_or_update( @@ -621,7 +632,8 @@ def create_or_update( ) -> _models.IssueAttachmentContract: """Creates a new Attachment for the Issue in an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -664,7 +676,8 @@ def create_or_update( ) -> _models.IssueAttachmentContract: """Creates a new Attachment for the Issue in an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -705,7 +718,8 @@ def create_or_update( ) -> _models.IssueAttachmentContract: """Creates a new Attachment for the Issue in an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -718,7 +732,8 @@ 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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a IssueAttachmentContract type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.IssueAttachmentContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -742,11 +757,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueAttachmentContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IssueAttachmentContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -773,10 +786,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -798,11 +812,13 @@ def create_or_update( deserialized = self._deserialize("IssueAttachmentContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}"} # 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 @@ -817,7 +833,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified comment from an Issue. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -849,10 +866,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -868,10 +883,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -884,4 +900,6 @@ def delete( # pylint: disable=inconsistent-return-statements 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}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}" + } 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 051c0ee6f8c3..1950d7a87fc5 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +51,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +60,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -78,10 +75,10 @@ def build_list_by_service_request( "issueId": _SERIALIZER.url( "issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -110,7 +107,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +116,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -135,10 +134,10 @@ def build_get_entity_tag_request( "commentId": _SERIALIZER.url( "comment_id", comment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -161,7 +160,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +169,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -186,10 +187,10 @@ def build_get_request( "commentId": _SERIALIZER.url( "comment_id", comment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -214,8 +215,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -224,7 +225,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -240,10 +243,10 @@ def build_create_or_update_request( "commentId": _SERIALIZER.url( "comment_id", comment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -272,7 +275,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -281,7 +284,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -297,10 +302,10 @@ def build_delete_request( "commentId": _SERIALIZER.url( "comment_id", comment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -345,7 +350,8 @@ def list_by_service( ) -> Iterable["_models.IssueCommentContract"]: """Lists all comments for the Issue associated with the specified API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -374,10 +380,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueCommentCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IssueCommentCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -405,7 +409,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -421,7 +425,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -429,14 +433,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IssueCommentCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -449,7 +454,9 @@ 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"} # type: ignore + 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( @@ -458,7 +465,8 @@ def get_entity_tag( """Gets the entity state (Etag) version of the issue Comment for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -487,10 +495,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -505,10 +511,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -525,7 +532,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) 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}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}" + } @distributed_trace def get( @@ -533,7 +542,8 @@ def get( ) -> _models.IssueCommentContract: """Gets the details of the issue Comment for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -562,10 +572,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueCommentContract] + 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( resource_group_name=resource_group_name, @@ -580,10 +588,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -603,7 +612,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}" + } @overload def create_or_update( @@ -621,7 +632,8 @@ def create_or_update( ) -> _models.IssueCommentContract: """Creates a new Comment for the Issue in an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -664,7 +676,8 @@ def create_or_update( ) -> _models.IssueCommentContract: """Creates a new Comment for the Issue in an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -705,7 +718,8 @@ def create_or_update( ) -> _models.IssueCommentContract: """Creates a new Comment for the Issue in an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -718,7 +732,8 @@ 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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a IssueCommentContract type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.IssueCommentContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -742,11 +757,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueCommentContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IssueCommentContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -773,10 +786,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -798,11 +812,13 @@ def create_or_update( deserialized = self._deserialize("IssueCommentContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}"} # 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 @@ -817,7 +833,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified comment from an Issue. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -849,10 +866,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -868,10 +883,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -884,4 +900,6 @@ def delete( # pylint: disable=inconsistent-return-statements 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}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}" + } 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 b7f26f34fc69..8959006ccfea 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +51,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +60,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -75,10 +72,10 @@ def build_list_by_service_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -105,7 +102,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +111,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -127,10 +126,10 @@ def build_get_entity_tag_request( "issueId": _SERIALIZER.url( "issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -154,7 +153,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -163,7 +162,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -176,10 +177,10 @@ def build_get_request( "issueId": _SERIALIZER.url( "issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if expand_comments_attachments is not None: @@ -207,8 +208,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -217,7 +218,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -230,10 +233,10 @@ def build_create_or_update_request( "issueId": _SERIALIZER.url( "issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -261,8 +264,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -271,7 +274,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -284,10 +289,10 @@ def build_update_request( "issueId": _SERIALIZER.url( "issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -314,7 +319,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -323,7 +328,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -336,10 +343,10 @@ def build_delete_request( "issueId": _SERIALIZER.url( "issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -384,7 +391,8 @@ def list_by_service( ) -> Iterable["_models.IssueContract"]: """Lists all issues associated with the specified API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -411,10 +419,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IssueCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -442,7 +448,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -458,7 +464,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -466,14 +472,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IssueCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -486,7 +493,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues" + } @distributed_trace def get_entity_tag( @@ -494,7 +503,8 @@ def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the Issue for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -520,10 +530,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -537,10 +545,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -557,7 +566,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" + } @distributed_trace def get( @@ -571,7 +582,8 @@ def get( ) -> _models.IssueContract: """Gets the details of the Issue for an API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -599,10 +611,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueContract] + 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( resource_group_name=resource_group_name, @@ -617,10 +627,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -640,7 +651,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" + } @overload def create_or_update( @@ -657,7 +670,8 @@ def create_or_update( ) -> _models.IssueContract: """Creates a new Issue for an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -696,7 +710,8 @@ def create_or_update( ) -> _models.IssueContract: """Creates a new Issue for an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -733,7 +748,8 @@ def create_or_update( ) -> _models.IssueContract: """Creates a new Issue for an API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -743,7 +759,7 @@ 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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a IssueContract type or a IO type. Required. :type parameters: ~azure.mgmt.apimanagement.models.IssueContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -767,11 +783,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IssueContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -797,10 +811,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -822,11 +837,13 @@ def create_or_update( 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 + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" + } @overload def update( @@ -843,7 +860,8 @@ def update( ) -> _models.IssueContract: """Updates an existing issue for an API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -882,7 +900,8 @@ def update( ) -> _models.IssueContract: """Updates an existing issue for an API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -919,7 +938,8 @@ def update( ) -> _models.IssueContract: """Updates an existing issue for an API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -932,7 +952,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: Update parameters. Is either a model type or a IO type. Required. + :param parameters: Update parameters. Is either a IssueUpdateContract type or a IO 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. @@ -953,11 +974,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IssueContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -983,10 +1002,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1006,7 +1026,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1014,7 +1036,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified Issue from an API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1043,10 +1066,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1061,10 +1082,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1077,4 +1099,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}" + } 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 8a0fee9facda..f6603b5cae7f 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,8 +42,8 @@ def build_perform_connectivity_check_async_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +52,9 @@ def build_perform_connectivity_check_async_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/connectivityCheck", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -66,10 +63,10 @@ def build_perform_connectivity_check_async_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,11 +98,9 @@ def _perform_connectivity_check_async_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ConnectivityCheckResponse]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ConnectivityCheckResponse]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -128,10 +123,11 @@ def _perform_connectivity_check_async_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -150,7 +146,9 @@ def _perform_connectivity_check_async_initial( return deserialized - _perform_connectivity_check_async_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/connectivityCheck"} # type: ignore + _perform_connectivity_check_async_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/connectivityCheck" + } @overload def begin_perform_connectivity_check_async( @@ -165,7 +163,8 @@ def begin_perform_connectivity_check_async( """Performs a connectivity check between the API Management service and a given destination, and returns metrics for the connection, as well as errors encountered while trying to establish it. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -203,7 +202,8 @@ def begin_perform_connectivity_check_async( """Performs a connectivity check between the API Management service and a given destination, and returns metrics for the connection, as well as errors encountered while trying to establish it. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -238,12 +238,13 @@ def begin_perform_connectivity_check_async( """Performs a connectivity check between the API Management service and a given destination, and returns metrics for the connection, as well as errors encountered while trying to establish it. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :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 - model type or a IO type. Required. + ConnectivityCheckRequest type or a IO 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'. @@ -266,16 +267,14 @@ def begin_perform_connectivity_check_async( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectivityCheckResponse] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectivityCheckResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._perform_connectivity_check_async_initial( # type: ignore + raw_result = self._perform_connectivity_check_async_initial( resource_group_name=resource_group_name, service_name=service_name, connectivity_check_request_params=connectivity_check_request_params, @@ -295,9 +294,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -309,6 +308,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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"} # type: ignore + begin_perform_connectivity_check_async.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/connectivityCheck" + } 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 43031af3982b..8be3e4212a17 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,10 +86,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -114,7 +107,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -130,7 +123,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -138,14 +131,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -158,4 +152,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.ApiManagement/operations"} # type: ignore + 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 6ad546c67b1d..63f928cf6efd 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,8 +44,8 @@ def build_restore_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +54,9 @@ def build_restore_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -68,10 +65,10 @@ def build_restore_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,8 +87,8 @@ def build_backup_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +97,9 @@ def build_backup_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -109,10 +108,10 @@ def build_backup_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,8 +130,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -141,7 +140,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -150,10 +151,10 @@ def build_create_or_update_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -172,8 +173,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -182,7 +183,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -191,10 +194,10 @@ def build_update_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -211,7 +214,7 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -220,7 +223,9 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -229,10 +234,10 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_ min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -249,7 +254,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -258,7 +263,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -267,10 +274,10 @@ def build_delete_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -281,11 +288,51 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) +def build_migrate_to_stv2_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/migrateToStv2", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -294,11 +341,13 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -313,16 +362,16 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -339,7 +388,7 @@ def build_get_sso_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -348,7 +397,9 @@ def build_get_sso_token_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/getssotoken", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -357,10 +408,10 @@ def build_get_sso_token_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -375,8 +426,8 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -384,10 +435,10 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -404,7 +455,7 @@ def build_get_domain_ownership_identifier_request(subscription_id: str, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -412,10 +463,10 @@ def build_get_domain_ownership_identifier_request(subscription_id: str, **kwargs "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -432,8 +483,8 @@ def build_apply_network_configuration_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -442,7 +493,9 @@ def build_apply_network_configuration_updates_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -451,10 +504,10 @@ def build_apply_network_configuration_updates_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -504,11 +557,9 @@ def _restore_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ApiManagementServiceResource]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -531,10 +582,11 @@ def _restore_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -545,15 +597,21 @@ def _restore_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _restore_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore"} # type: ignore + _restore_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore" + } @overload def begin_restore( @@ -569,7 +627,8 @@ def begin_restore( operation on the current service. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -608,7 +667,8 @@ def begin_restore( operation on the current service. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -645,12 +705,13 @@ def begin_restore( operation on the current service. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :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 model type or a IO type. Required. + operation. Is either a ApiManagementServiceBackupRestoreParameters type or a IO type. Required. :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceBackupRestoreParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -673,16 +734,14 @@ def begin_restore( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_initial( # type: ignore + raw_result = self._restore_initial( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, @@ -702,9 +761,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -716,9 +775,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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"} # type: ignore + begin_restore.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore" + } def _backup_initial( self, @@ -738,11 +799,9 @@ def _backup_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ApiManagementServiceResource]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -765,10 +824,11 @@ def _backup_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -779,15 +839,21 @@ def _backup_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _backup_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup"} # type: ignore + _backup_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup" + } @overload def begin_backup( @@ -802,7 +868,8 @@ def begin_backup( """Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -839,7 +906,8 @@ def begin_backup( """Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -874,12 +942,13 @@ def begin_backup( """Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :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 model type or a IO type. Required. + a ApiManagementServiceBackupRestoreParameters type or a IO type. Required. :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceBackupRestoreParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -902,16 +971,14 @@ def begin_backup( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._backup_initial( # type: ignore + raw_result = self._backup_initial( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, @@ -931,9 +998,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -945,9 +1012,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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"} # type: ignore + begin_backup.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup" + } def _create_or_update_initial( self, @@ -955,7 +1024,7 @@ def _create_or_update_initial( service_name: str, parameters: Union[_models.ApiManagementServiceResource, IO], **kwargs: Any - ) -> Optional[_models.ApiManagementServiceResource]: + ) -> _models.ApiManagementServiceResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -967,11 +1036,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ApiManagementServiceResource]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -994,20 +1061,20 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) @@ -1015,11 +1082,13 @@ def _create_or_update_initial( deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" + } @overload def begin_create_or_update( @@ -1034,7 +1103,8 @@ def begin_create_or_update( """Creates or updates an API Management service. This is long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1072,7 +1142,8 @@ def begin_create_or_update( """Creates or updates an API Management service. This is long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1108,12 +1179,13 @@ def begin_create_or_update( """Creates or updates an API Management service. This is long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :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 model type or a IO type. Required. + 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. @@ -1135,16 +1207,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, @@ -1164,7 +1234,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1176,9 +1246,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" + } def _update_initial( self, @@ -1198,11 +1270,9 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ApiManagementServiceResource]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1225,10 +1295,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1247,7 +1318,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" + } @overload def begin_update( @@ -1261,7 +1334,8 @@ def begin_update( ) -> LROPoller[_models.ApiManagementServiceResource]: """Updates an existing API Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1298,7 +1372,8 @@ def begin_update( ) -> LROPoller[_models.ApiManagementServiceResource]: """Updates an existing API Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1333,12 +1408,13 @@ def begin_update( ) -> LROPoller[_models.ApiManagementServiceResource]: """Updates an existing API Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :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 model type or a IO type. Required. + 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. @@ -1360,16 +1436,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, @@ -1389,7 +1463,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1401,15 +1475,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" + } @distributed_trace def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.ApiManagementServiceResource: """Gets an API Management service resource description. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1429,10 +1506,8 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceResource] + 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( resource_group_name=resource_group_name, @@ -1444,10 +1519,11 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1464,7 +1540,9 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" + } def _delete_initial( self, resource_group_name: str, service_name: str, **kwargs: Any @@ -1480,10 +1558,8 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ApiManagementServiceResource]] + 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( resource_group_name=resource_group_name, @@ -1495,10 +1571,11 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1517,13 +1594,148 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" + } @distributed_trace - def begin_delete(self, resource_group_name: str, service_name: str, **kwargs: Any) -> LROPoller[None]: + def begin_delete( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> LROPoller[_models.ApiManagementServiceResource]: """Deletes an existing API Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :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: + ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}" + } + + def _migrate_to_stv2_initial( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Optional[_models.ApiManagementServiceResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _migrate_to_stv2_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/migrateToStv2" + } + + @distributed_trace + def begin_migrate_to_stv2( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> LROPoller[_models.ApiManagementServiceResource]: + """Upgrades an API Management service to the Stv2 platform. For details refer to + https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation + and could take several minutes to complete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1544,15 +1756,13 @@ def begin_delete(self, resource_group_name: str, service_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._migrate_to_stv2_initial( resource_group_name=resource_group_name, service_name=service_name, api_version=api_version, @@ -1570,7 +1780,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1582,9 +1794,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_migrate_to_stv2.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/migrateToStv2" + } @distributed_trace def list_by_resource_group( @@ -1592,7 +1806,8 @@ def list_by_resource_group( ) -> Iterable["_models.ApiManagementServiceResource"]: """List all API Management services within a resource group. - :param resource_group_name: The name of the resource group. Required. + :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 @@ -1604,10 +1819,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiManagementServiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1629,7 +1842,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1645,7 +1858,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1653,14 +1866,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ApiManagementServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1673,7 +1887,9 @@ 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"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service" + } @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.ApiManagementServiceResource"]: @@ -1689,10 +1905,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.ApiManagementServiceResource" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiManagementServiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1713,7 +1927,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1729,7 +1943,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1737,14 +1951,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ApiManagementServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1757,7 +1972,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service"} @distributed_trace def get_sso_token( @@ -1765,7 +1980,8 @@ def get_sso_token( ) -> _models.ApiManagementServiceGetSsoTokenResult: """Gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1785,10 +2001,8 @@ def get_sso_token( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceGetSsoTokenResult] + 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( resource_group_name=resource_group_name, @@ -1800,10 +2014,11 @@ def get_sso_token( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1820,7 +2035,9 @@ def get_sso_token( return deserialized - get_sso_token.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/getssotoken"} # type: ignore + get_sso_token.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/getssotoken" + } @overload def check_name_availability( @@ -1868,7 +2085,7 @@ def check_name_availability( """Checks availability and correctness of a name for an API Management service. :param parameters: Parameters supplied to the CheckNameAvailability operation. Is either a - model type or a IO type. Required. + ApiManagementServiceCheckNameAvailabilityParameters type or a IO type. Required. :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceCheckNameAvailabilityParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1890,11 +2107,9 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceNameAvailabilityResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiManagementServiceNameAvailabilityResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1915,10 +2130,11 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1935,7 +2151,9 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability" + } @distributed_trace def get_domain_ownership_identifier( @@ -1959,10 +2177,8 @@ def get_domain_ownership_identifier( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceGetDomainOwnershipIdentifierResult] + 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( subscription_id=self._config.subscription_id, @@ -1972,10 +2188,11 @@ def get_domain_ownership_identifier( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1992,7 +2209,9 @@ def get_domain_ownership_identifier( return deserialized - get_domain_ownership_identifier.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier"} # type: ignore + get_domain_ownership_identifier.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier" + } def _apply_network_configuration_updates_initial( self, @@ -2012,11 +2231,9 @@ def _apply_network_configuration_updates_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ApiManagementServiceResource]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2042,10 +2259,11 @@ def _apply_network_configuration_updates_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2056,15 +2274,21 @@ def _apply_network_configuration_updates_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response) + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _apply_network_configuration_updates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates"} # type: ignore + _apply_network_configuration_updates_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates" + } @overload def begin_apply_network_configuration_updates( @@ -2079,7 +2303,8 @@ def begin_apply_network_configuration_updates( """Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated DNS changes. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -2119,7 +2344,8 @@ def begin_apply_network_configuration_updates( """Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated DNS changes. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -2156,14 +2382,16 @@ def begin_apply_network_configuration_updates( """Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated DNS changes. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO - type. Default value is None. + updated sequentially without incurring downtime in the region. Is either a + ApiManagementServiceApplyNetworkConfigurationParameters type or a IO 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'. @@ -2186,16 +2414,14 @@ def begin_apply_network_configuration_updates( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementServiceResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._apply_network_configuration_updates_initial( # type: ignore + raw_result = self._apply_network_configuration_updates_initial( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, @@ -2215,9 +2441,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2229,6 +2455,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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"} # type: ignore + begin_apply_network_configuration_updates.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates" + } 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 d46967400870..de88e86b2e1a 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_available_service_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +51,9 @@ def build_list_available_service_skus_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/skus", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -65,10 +62,10 @@ def build_list_available_service_skus_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -106,7 +103,8 @@ def list_available_service_skus( Gets all available SKU for a given API Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -118,10 +116,8 @@ def list_available_service_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceSkuResults] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceSkuResults] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -144,7 +140,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -160,7 +156,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -168,14 +164,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ResourceSkuResults", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,4 +185,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_available_service_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/skus"} # type: ignore + 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 681f240d1788..9ad765aaf7a5 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,16 +40,16 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/skus") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -96,10 +91,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.ApiManagementSku"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiManagementSkusResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiManagementSkusResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -120,7 +113,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -136,7 +129,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -144,14 +137,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ApiManagementSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -164,4 +158,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/skus"} # type: ignore + 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 a676476c30c5..4a8e56aba574 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +51,7 @@ def build_list_by_api_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +60,9 @@ def build_list_by_api_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -75,10 +72,10 @@ def build_list_by_api_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -103,7 +100,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +109,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -123,10 +122,10 @@ def build_get_entity_tag_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -143,7 +142,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +151,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -163,10 +164,10 @@ def build_get_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -190,8 +191,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -200,7 +201,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -211,10 +214,10 @@ def build_create_or_update_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -242,8 +245,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -252,7 +255,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -263,10 +268,10 @@ def build_update_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -293,7 +298,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -302,7 +307,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -313,10 +320,10 @@ def build_delete_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -361,7 +368,8 @@ def list_by_api( ) -> Iterable["_models.OperationContract"]: """Lists a collection of the operations for the specified API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -391,10 +399,8 @@ def list_by_api( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -422,7 +428,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -438,7 +444,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -446,14 +452,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -466,7 +473,9 @@ 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"} # type: ignore + list_by_api.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations" + } @distributed_trace def get_entity_tag( @@ -474,7 +483,8 @@ def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the API operation specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -500,10 +510,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -517,10 +525,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -537,7 +546,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" + } @distributed_trace def get( @@ -545,7 +556,8 @@ def get( ) -> _models.OperationContract: """Gets the details of the API Operation specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -571,10 +583,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationContract] + 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( resource_group_name=resource_group_name, @@ -588,10 +598,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,7 +622,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" + } @overload def create_or_update( @@ -628,7 +641,8 @@ def create_or_update( ) -> _models.OperationContract: """Creates a new operation in the API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -667,7 +681,8 @@ def create_or_update( ) -> _models.OperationContract: """Creates a new operation in the API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -704,7 +719,8 @@ def create_or_update( ) -> _models.OperationContract: """Creates a new operation in the API or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -714,7 +730,8 @@ 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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a OperationContract type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.OperationContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -738,11 +755,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -768,10 +783,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -793,11 +809,13 @@ def create_or_update( deserialized = self._deserialize("OperationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" + } @overload def update( @@ -814,7 +832,8 @@ def update( ) -> _models.OperationContract: """Updates the details of the operation in the API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -853,7 +872,8 @@ def update( ) -> _models.OperationContract: """Updates the details of the operation in the API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -890,7 +910,8 @@ def update( ) -> _models.OperationContract: """Updates the details of the operation in the API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -903,8 +924,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: API Operation Update parameters. Is either a model type or a IO type. - Required. + :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. @@ -925,11 +946,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -955,10 +974,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -978,7 +998,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -986,7 +1008,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified operation in the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1015,10 +1038,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1033,10 +1054,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1049,4 +1071,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}" + } 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 31815a996e9a..f0c9142a9a68 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_by_operation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +49,9 @@ def build_list_by_operation_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -65,10 +62,10 @@ def build_list_by_operation_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -91,7 +88,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +97,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -112,10 +111,10 @@ def build_get_entity_tag_request( "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1), "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,7 +139,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +148,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -161,10 +162,10 @@ def build_get_request( "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1), "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if format is not None: @@ -191,8 +192,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -201,7 +202,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -213,10 +216,10 @@ def build_create_or_update_request( "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1), "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -245,7 +248,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -254,7 +257,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -266,10 +271,10 @@ def build_delete_request( "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1), "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -306,7 +311,8 @@ def list_by_operation( ) -> _models.PolicyCollection: """Get the list of policy configuration at the API Operation level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -332,10 +338,8 @@ def list_by_operation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyCollection] + 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( resource_group_name=resource_group_name, @@ -349,10 +353,11 @@ def list_by_operation( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,7 +374,9 @@ def list_by_operation( return deserialized - list_by_operation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies"} # type: ignore + list_by_operation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies" + } @distributed_trace def get_entity_tag( @@ -383,7 +390,8 @@ def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the API operation policy specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -411,10 +419,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -429,10 +435,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -449,7 +456,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) 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}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}" + } @distributed_trace def get( @@ -464,7 +473,8 @@ def get( ) -> _models.PolicyContract: """Get the policy configuration at the API Operation level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -495,10 +505,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyContract] + 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( resource_group_name=resource_group_name, @@ -514,10 +522,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -537,7 +546,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}" + } @overload def create_or_update( @@ -555,7 +566,8 @@ def create_or_update( ) -> _models.PolicyContract: """Creates or updates policy configuration for the API Operation level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -597,7 +609,8 @@ def create_or_update( ) -> _models.PolicyContract: """Creates or updates policy configuration for the API Operation level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -637,7 +650,8 @@ def create_or_update( ) -> _models.PolicyContract: """Creates or updates policy configuration for the API Operation level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -649,7 +663,8 @@ 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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -673,11 +688,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -704,10 +717,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -729,11 +743,13 @@ def create_or_update( deserialized = self._deserialize("PolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}"} # 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 @@ -748,7 +764,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the policy configuration at the Api Operation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -779,10 +796,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -798,10 +813,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -814,4 +830,6 @@ def delete( # pylint: disable=inconsistent-return-statements 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}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}" + } 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 85145a5942f2..5dfeba9028ec 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +53,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +62,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -76,10 +73,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -106,7 +103,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +112,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -125,10 +124,10 @@ def build_get_entity_tag_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,7 +144,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +153,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -164,10 +165,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -190,8 +191,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -200,7 +201,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -210,10 +213,10 @@ def build_create_or_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -234,8 +237,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -244,7 +247,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -254,10 +259,10 @@ def build_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -284,7 +289,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -293,7 +298,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -303,10 +310,10 @@ def build_delete_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if delete_revisions is not None: @@ -334,7 +341,7 @@ def build_list_by_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -343,7 +350,9 @@ def build_list_by_tags_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apisByTags", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -352,10 +361,10 @@ def build_list_by_tags_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -407,7 +416,11 @@ def list_by_service( ) -> Iterable["_models.ApiContract"]: """Lists all APIs of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-create-apis + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -437,10 +450,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -468,7 +479,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -484,7 +495,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -492,14 +503,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ApiCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -512,13 +524,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -541,10 +556,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, api_id: st _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -557,10 +570,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, api_id: st params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -577,13 +591,16 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, api_id: st return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -606,10 +623,8 @@ def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiContract] + 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( resource_group_name=resource_group_name, @@ -622,10 +637,11 @@ def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -645,7 +661,9 @@ def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" + } def _create_or_update_initial( self, @@ -667,11 +685,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ApiContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ApiContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -696,10 +712,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -726,7 +743,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" + } @overload def begin_create_or_update( @@ -742,7 +761,8 @@ def begin_create_or_update( ) -> LROPoller[_models.ApiContract]: """Creates new or updates existing specified API of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -785,7 +805,8 @@ def begin_create_or_update( ) -> LROPoller[_models.ApiContract]: """Creates new or updates existing specified API of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -826,14 +847,16 @@ def begin_create_or_update( ) -> LROPoller[_models.ApiContract]: """Creates new or updates existing specified API of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: 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 - :param parameters: Create or update parameters. Is either a model type or a IO type. Required. + :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 :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -857,16 +880,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiContract] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiContract] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -892,9 +913,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -906,9 +927,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" + } @overload def update( @@ -924,7 +947,8 @@ def update( ) -> _models.ApiContract: """Updates the specified API of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -959,7 +983,8 @@ def update( ) -> _models.ApiContract: """Updates the specified API of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -992,7 +1017,8 @@ def update( ) -> _models.ApiContract: """Updates the specified API of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1002,8 +1028,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: API Update Contract parameters. Is either a model type or a IO type. - Required. + :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. @@ -1024,11 +1050,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1053,10 +1077,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1076,7 +1101,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1090,7 +1117,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified API of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1118,10 +1146,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1136,10 +1162,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1152,7 +1179,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}" + } @distributed_trace def list_by_tags( @@ -1167,7 +1196,8 @@ def list_by_tags( ) -> Iterable["_models.TagResourceContract"]: """Lists a collection of apis associated with tags. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1196,10 +1226,8 @@ def list_by_tags( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagResourceCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TagResourceCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1226,7 +1254,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1242,7 +1270,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1250,14 +1278,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TagResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1270,4 +1299,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apisByTags"} # type: ignore + 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 020f7e1a384d..31413c8a530b 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_by_api_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +49,9 @@ def build_list_by_api_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -64,10 +61,10 @@ def build_list_by_api_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,7 +86,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +95,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -109,10 +108,10 @@ def build_get_entity_tag_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,7 +135,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop( "Accept", "application/json, application/vnd.ms-azure-apim.policy+xml, application/vnd.ms-azure-apim.policy.raw+xml", @@ -148,7 +147,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -159,10 +160,10 @@ def build_get_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if format is not None: @@ -188,8 +189,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +199,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -209,10 +212,10 @@ def build_create_or_update_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -240,7 +243,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -249,7 +252,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -260,10 +265,10 @@ def build_delete_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -300,7 +305,8 @@ def list_by_api( ) -> _models.PolicyCollection: """Get the policy configuration at the API level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -323,10 +329,8 @@ def list_by_api( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyCollection] + 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( resource_group_name=resource_group_name, @@ -339,10 +343,11 @@ def list_by_api( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -359,7 +364,9 @@ def list_by_api( return deserialized - list_by_api.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies"} # type: ignore + list_by_api.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies" + } @distributed_trace def get_entity_tag( @@ -372,7 +379,8 @@ def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the API policy specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -397,10 +405,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -414,10 +420,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -434,7 +441,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}" + } @distributed_trace def get( @@ -448,7 +457,8 @@ def get( ) -> _models.PolicyContract: """Get the policy configuration at the API level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -476,10 +486,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyContract] + 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( resource_group_name=resource_group_name, @@ -494,10 +502,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -519,11 +528,13 @@ def get( deserialized = self._deserialize("PolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}" + } @overload def create_or_update( @@ -540,7 +551,8 @@ def create_or_update( ) -> _models.PolicyContract: """Creates or updates policy configuration for the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -578,7 +590,8 @@ def create_or_update( ) -> _models.PolicyContract: """Creates or updates policy configuration for the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -614,7 +627,8 @@ def create_or_update( ) -> _models.PolicyContract: """Creates or updates policy configuration for the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -623,7 +637,8 @@ 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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -647,11 +662,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -677,10 +690,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -702,11 +716,13 @@ def create_or_update( deserialized = self._deserialize("PolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}"} # 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 @@ -720,7 +736,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the policy configuration at the Api. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -748,10 +765,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -766,10 +781,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -782,4 +798,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}" + } 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 52c7ba97cebe..369c40e463d8 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +50,7 @@ def build_list_by_apis_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,9 @@ def build_list_by_apis_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/products", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -74,10 +71,10 @@ def build_list_by_apis_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -126,7 +123,8 @@ def list_by_apis( ) -> Iterable["_models.ProductContract"]: """Lists all Products, which the API is part of. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -150,10 +148,8 @@ def list_by_apis( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProductCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProductCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -180,7 +176,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -196,7 +192,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -204,14 +200,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProductCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -224,4 +221,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_apis.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/products"} # type: ignore + 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 42f470eed874..a552ca487ea5 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +50,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -74,10 +71,10 @@ def build_list_by_service_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -100,7 +97,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +106,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -122,10 +121,10 @@ def build_get_entity_tag_request( "releaseId": _SERIALIZER.url( "release_id", release_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +141,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -151,7 +150,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -164,10 +165,10 @@ def build_get_request( "releaseId": _SERIALIZER.url( "release_id", release_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -191,8 +192,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -201,7 +202,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -214,10 +217,10 @@ def build_create_or_update_request( "releaseId": _SERIALIZER.url( "release_id", release_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -245,8 +248,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -255,7 +258,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -268,10 +273,10 @@ def build_update_request( "releaseId": _SERIALIZER.url( "release_id", release_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -298,7 +303,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -307,7 +312,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -320,10 +327,10 @@ def build_delete_request( "releaseId": _SERIALIZER.url( "release_id", release_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -369,7 +376,8 @@ def list_by_service( Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -393,10 +401,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiReleaseCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiReleaseCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -423,7 +429,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -439,7 +445,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -447,14 +453,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ApiReleaseCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -467,7 +474,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases" + } @distributed_trace def get_entity_tag( @@ -475,7 +484,8 @@ def get_entity_tag( ) -> bool: """Returns the etag of an API release. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -501,10 +511,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -518,10 +526,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -538,7 +547,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" + } @distributed_trace def get( @@ -546,7 +557,8 @@ def get( ) -> _models.ApiReleaseContract: """Returns the details of an API release. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -572,10 +584,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiReleaseContract] + 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( resource_group_name=resource_group_name, @@ -589,10 +599,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -612,7 +623,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" + } @overload def create_or_update( @@ -629,7 +642,8 @@ def create_or_update( ) -> _models.ApiReleaseContract: """Creates a new Release for the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -668,7 +682,8 @@ def create_or_update( ) -> _models.ApiReleaseContract: """Creates a new Release for the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -705,7 +720,8 @@ def create_or_update( ) -> _models.ApiReleaseContract: """Creates a new Release for the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -715,7 +731,8 @@ 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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a ApiReleaseContract type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -739,11 +756,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiReleaseContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiReleaseContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -769,10 +784,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -794,11 +810,13 @@ def create_or_update( deserialized = self._deserialize("ApiReleaseContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" + } @overload def update( @@ -815,7 +833,8 @@ def update( ) -> _models.ApiReleaseContract: """Updates the details of the release of the API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -854,7 +873,8 @@ def update( ) -> _models.ApiReleaseContract: """Updates the details of the release of the API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -891,7 +911,8 @@ def update( ) -> _models.ApiReleaseContract: """Updates the details of the release of the API specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -904,8 +925,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: API Release Update parameters. Is either a model type or a IO type. - Required. + :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. @@ -926,11 +947,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiReleaseContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiReleaseContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -956,10 +975,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -979,7 +999,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -987,7 +1009,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified release in the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1016,10 +1039,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1034,10 +1055,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1050,4 +1072,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}" + } 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 7d55f2ada14b..3d5284039c52 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +50,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/revisions", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -74,10 +71,10 @@ def build_list_by_service_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -126,7 +123,8 @@ def list_by_service( ) -> Iterable["_models.ApiRevisionContract"]: """Lists all revisions of an API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -150,10 +148,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiRevisionCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiRevisionCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -180,7 +176,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -196,7 +192,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -204,14 +200,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ApiRevisionCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -224,4 +221,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}/revisions"} # type: ignore + 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 20cbee715713..e62a644df52d 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +52,7 @@ def build_list_by_api_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +61,9 @@ def build_list_by_api_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -76,10 +73,10 @@ def build_list_by_api_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -102,7 +99,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +108,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -122,10 +121,10 @@ def build_get_entity_tag_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "schemaId": _SERIALIZER.url("schema_id", schema_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +141,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -151,7 +150,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -162,10 +163,10 @@ def build_get_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "schemaId": _SERIALIZER.url("schema_id", schema_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -189,8 +190,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -199,7 +200,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -210,10 +213,10 @@ def build_create_or_update_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "schemaId": _SERIALIZER.url("schema_id", schema_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -242,7 +245,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -251,7 +254,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -262,10 +267,10 @@ def build_delete_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "schemaId": _SERIALIZER.url("schema_id", schema_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if force is not None: @@ -311,7 +316,8 @@ def list_by_api( ) -> Iterable["_models.SchemaContract"]: """Get the schema configuration at the API level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -335,10 +341,8 @@ def list_by_api( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SchemaCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SchemaCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -365,7 +369,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -381,7 +385,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -389,14 +393,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SchemaCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -409,7 +414,9 @@ 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"} # type: ignore + list_by_api.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas" + } @distributed_trace def get_entity_tag( @@ -417,7 +424,8 @@ def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the schema specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -443,10 +451,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -460,10 +466,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -480,7 +487,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" + } @distributed_trace def get( @@ -488,7 +497,8 @@ def get( ) -> _models.SchemaContract: """Get the schema configuration at the API level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -514,10 +524,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SchemaContract] + 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( resource_group_name=resource_group_name, @@ -531,10 +539,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -554,7 +563,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" + } def _create_or_update_initial( self, @@ -577,11 +588,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SchemaContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SchemaContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -607,10 +616,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -637,7 +647,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" + } @overload def begin_create_or_update( @@ -654,7 +666,8 @@ def begin_create_or_update( ) -> LROPoller[_models.SchemaContract]: """Creates or updates schema configuration for the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -701,7 +714,8 @@ def begin_create_or_update( ) -> LROPoller[_models.SchemaContract]: """Creates or updates schema configuration for the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -746,7 +760,8 @@ def begin_create_or_update( ) -> LROPoller[_models.SchemaContract]: """Creates or updates schema configuration for the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -756,7 +771,8 @@ 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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -780,16 +796,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SchemaContract] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SchemaContract] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, @@ -816,9 +830,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -830,9 +844,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -847,7 +863,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the schema configuration at the Api. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -879,10 +896,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -898,10 +913,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -914,4 +930,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}" + } 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 527f4e787b5e..84e08a7bceab 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +50,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -74,10 +71,10 @@ def build_list_by_service_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -105,7 +102,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +111,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -127,10 +126,10 @@ def build_get_entity_tag_request( "tagDescriptionId": _SERIALIZER.url( "tag_description_id", tag_description_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -152,7 +151,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -161,7 +160,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -174,10 +175,10 @@ def build_get_request( "tagDescriptionId": _SERIALIZER.url( "tag_description_id", tag_description_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -201,8 +202,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -211,7 +212,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -224,10 +227,10 @@ def build_create_or_update_request( "tagDescriptionId": _SERIALIZER.url( "tag_description_id", tag_description_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -255,7 +258,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -264,7 +267,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -277,10 +282,10 @@ def build_delete_request( "tagDescriptionId": _SERIALIZER.url( "tag_description_id", tag_description_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -325,7 +330,8 @@ def list_by_service( """Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -351,10 +357,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagDescriptionCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TagDescriptionCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -381,7 +385,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -397,7 +401,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -405,14 +409,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TagDescriptionCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -425,7 +430,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions" + } @distributed_trace def get_entity_tag( @@ -433,7 +440,8 @@ def get_entity_tag( ) -> bool: """Gets the entity state version of the tag specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -459,10 +467,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -476,10 +482,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -496,7 +503,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}" + } @distributed_trace def get( @@ -504,7 +513,8 @@ def get( ) -> _models.TagDescriptionContract: """Get Tag description in scope of API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -530,10 +540,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagDescriptionContract] + 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( resource_group_name=resource_group_name, @@ -547,10 +555,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -570,7 +579,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}" + } @overload def create_or_update( @@ -587,7 +598,8 @@ def create_or_update( ) -> _models.TagDescriptionContract: """Create/Update tag description in scope of the Api. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -626,7 +638,8 @@ def create_or_update( ) -> _models.TagDescriptionContract: """Create/Update tag description in scope of the Api. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -663,7 +676,8 @@ def create_or_update( ) -> _models.TagDescriptionContract: """Create/Update tag description in scope of the Api. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -673,7 +687,8 @@ 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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a TagDescriptionCreateParameters type or a IO + type. Required. :type parameters: ~azure.mgmt.apimanagement.models.TagDescriptionCreateParameters or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -697,11 +712,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagDescriptionContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TagDescriptionContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -727,10 +740,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -752,11 +766,13 @@ def create_or_update( deserialized = self._deserialize("TagDescriptionContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}"} # 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 @@ -770,7 +786,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete tag description for the Api. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -799,10 +816,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -817,10 +832,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -833,4 +849,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}" + } 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 f4f88138b0e8..782f6eacf19d 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +49,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +58,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -72,10 +69,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -98,7 +95,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +104,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -119,10 +118,10 @@ def build_get_entity_tag_request( "versionSetId": _SERIALIZER.url( "version_set_id", version_set_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,7 +138,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,7 +147,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -160,10 +161,10 @@ def build_get_request( "versionSetId": _SERIALIZER.url( "version_set_id", version_set_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,8 +187,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -196,7 +197,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -208,10 +211,10 @@ def build_create_or_update_request( "versionSetId": _SERIALIZER.url( "version_set_id", version_set_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -238,8 +241,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -248,7 +251,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -260,10 +265,10 @@ def build_update_request( "versionSetId": _SERIALIZER.url( "version_set_id", version_set_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -289,7 +294,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -298,7 +303,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -310,10 +317,10 @@ def build_delete_request( "versionSetId": _SERIALIZER.url( "version_set_id", version_set_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -356,7 +363,8 @@ def list_by_service( ) -> Iterable["_models.ApiVersionSetContract"]: """Lists a collection of API Version Sets in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -377,10 +385,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiVersionSetCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiVersionSetCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -406,7 +412,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -422,7 +428,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -430,14 +436,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ApiVersionSetCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -450,13 +457,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -479,10 +489,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, version_se _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -495,10 +503,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, version_se params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -515,7 +524,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, version_se return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" + } @distributed_trace def get( @@ -523,7 +534,8 @@ def get( ) -> _models.ApiVersionSetContract: """Gets the details of the Api Version Set specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -546,10 +558,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiVersionSetContract] + 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( resource_group_name=resource_group_name, @@ -562,10 +572,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -585,7 +596,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" + } @overload def create_or_update( @@ -601,7 +614,8 @@ def create_or_update( ) -> _models.ApiVersionSetContract: """Creates or Updates a Api Version Set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -636,7 +650,8 @@ def create_or_update( ) -> _models.ApiVersionSetContract: """Creates or Updates a Api Version Set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -669,14 +684,16 @@ def create_or_update( ) -> _models.ApiVersionSetContract: """Creates or Updates a Api Version Set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -700,11 +717,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiVersionSetContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiVersionSetContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -729,10 +744,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -754,11 +770,13 @@ def create_or_update( deserialized = self._deserialize("ApiVersionSetContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" + } @overload def update( @@ -774,7 +792,8 @@ def update( ) -> _models.ApiVersionSetContract: """Updates the details of the Api VersionSet specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -809,7 +828,8 @@ def update( ) -> _models.ApiVersionSetContract: """Updates the details of the Api VersionSet specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -842,7 +862,8 @@ def update( ) -> _models.ApiVersionSetContract: """Updates the details of the Api VersionSet specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -852,7 +873,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -873,11 +895,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiVersionSetContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiVersionSetContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -902,10 +922,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -925,7 +946,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -933,7 +956,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific Api Version Set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -959,10 +983,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -976,10 +998,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -992,4 +1015,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}" + } 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 new file mode 100644 index 000000000000..ae5a214e8ed4 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wiki_operations.py @@ -0,0 +1,830 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_entity_tag_request( + resource_group_name: str, service_name: str, api_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, service_name: str, api_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + service_name: str, + api_id: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, service_name: str, api_id: str, subscription_id: str, *, if_match: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, api_id: str, subscription_id: str, *, if_match: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ApiWikiOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s + :attr:`api_wiki` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get_entity_tag(self, resource_group_name: str, service_name: str, api_id: str, **kwargs: Any) -> bool: + """Gets the entity state (Etag) version of the Wiki for an API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if cls: + return cls(pipeline_response, None, response_headers) + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WikiContract] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("WikiContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + parameters: _models.WikiContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WikiContract: + """Creates a new Wiki for an API or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param api_id: API identifier. Must be unique in the current API Management service instance. + Required. + :type api_id: str + :param parameters: Create parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.WikiContract + :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 JSON body. + Default 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: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WikiContract: + """Creates a new Wiki for an API or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param api_id: API identifier. Must be unique in the current API Management service instance. + Required. + :type api_id: str + :param parameters: Create parameters. Required. + :type parameters: IO + :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: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + parameters: Union[_models.WikiContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> _models.WikiContract: + """Creates a new Wiki for an API or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WikiContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "WikiContract", is_xml=True) + + request = build_create_or_update_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, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("WikiContract", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("WikiContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + 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, + resource_group_name: str, + service_name: str, + api_id: str, + if_match: str, + parameters: _models.WikiUpdateContract, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WikiContract: + """Updates the details of the Wiki for an API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param api_id: API identifier. Must be unique in the current API Management service instance. + Required. + :type api_id: str + :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. Required. + :type parameters: ~azure.mgmt.apimanagement.models.WikiUpdateContract + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default 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: + """ + + @overload + def update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + if_match: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WikiContract: + """Updates the details of the Wiki for an API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param api_id: API identifier. Must be unique in the current API Management service instance. + Required. + :type api_id: str + :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. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WikiContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.WikiContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + if_match: str, + parameters: Union[_models.WikiUpdateContract, IO], + **kwargs: Any + ) -> _models.WikiContract: + """Updates the details of the Wiki for an API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param api_id: API identifier. Must be unique in the current API Management service instance. + Required. + :type api_id: str + :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 + :return: WikiContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.WikiContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WikiContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "WikiUpdateContract") + + request = build_update_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, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("WikiContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, api_id: str, if_match: str, **kwargs: Any + ) -> None: + """Deletes the specified Wiki from an API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param api_id: API identifier. Must be unique in the current API Management service instance. + Required. + :type api_id: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" + } 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 new file mode 100644 index 000000000000..2df055a52ab1 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wikis_operations.py @@ -0,0 +1,225 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, + service_name: str, + api_id: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1) + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ApiWikisOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s + :attr:`api_wikis` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + api_id: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.WikiContract"]: + """Gets the wikis for an API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param api_id: API identifier. Must be unique in the current API Management service instance. + Required. + :type api_id: str + :param filter: | Field | Usage | Supported operators | Supported + functions |
|-------------|-------------|-------------|-------------|
| name | + filter | eq | contains |
. Default value is None. + :type filter: str + :param top: Number of records to return. Default value is None. + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WikiCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WikiCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 new file mode 100644 index 000000000000..c401aed6f2e5 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_access_policy_operations.py @@ -0,0 +1,807 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_authorization_request( + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "authorizationProviderId": _SERIALIZER.url( + "authorization_provider_id", + authorization_provider_id, + "str", + max_length=256, + min_length=1, + pattern=r"^[^*#&+:<>?]+$", + ), + "authorizationId": _SERIALIZER.url( + "authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1) + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + authorization_access_policy_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "authorizationProviderId": _SERIALIZER.url( + "authorization_provider_id", + authorization_provider_id, + "str", + max_length=256, + min_length=1, + pattern=r"^[^*#&+:<>?]+$", + ), + "authorizationId": _SERIALIZER.url( + "authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" + ), + "authorizationAccessPolicyId": _SERIALIZER.url( + "authorization_access_policy_id", + authorization_access_policy_id, + "str", + max_length=256, + min_length=1, + pattern=r"^[^*#&+:<>?]+$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + authorization_access_policy_id: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "authorizationProviderId": _SERIALIZER.url( + "authorization_provider_id", + authorization_provider_id, + "str", + max_length=256, + min_length=1, + pattern=r"^[^*#&+:<>?]+$", + ), + "authorizationId": _SERIALIZER.url( + "authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" + ), + "authorizationAccessPolicyId": _SERIALIZER.url( + "authorization_access_policy_id", + authorization_access_policy_id, + "str", + max_length=256, + min_length=1, + pattern=r"^[^*#&+:<>?]+$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + authorization_access_policy_id: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "authorizationProviderId": _SERIALIZER.url( + "authorization_provider_id", + authorization_provider_id, + "str", + max_length=256, + min_length=1, + pattern=r"^[^*#&+:<>?]+$", + ), + "authorizationId": _SERIALIZER.url( + "authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" + ), + "authorizationAccessPolicyId": _SERIALIZER.url( + "authorization_access_policy_id", + authorization_access_policy_id, + "str", + max_length=256, + min_length=1, + pattern=r"^[^*#&+:<>?]+$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class AuthorizationAccessPolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s + :attr:`authorization_access_policy` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_authorization( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.AuthorizationAccessPolicyContract"]: + """Lists a collection of authorization access policy defined within a authorization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :param filter: | Field | Usage | Supported operators | Supported + functions |
|-------------|-------------|-------------|-------------|
| name | + filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
| + displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith + |
. Default value is None. + :type filter: str + :param top: Number of records to return. Default value is None. + :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: + ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AuthorizationAccessPolicyCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_authorization_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, + filter=filter, + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AuthorizationAccessPolicyCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_authorization.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + authorization_access_policy_id: str, + **kwargs: Any + ) -> _models.AuthorizationAccessPolicyContract: + """Gets the details of the authorization access policy specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AuthorizationAccessPolicyContract] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + authorization_provider_id=authorization_provider_id, + authorization_id=authorization_id, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationAccessPolicyContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + authorization_access_policy_id: str, + parameters: _models.AuthorizationAccessPolicyContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AuthorizationAccessPolicyContract: + """Creates or updates Authorization Access Policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :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: ~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract + :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 JSON body. + Default 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: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + authorization_access_policy_id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AuthorizationAccessPolicyContract: + """Creates or updates Authorization Access Policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :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 + :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: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + authorization_access_policy_id: str, + parameters: Union[_models.AuthorizationAccessPolicyContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> _models.AuthorizationAccessPolicyContract: + """Creates or updates Authorization Access Policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :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 + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AuthorizationAccessPolicyContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AuthorizationAccessPolicyContract", is_xml=True) + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + authorization_provider_id=authorization_provider_id, + authorization_id=authorization_id, + authorization_access_policy_id=authorization_access_policy_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationAccessPolicyContract", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationAccessPolicyContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + 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, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + authorization_access_policy_id: str, + if_match: str, + **kwargs: Any + ) -> None: + """Deletes specific access policy from the Authorization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :param authorization_access_policy_id: Identifier of the authorization access policy. Required. + :type authorization_access_policy_id: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + authorization_provider_id=authorization_provider_id, + authorization_id=authorization_id, + authorization_access_policy_id=authorization_access_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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId}" + } 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 new file mode 100644 index 000000000000..df6b26b86918 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_login_links_operations.py @@ -0,0 +1,279 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_post_request( + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/getLoginLinks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "authorizationProviderId": _SERIALIZER.url( + "authorization_provider_id", + authorization_provider_id, + "str", + max_length=256, + min_length=1, + pattern=r"^[^*#&+:<>?]+$", + ), + "authorizationId": _SERIALIZER.url( + "authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class AuthorizationLoginLinksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s + :attr:`authorization_login_links` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def post( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + parameters: _models.AuthorizationLoginRequestContract, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AuthorizationLoginResponseContract: + """Gets authorization login links. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :param parameters: Create parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationLoginRequestContract + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default 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: + """ + + @overload + def post( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AuthorizationLoginResponseContract: + """Gets authorization login links. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :param parameters: Create parameters. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AuthorizationLoginResponseContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.AuthorizationLoginResponseContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + parameters: Union[_models.AuthorizationLoginRequestContract, IO], + **kwargs: Any + ) -> _models.AuthorizationLoginResponseContract: + """Gets authorization login links. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :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 + :return: AuthorizationLoginResponseContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.AuthorizationLoginResponseContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AuthorizationLoginResponseContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AuthorizationLoginRequestContract") + + request = build_post_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, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationLoginResponseContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + post.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/getLoginLinks" + } 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 new file mode 100644 index 000000000000..15f7e3f76a6c --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_operations.py @@ -0,0 +1,976 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_authorization_provider_request( + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "authorizationProviderId": _SERIALIZER.url( + "authorization_provider_id", + authorization_provider_id, + "str", + max_length=256, + min_length=1, + pattern=r"^[^*#&+:<>?]+$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1) + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "authorizationProviderId": _SERIALIZER.url( + "authorization_provider_id", + authorization_provider_id, + "str", + max_length=256, + min_length=1, + pattern=r"^[^*#&+:<>?]+$", + ), + "authorizationId": _SERIALIZER.url( + "authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "authorizationProviderId": _SERIALIZER.url( + "authorization_provider_id", + authorization_provider_id, + "str", + max_length=256, + min_length=1, + pattern=r"^[^*#&+:<>?]+$", + ), + "authorizationId": _SERIALIZER.url( + "authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "authorizationProviderId": _SERIALIZER.url( + "authorization_provider_id", + authorization_provider_id, + "str", + max_length=256, + min_length=1, + pattern=r"^[^*#&+:<>?]+$", + ), + "authorizationId": _SERIALIZER.url( + "authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_confirm_consent_code_request( + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/confirmConsentCode", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "authorizationProviderId": _SERIALIZER.url( + "authorization_provider_id", + authorization_provider_id, + "str", + max_length=256, + min_length=1, + pattern=r"^[^*#&+:<>?]+$", + ), + "authorizationId": _SERIALIZER.url( + "authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class AuthorizationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s + :attr:`authorization` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_authorization_provider( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.AuthorizationContract"]: + """Lists a collection of authorization providers defined within a authorization provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param filter: | Field | Usage | Supported operators | Supported + functions |
|-------------|-------------|-------------|-------------|
| name | + filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
| + displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith + |
. Default value is None. + :type filter: str + :param top: Number of records to return. Default value is None. + :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] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AuthorizationCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_authorization_provider_request( + resource_group_name=resource_group_name, + service_name=service_name, + authorization_provider_id=authorization_provider_id, + subscription_id=self._config.subscription_id, + filter=filter, + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AuthorizationCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_authorization_provider.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + **kwargs: Any + ) -> _models.AuthorizationContract: + """Gets the details of the authorization specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AuthorizationContract] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + parameters: _models.AuthorizationContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AuthorizationContract: + """Creates or updates authorization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :param parameters: Create parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationContract + :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 JSON body. + Default 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: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AuthorizationContract: + """Creates or updates authorization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :param parameters: Create parameters. Required. + :type parameters: IO + :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: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + parameters: Union[_models.AuthorizationContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> _models.AuthorizationContract: + """Creates or updates authorization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :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 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AuthorizationContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AuthorizationContract", is_xml=True) + + request = build_create_or_update_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, + if_match=if_match, + api_version=api_version, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationContract", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + 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, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + if_match: str, + **kwargs: Any + ) -> None: + """Deletes specific Authorization from the Authorization provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + authorization_provider_id=authorization_provider_id, + authorization_id=authorization_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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}" + } + + @overload + def confirm_consent_code( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + parameters: _models.AuthorizationConfirmConsentCodeRequestContract, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Confirm valid consent code to suppress Authorizations anti-phishing page. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :param parameters: Create parameters. Required. + :type parameters: + ~azure.mgmt.apimanagement.models.AuthorizationConfirmConsentCodeRequestContract + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default 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: + """ + + @overload + def confirm_consent_code( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Confirm valid consent code to suppress Authorizations anti-phishing page. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param authorization_id: Identifier of the authorization. Required. + :type authorization_id: str + :param parameters: Create parameters. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def confirm_consent_code( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + authorization_id: str, + parameters: Union[_models.AuthorizationConfirmConsentCodeRequestContract, IO], + **kwargs: Any + ) -> None: + """Confirm valid consent code to suppress Authorizations anti-phishing page. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :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. + :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 + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AuthorizationConfirmConsentCodeRequestContract") + + request = build_confirm_consent_code_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, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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" + } 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 new file mode 100644 index 000000000000..cc39e9660044 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_provider_operations.py @@ -0,0 +1,698 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_service_request( + resource_group_name: str, + service_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1) + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, service_name: str, authorization_provider_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "authorizationProviderId": _SERIALIZER.url( + "authorization_provider_id", + authorization_provider_id, + "str", + max_length=256, + min_length=1, + pattern=r"^[^*#&+:<>?]+$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "authorizationProviderId": _SERIALIZER.url( + "authorization_provider_id", + authorization_provider_id, + "str", + max_length=256, + min_length=1, + pattern=r"^[^*#&+:<>?]+$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "authorizationProviderId": _SERIALIZER.url( + "authorization_provider_id", + authorization_provider_id, + "str", + max_length=256, + min_length=1, + pattern=r"^[^*#&+:<>?]+$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class AuthorizationProviderOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s + :attr:`authorization_provider` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_service( + self, + resource_group_name: str, + service_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.AuthorizationProviderContract"]: + """Lists a collection of authorization providers defined within a service instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param filter: | Field | Usage | Supported operators | Supported + functions |
|-------------|-------------|-------------|-------------|
| name | + filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
| + displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith + |
. Default value is None. + :type filter: str + :param top: Number of records to return. Default value is None. + :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: + ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.AuthorizationProviderContract] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AuthorizationProviderCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AuthorizationProviderCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_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 + ) -> _models.AuthorizationProviderContract: + """Gets the details of the authorization provider specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AuthorizationProviderContract] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationProviderContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + parameters: _models.AuthorizationProviderContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AuthorizationProviderContract: + """Creates or updates authorization provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param parameters: Create parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationProviderContract + :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 JSON body. + Default 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: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AuthorizationProviderContract: + """Creates or updates authorization provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :param parameters: Create parameters. Required. + :type parameters: IO + :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: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + service_name: str, + authorization_provider_id: str, + parameters: Union[_models.AuthorizationProviderContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> _models.AuthorizationProviderContract: + """Creates or updates authorization provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :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 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AuthorizationProviderContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AuthorizationProviderContract", is_xml=True) + + request = build_create_or_update_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, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationProviderContract", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("AuthorizationProviderContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + 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 + ) -> None: + """Deletes specific authorization provider from the API Management service instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param authorization_provider_id: Identifier of the authorization provider. Required. + :type authorization_provider_id: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}" + } 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 a4b0301e1162..dba4a29cd4ac 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +49,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +58,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -72,10 +69,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -98,7 +95,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +104,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -117,10 +116,10 @@ def build_get_entity_tag_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "authsid": _SERIALIZER.url("authsid", authsid, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -137,7 +136,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +145,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -156,10 +157,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "authsid": _SERIALIZER.url("authsid", authsid, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -182,8 +183,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +193,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -202,10 +205,10 @@ def build_create_or_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "authsid": _SERIALIZER.url("authsid", authsid, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -226,8 +229,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -236,7 +239,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -246,10 +251,10 @@ def build_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "authsid": _SERIALIZER.url("authsid", authsid, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -269,7 +274,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -278,7 +283,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -288,10 +295,10 @@ def build_delete_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "authsid": _SERIALIZER.url("authsid", authsid, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -309,7 +316,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -318,7 +325,9 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -328,10 +337,10 @@ def build_list_secrets_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "authsid": _SERIALIZER.url("authsid", authsid, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -373,7 +382,8 @@ def list_by_service( ) -> Iterable["_models.AuthorizationServerContract"]: """Lists a collection of authorization servers defined within a service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -397,10 +407,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AuthorizationServerCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AuthorizationServerCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -426,7 +434,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -442,7 +450,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -450,14 +458,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AuthorizationServerCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -470,13 +479,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -498,10 +510,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, authsid: s _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -514,10 +524,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, authsid: s params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -534,7 +545,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, authsid: s return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" + } @distributed_trace def get( @@ -542,7 +555,8 @@ def get( ) -> _models.AuthorizationServerContract: """Gets the details of the authorization server specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -564,10 +578,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AuthorizationServerContract] + 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( resource_group_name=resource_group_name, @@ -580,10 +592,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -603,7 +616,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" + } @overload def create_or_update( @@ -619,7 +634,8 @@ def create_or_update( ) -> _models.AuthorizationServerContract: """Creates new authorization server or updates an existing authorization server. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -653,7 +669,8 @@ def create_or_update( ) -> _models.AuthorizationServerContract: """Creates new authorization server or updates an existing authorization server. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -685,13 +702,15 @@ def create_or_update( ) -> _models.AuthorizationServerContract: """Creates new authorization server or updates an existing authorization server. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :param authsid: Identifier of the authorization server. Required. :type authsid: str - :param parameters: Create or update parameters. Is either a model type or a IO type. Required. + :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 :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -715,11 +734,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AuthorizationServerContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AuthorizationServerContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -744,10 +761,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -769,11 +787,13 @@ def create_or_update( deserialized = self._deserialize("AuthorizationServerContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" + } @overload def update( @@ -789,7 +809,8 @@ def update( ) -> _models.AuthorizationServerContract: """Updates the details of the authorization server specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -823,7 +844,8 @@ def update( ) -> _models.AuthorizationServerContract: """Updates the details of the authorization server specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -855,7 +877,8 @@ def update( ) -> _models.AuthorizationServerContract: """Updates the details of the authorization server specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -864,8 +887,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: OAuth2 Server settings Update parameters. Is either a model type or a IO - type. Required. + :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. @@ -886,11 +909,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AuthorizationServerContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AuthorizationServerContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -915,10 +936,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -938,7 +960,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -946,7 +970,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific authorization server instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -971,10 +996,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -988,10 +1011,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1004,7 +1028,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}" + } @distributed_trace def list_secrets( @@ -1012,7 +1038,8 @@ def list_secrets( ) -> _models.AuthorizationServerSecretsContract: """Gets the client secret details of the authorization server. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1034,10 +1061,8 @@ def list_secrets( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AuthorizationServerSecretsContract] + 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( resource_group_name=resource_group_name, @@ -1050,10 +1075,11 @@ def list_secrets( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1073,4 +1099,6 @@ def list_secrets( return deserialized - list_secrets.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}/listSecrets"} # type: ignore + list_secrets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}/listSecrets" + } 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 221ba18ac7fd..14400a19b77e 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +49,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +58,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -72,10 +69,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -98,7 +95,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +104,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -117,10 +116,10 @@ def build_get_entity_tag_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "backendId": _SERIALIZER.url("backend_id", backend_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -137,7 +136,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +145,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -156,10 +157,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "backendId": _SERIALIZER.url("backend_id", backend_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -182,8 +183,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +193,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -202,10 +205,10 @@ def build_create_or_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "backendId": _SERIALIZER.url("backend_id", backend_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -226,8 +229,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -236,7 +239,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -246,10 +251,10 @@ def build_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "backendId": _SERIALIZER.url("backend_id", backend_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -269,7 +274,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -278,7 +283,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -288,10 +295,10 @@ def build_delete_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "backendId": _SERIALIZER.url("backend_id", backend_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -309,8 +316,8 @@ def build_reconnect_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -319,7 +326,9 @@ def build_reconnect_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}/reconnect", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -329,10 +338,10 @@ def build_reconnect_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "backendId": _SERIALIZER.url("backend_id", backend_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -376,7 +385,8 @@ def list_by_service( ) -> Iterable["_models.BackendContract"]: """Lists a collection of backends in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -399,10 +409,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackendCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BackendCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -428,7 +436,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -444,7 +452,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -452,14 +460,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BackendCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -472,13 +481,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -501,10 +513,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, backend_id _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -517,10 +527,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, backend_id params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -537,7 +548,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, backend_id return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" + } @distributed_trace def get( @@ -545,7 +558,8 @@ def get( ) -> _models.BackendContract: """Gets the details of the backend specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -568,10 +582,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackendContract] + 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( resource_group_name=resource_group_name, @@ -584,10 +596,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -607,7 +620,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" + } @overload def create_or_update( @@ -623,7 +638,8 @@ def create_or_update( ) -> _models.BackendContract: """Creates or Updates a backend. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -658,7 +674,8 @@ def create_or_update( ) -> _models.BackendContract: """Creates or Updates a backend. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -691,14 +708,15 @@ def create_or_update( ) -> _models.BackendContract: """Creates or Updates a backend. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a BackendContract type or a IO type. Required. :type parameters: ~azure.mgmt.apimanagement.models.BackendContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -722,11 +740,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackendContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackendContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -751,10 +767,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -776,11 +793,13 @@ def create_or_update( deserialized = self._deserialize("BackendContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" + } @overload def update( @@ -796,7 +815,8 @@ def update( ) -> _models.BackendContract: """Updates an existing backend. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -831,7 +851,8 @@ def update( ) -> _models.BackendContract: """Updates an existing backend. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -864,7 +885,8 @@ def update( ) -> _models.BackendContract: """Updates an existing backend. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -874,7 +896,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -895,11 +918,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackendContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackendContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -924,10 +945,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -947,7 +969,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -955,7 +979,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified backend. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -981,10 +1006,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -998,10 +1021,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1014,7 +1038,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}" + } @overload def reconnect( # pylint: disable=inconsistent-return-statements @@ -1027,10 +1053,11 @@ def reconnect( # pylint: disable=inconsistent-return-statements content_type: str = "application/json", **kwargs: Any ) -> None: - """Notifies the APIM proxy to create a new connection to the backend after the specified timeout. - If no timeout was specified, timeout of 2 minutes is used. + """Notifies the API Management gateway to create a new connection to the backend after the + specified timeout. If no timeout was specified, timeout of 2 minutes is used. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1059,10 +1086,11 @@ def reconnect( # pylint: disable=inconsistent-return-statements content_type: str = "application/json", **kwargs: Any ) -> None: - """Notifies the APIM proxy to create a new connection to the backend after the specified timeout. - If no timeout was specified, timeout of 2 minutes is used. + """Notifies the API Management gateway to create a new connection to the backend after the + specified timeout. If no timeout was specified, timeout of 2 minutes is used. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1089,18 +1117,19 @@ def reconnect( # pylint: disable=inconsistent-return-statements parameters: Optional[Union[_models.BackendReconnectContract, IO]] = None, **kwargs: Any ) -> None: - """Notifies the APIM proxy to create a new connection to the backend after the specified timeout. - If no timeout was specified, timeout of 2 minutes is used. + """Notifies the API Management gateway to create a new connection to the backend after the + specified timeout. If no timeout was specified, timeout of 2 minutes is used. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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: Reconnect request parameters. Is either a model type or a IO type. Default - value is None. + :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. @@ -1121,11 +1150,9 @@ def reconnect( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1152,10 +1179,11 @@ def reconnect( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1168,4 +1196,6 @@ def reconnect( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - reconnect.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}/reconnect"} # type: ignore + reconnect.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}/reconnect" + } 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 a00a9421e22f..a563975eea6b 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +48,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +57,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -71,10 +68,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if top is not None: @@ -95,7 +92,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +101,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -114,10 +113,10 @@ def build_get_entity_tag_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "cacheId": _SERIALIZER.url("cache_id", cache_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,7 +133,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +142,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -153,10 +154,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "cacheId": _SERIALIZER.url("cache_id", cache_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -179,8 +180,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +190,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -199,10 +202,10 @@ def build_create_or_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "cacheId": _SERIALIZER.url("cache_id", cache_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -223,8 +226,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -233,7 +236,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -243,10 +248,10 @@ def build_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "cacheId": _SERIALIZER.url("cache_id", cache_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -266,7 +271,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -275,7 +280,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -285,10 +292,10 @@ def build_delete_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "cacheId": _SERIALIZER.url("cache_id", cache_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -330,7 +337,8 @@ def list_by_service( ) -> Iterable["_models.CacheContract"]: """Lists a collection of all external Caches in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -346,10 +354,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CacheCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CacheCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -374,7 +380,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -390,7 +396,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -398,14 +404,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("CacheCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,13 +425,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -447,10 +457,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, cache_id: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -463,10 +471,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, cache_id: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -483,13 +492,16 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, cache_id: return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -512,10 +524,8 @@ def get(self, resource_group_name: str, service_name: str, cache_id: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CacheContract] + 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( resource_group_name=resource_group_name, @@ -528,10 +538,11 @@ def get(self, resource_group_name: str, service_name: str, cache_id: str, **kwar params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -551,7 +562,9 @@ def get(self, resource_group_name: str, service_name: str, cache_id: str, **kwar return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" + } @overload def create_or_update( @@ -567,7 +580,11 @@ def create_or_update( ) -> _models.CacheContract: """Creates or updates an External Cache to be used in Api Management instance. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-cache-external + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -602,7 +619,11 @@ def create_or_update( ) -> _models.CacheContract: """Creates or updates an External Cache to be used in Api Management instance. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-cache-external + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -635,14 +656,19 @@ def create_or_update( ) -> _models.CacheContract: """Creates or updates an External Cache to be used in Api Management instance. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-cache-external + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -666,11 +692,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CacheContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CacheContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -695,10 +719,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -720,11 +745,13 @@ def create_or_update( deserialized = self._deserialize("CacheContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" + } @overload def update( @@ -740,7 +767,8 @@ def update( ) -> _models.CacheContract: """Updates the details of the cache specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -775,7 +803,8 @@ def update( ) -> _models.CacheContract: """Updates the details of the cache specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -808,7 +837,8 @@ def update( ) -> _models.CacheContract: """Updates the details of the cache specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -818,7 +848,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -839,11 +870,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CacheContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CacheContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -868,10 +897,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -891,7 +921,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -899,7 +931,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific Cache. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -925,10 +958,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -942,10 +973,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -958,4 +990,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}" + } 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 fe3ae9ea273a..f34f47154879 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +50,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -73,10 +70,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -103,7 +100,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +109,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -124,10 +123,10 @@ def build_get_entity_tag_request( "certificateId": _SERIALIZER.url( "certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -144,7 +143,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +152,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -165,10 +166,10 @@ def build_get_request( "certificateId": _SERIALIZER.url( "certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -191,8 +192,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -201,7 +202,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -213,10 +216,10 @@ def build_create_or_update_request( "certificateId": _SERIALIZER.url( "certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -243,7 +246,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -252,7 +255,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -264,10 +269,10 @@ def build_delete_request( "certificateId": _SERIALIZER.url( "certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -285,7 +290,7 @@ def build_refresh_secret_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -294,7 +299,9 @@ def build_refresh_secret_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}/refreshSecret", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -306,10 +313,10 @@ def build_refresh_secret_request( "certificateId": _SERIALIZER.url( "certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -352,7 +359,8 @@ def list_by_service( ) -> Iterable["_models.CertificateContract"]: """Lists a collection of all certificates in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -378,10 +386,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CertificateCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -408,7 +414,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -424,7 +430,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -432,14 +438,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("CertificateCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -452,13 +459,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -481,10 +491,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, certificat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -497,10 +505,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, certificat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -517,7 +526,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, certificat return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}" + } @distributed_trace def get( @@ -525,7 +536,8 @@ def get( ) -> _models.CertificateContract: """Gets the details of the certificate specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -548,10 +560,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateContract] + 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( resource_group_name=resource_group_name, @@ -564,10 +574,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -587,7 +598,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}" + } @overload def create_or_update( @@ -603,7 +616,12 @@ def create_or_update( ) -> _models.CertificateContract: """Creates or updates the certificate being used for authentication with the backend. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-howto-mutual-certificates/ + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -638,7 +656,12 @@ def create_or_update( ) -> _models.CertificateContract: """Creates or updates the certificate being used for authentication with the backend. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-howto-mutual-certificates/ + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -671,14 +694,20 @@ def create_or_update( ) -> _models.CertificateContract: """Creates or updates the certificate being used for authentication with the backend. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-howto-mutual-certificates/ + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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: Create or Update parameters. Is either a model type or a IO type. Required. + :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 :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -702,11 +731,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -731,10 +758,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -756,11 +784,13 @@ def create_or_update( deserialized = self._deserialize("CertificateContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}"} # 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 @@ -768,7 +798,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific certificate. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -794,10 +825,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -811,10 +840,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -827,7 +857,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}" + } @distributed_trace def refresh_secret( @@ -835,7 +867,12 @@ def refresh_secret( ) -> _models.CertificateContract: """From KeyVault, Refresh the certificate being used for authentication with the backend. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-howto-mutual-certificates/ + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -858,10 +895,8 @@ def refresh_secret( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateContract] + 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( resource_group_name=resource_group_name, @@ -874,10 +909,11 @@ def refresh_secret( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -897,4 +933,6 @@ def refresh_secret( return deserialized - refresh_secret.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}/refreshSecret"} # type: ignore + refresh_secret.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}/refreshSecret" + } 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 f5cfe399ba69..62c3258753dd 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 @@ -6,8 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +51,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -66,10 +63,10 @@ def build_list_by_service_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "contentTypeId": _SERIALIZER.url("content_type_id", content_type_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -91,7 +88,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +97,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -111,10 +110,10 @@ def build_get_entity_tag_request( ), "contentTypeId": _SERIALIZER.url("content_type_id", content_type_id, "str", max_length=80, min_length=1), "contentItemId": _SERIALIZER.url("content_item_id", content_item_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,7 +135,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +144,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -156,10 +157,10 @@ def build_get_request( ), "contentTypeId": _SERIALIZER.url("content_type_id", content_type_id, "str", max_length=80, min_length=1), "contentItemId": _SERIALIZER.url("content_item_id", content_item_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -183,7 +184,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +194,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -203,10 +207,10 @@ def build_create_or_update_request( ), "contentTypeId": _SERIALIZER.url("content_type_id", content_type_id, "str", max_length=80, min_length=1), "contentItemId": _SERIALIZER.url("content_item_id", content_item_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -214,6 +218,8 @@ def build_create_or_update_request( # Construct headers if if_match is not None: _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -232,7 +238,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -241,7 +247,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -252,10 +260,10 @@ def build_delete_request( ), "contentTypeId": _SERIALIZER.url("content_type_id", content_type_id, "str", max_length=80, min_length=1), "contentItemId": _SERIALIZER.url("content_item_id", content_item_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -292,7 +300,8 @@ def list_by_service( ) -> Iterable["_models.ContentItemContract"]: """Lists developer portal's content items specified by the provided content type. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -306,10 +315,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentItemCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContentItemCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -333,7 +340,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -349,7 +356,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -357,14 +364,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ContentItemCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -377,7 +385,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems" + } @distributed_trace def get_entity_tag( @@ -386,7 +396,8 @@ def get_entity_tag( """Returns the entity state (ETag) version of the developer portal's content item specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -410,10 +421,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -427,10 +436,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -447,7 +457,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}" + } @distributed_trace def get( @@ -455,7 +467,8 @@ def get( ) -> _models.ContentItemContract: """Returns the developer portal's content item specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -479,10 +492,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentItemContract] + 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( resource_group_name=resource_group_name, @@ -496,10 +507,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -519,7 +531,85 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + content_type_id: str, + content_item_id: str, + parameters: _models.ContentItemContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ContentItemContract: + """Creates a new developer portal's content item specified by the provided content type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param content_type_id: Content type identifier. Required. + :type content_type_id: str + :param content_item_id: Content item identifier. Required. + :type content_item_id: str + :param parameters: Create or update parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ContentItemContract + :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 JSON body. + Default 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: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + content_type_id: str, + content_item_id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ContentItemContract: + """Creates a new developer portal's content item specified by the provided content type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param content_type_id: Content type identifier. Required. + :type content_type_id: str + :param content_item_id: Content item identifier. Required. + :type content_item_id: str + :param parameters: Create or update parameters. Required. + :type parameters: IO + :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: + """ @distributed_trace def create_or_update( @@ -528,12 +618,14 @@ def create_or_update( service_name: str, content_type_id: str, content_item_id: str, + parameters: Union[_models.ContentItemContract, IO], if_match: Optional[str] = None, **kwargs: Any ) -> _models.ContentItemContract: """Creates a new developer portal's content item specified by the provided content type. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -541,9 +633,15 @@ 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 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 @@ -557,13 +655,20 @@ def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentItemContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ContentItemContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ContentItemContract", is_xml=True) request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -573,15 +678,19 @@ def create_or_update( subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, + 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) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -603,11 +712,13 @@ def create_or_update( deserialized = self._deserialize("ContentItemContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}"} # 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 @@ -621,7 +732,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Removes the specified developer portal's content item. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -648,10 +760,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -666,10 +776,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -682,4 +793,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}" + } 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 302d1c7464d7..52d051771b15 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 @@ -6,8 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +51,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -65,10 +62,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +91,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -104,10 +103,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "contentTypeId": _SERIALIZER.url("content_type_id", content_type_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,7 +129,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +139,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -149,10 +151,10 @@ def build_create_or_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "contentTypeId": _SERIALIZER.url("content_type_id", content_type_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,6 +162,8 @@ def build_create_or_update_request( # Construct headers if if_match is not None: _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -177,7 +181,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -186,7 +190,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -196,10 +202,10 @@ def build_delete_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "contentTypeId": _SERIALIZER.url("content_type_id", content_type_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,7 +243,8 @@ def list_by_service( """Lists the developer portal's content types. Content types describe content items' properties, validation rules, and constraints. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -249,10 +256,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentTypeCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContentTypeCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -275,7 +280,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -291,7 +296,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -299,14 +304,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ContentTypeCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -319,7 +325,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes" + } @distributed_trace def get( @@ -328,7 +336,8 @@ def get( """Gets the details of the developer portal's content type. Content types describe content items' properties, validation rules, and constraints. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -350,10 +359,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentTypeContract] + 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( resource_group_name=resource_group_name, @@ -366,10 +373,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,7 +397,83 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + content_type_id: str, + parameters: _models.ContentTypeContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ContentTypeContract: + """Creates or updates the developer portal's content type. Content types describe content items' + properties, validation rules, and constraints. Custom content types' identifiers need to start + with the ``c-`` prefix. Built-in content types can't be modified. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param content_type_id: Content type identifier. Required. + :type content_type_id: str + :param parameters: Create or update parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ContentTypeContract + :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 JSON body. + Default 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: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + content_type_id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ContentTypeContract: + """Creates or updates the developer portal's content type. Content types describe content items' + properties, validation rules, and constraints. Custom content types' identifiers need to start + with the ``c-`` prefix. Built-in content types can't be modified. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param content_type_id: Content type identifier. Required. + :type content_type_id: str + :param parameters: Create or update parameters. Required. + :type parameters: IO + :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: + """ @distributed_trace def create_or_update( @@ -397,6 +481,7 @@ def create_or_update( resource_group_name: str, service_name: str, content_type_id: str, + parameters: Union[_models.ContentTypeContract, IO], if_match: Optional[str] = None, **kwargs: Any ) -> _models.ContentTypeContract: @@ -404,15 +489,22 @@ def create_or_update( properties, validation rules, and constraints. Custom content types' identifiers need to start with the ``c-`` prefix. Built-in content types can't be modified. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :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 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 @@ -426,13 +518,20 @@ def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentTypeContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ContentTypeContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ContentTypeContract", is_xml=True) request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -441,15 +540,19 @@ def create_or_update( subscription_id=self._config.subscription_id, if_match=if_match, api_version=api_version, + 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) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -471,11 +574,13 @@ def create_or_update( deserialized = self._deserialize("ContentTypeContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}"} # 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 @@ -485,7 +590,8 @@ def delete( # pylint: disable=inconsistent-return-statements properties, validation rules, and constraints. Built-in content types (with identifiers starting with the ``c-`` prefix) can't be removed. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -510,10 +616,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -527,10 +631,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -543,4 +648,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}" + } 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 c36b870d5c1f..8584976795ef 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +49,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -63,10 +60,10 @@ def build_get_entity_tag_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,7 +78,7 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +87,9 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -99,10 +98,10 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_ min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,8 +118,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +128,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -138,10 +139,10 @@ def build_update_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -161,8 +162,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +172,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -180,10 +183,10 @@ def build_create_or_update_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -204,7 +207,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +216,9 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -222,10 +227,10 @@ def build_list_secrets_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -259,7 +264,8 @@ def __init__(self, *args, **kwargs): def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the DelegationSettings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -279,10 +285,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -294,10 +298,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -314,13 +319,16 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -340,10 +348,8 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalDelegationSettings] + 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( resource_group_name=resource_group_name, @@ -355,10 +361,11 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -378,7 +385,9 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation" + } @overload def update( # pylint: disable=inconsistent-return-statements @@ -393,7 +402,8 @@ def update( # pylint: disable=inconsistent-return-statements ) -> None: """Update Delegation settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -424,7 +434,8 @@ def update( # pylint: disable=inconsistent-return-statements ) -> None: """Update Delegation settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -453,14 +464,16 @@ def update( # pylint: disable=inconsistent-return-statements ) -> None: """Update Delegation settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 Delegation settings. Is either a model type or a IO type. Required. + :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. @@ -481,11 +494,9 @@ def update( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -509,10 +520,11 @@ def update( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -525,7 +537,9 @@ def update( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation" + } @overload def create_or_update( @@ -540,7 +554,8 @@ def create_or_update( ) -> _models.PortalDelegationSettings: """Create or Update Delegation settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -571,7 +586,8 @@ def create_or_update( ) -> _models.PortalDelegationSettings: """Create or Update Delegation settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -600,11 +616,13 @@ def create_or_update( ) -> _models.PortalDelegationSettings: """Create or Update Delegation settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :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 model type or a IO type. Required. + :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 :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -628,11 +646,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalDelegationSettings] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PortalDelegationSettings] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -656,10 +672,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -676,7 +693,9 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation" + } @distributed_trace def list_secrets( @@ -684,7 +703,8 @@ def list_secrets( ) -> _models.PortalSettingValidationKeyContract: """Gets the secret validation key of the DelegationSettings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -704,10 +724,8 @@ def list_secrets( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalSettingValidationKeyContract] + 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( resource_group_name=resource_group_name, @@ -719,10 +737,11 @@ def list_secrets( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -739,4 +758,6 @@ def list_secrets( return deserialized - list_secrets.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation/listSecrets"} # type: ignore + list_secrets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation/listSecrets" + } 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 603bd6e1c5a6..baa107311c80 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,10 +50,10 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/deletedservices" ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +68,7 @@ def build_get_by_name_request(service_name: str, location: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,11 +85,11 @@ def build_get_by_name_request(service_name: str, location: str, subscription_id: min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "location": _SERIALIZER.url("location", location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,7 +104,7 @@ def build_purge_request(service_name: str, location: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -126,11 +121,11 @@ def build_purge_request(service_name: str, location: str, subscription_id: str, min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "location": _SERIALIZER.url("location", location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,10 +168,8 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.DeletedServic _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedServicesCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DeletedServicesCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -197,7 +190,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -213,7 +206,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -221,14 +214,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DeletedServicesCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -241,7 +235,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/deletedservices"} # type: ignore + 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: @@ -267,10 +263,8 @@ def get_by_name(self, service_name: str, location: str, **kwargs: Any) -> _model _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedServiceContract] + 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( service_name=service_name, @@ -282,10 +276,11 @@ def get_by_name(self, service_name: str, location: str, **kwargs: Any) -> _model params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,7 +297,9 @@ def get_by_name(self, service_name: str, location: str, **kwargs: Any) -> _model return deserialized - get_by_name.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}"} # type: ignore + get_by_name.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}" + } def _purge_initial( self, service_name: str, location: str, **kwargs: Any @@ -318,10 +315,8 @@ def _purge_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.DeletedServiceContract]] + 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( service_name=service_name, @@ -333,10 +328,11 @@ def _purge_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -347,18 +343,23 @@ def _purge_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("DeletedServiceContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _purge_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}"} # type: ignore + _purge_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}" + } @distributed_trace - def begin_purge(self, service_name: str, location: str, **kwargs: Any) -> LROPoller[None]: + def begin_purge(self, service_name: str, location: str, **kwargs: Any) -> LROPoller[_models.DeletedServiceContract]: """Purges Api Management Service (deletes it with no option to undelete). :param service_name: The name of the API Management service. Required. @@ -381,15 +382,13 @@ def begin_purge(self, service_name: str, location: str, **kwargs: Any) -> LROPol _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._purge_initial( # type: ignore + raw_result = self._purge_initial( service_name=service_name, location=location, api_version=api_version, @@ -401,15 +400,19 @@ def begin_purge(self, service_name: str, location: str, **kwargs: Any) -> LROPol kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("DeletedServiceContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -421,6 +424,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_purge.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}" + } 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 3f5fcfbcbd97..4c3d1b8978a4 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +49,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +58,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -72,10 +69,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -98,7 +95,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +104,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -119,10 +118,10 @@ def build_get_entity_tag_request( "diagnosticId": _SERIALIZER.url( "diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,7 +138,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,7 +147,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -160,10 +161,10 @@ def build_get_request( "diagnosticId": _SERIALIZER.url( "diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,8 +187,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -196,7 +197,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -208,10 +211,10 @@ def build_create_or_update_request( "diagnosticId": _SERIALIZER.url( "diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -238,8 +241,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -248,7 +251,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -260,10 +265,10 @@ def build_update_request( "diagnosticId": _SERIALIZER.url( "diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -289,7 +294,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -298,7 +303,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -310,10 +317,10 @@ def build_delete_request( "diagnosticId": _SERIALIZER.url( "diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -356,7 +363,8 @@ def list_by_service( ) -> Iterable["_models.DiagnosticContract"]: """Lists all diagnostics of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -377,10 +385,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiagnosticCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DiagnosticCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -406,7 +412,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -422,7 +428,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -430,14 +436,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DiagnosticCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -450,13 +457,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -479,10 +489,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, diagnostic _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -495,10 +503,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, diagnostic params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -515,7 +524,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, diagnostic return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" + } @distributed_trace def get( @@ -523,7 +534,8 @@ def get( ) -> _models.DiagnosticContract: """Gets the details of the Diagnostic specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -546,10 +558,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiagnosticContract] + 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( resource_group_name=resource_group_name, @@ -562,10 +572,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -585,7 +596,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" + } @overload def create_or_update( @@ -601,7 +614,8 @@ def create_or_update( ) -> _models.DiagnosticContract: """Creates a new Diagnostic or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -636,7 +650,8 @@ def create_or_update( ) -> _models.DiagnosticContract: """Creates a new Diagnostic or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -669,14 +684,16 @@ def create_or_update( ) -> _models.DiagnosticContract: """Creates a new Diagnostic or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a DiagnosticContract type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -700,11 +717,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiagnosticContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -729,10 +744,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -754,11 +770,13 @@ def create_or_update( deserialized = self._deserialize("DiagnosticContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" + } @overload def update( @@ -774,7 +792,8 @@ def update( ) -> _models.DiagnosticContract: """Updates the details of the Diagnostic specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -809,7 +828,8 @@ def update( ) -> _models.DiagnosticContract: """Updates the details of the Diagnostic specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -842,7 +862,8 @@ def update( ) -> _models.DiagnosticContract: """Updates the details of the Diagnostic specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -852,7 +873,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: Diagnostic Update parameters. Is either a model type or a IO type. Required. + :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. @@ -873,11 +895,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiagnosticContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -902,10 +922,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -925,7 +946,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -933,7 +956,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified Diagnostic. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -959,10 +983,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -976,10 +998,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -992,4 +1015,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}" + } 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 new file mode 100644 index 000000000000..3254168990dc --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_documentation_operations.py @@ -0,0 +1,1020 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_service_request( + resource_group_name: str, + service_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1) + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_entity_tag_request( + resource_group_name: str, service_name: str, documentation_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "documentationId": _SERIALIZER.url( + "documentation_id", documentation_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, service_name: str, documentation_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "documentationId": _SERIALIZER.url( + "documentation_id", documentation_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + service_name: str, + documentation_id: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "documentationId": _SERIALIZER.url( + "documentation_id", documentation_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, + service_name: str, + documentation_id: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "documentationId": _SERIALIZER.url( + "documentation_id", documentation_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + documentation_id: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "documentationId": _SERIALIZER.url( + "documentation_id", documentation_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class DocumentationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s + :attr:`documentation` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_service( + self, + resource_group_name: str, + service_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DocumentationContract"]: + """Lists all Documentations of the API Management service instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param filter: | Field | Usage | Supported operators | Supported + functions |
|-------------|-------------|-------------|-------------|
| name | + filter | eq | contains |
. Default value is None. + :type filter: str + :param top: Number of records to return. Default value is None. + :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] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DocumentationCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DocumentationCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if cls: + return cls(pipeline_response, None, response_headers) + 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 + ) -> _models.DocumentationContract: + """Gets the details of the Documentation specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DocumentationContract] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("DocumentationContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + documentation_id: str, + parameters: _models.DocumentationContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DocumentationContract: + """Creates a new Documentation or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param documentation_id: Documentation identifier. Must be unique in the current API Management + service instance. Required. + :type documentation_id: str + :param parameters: Create parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.DocumentationContract + :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 JSON body. + Default 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: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + documentation_id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DocumentationContract: + """Creates a new Documentation or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param documentation_id: Documentation identifier. Must be unique in the current API Management + service instance. Required. + :type documentation_id: str + :param parameters: Create parameters. Required. + :type parameters: IO + :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: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + service_name: str, + documentation_id: str, + parameters: Union[_models.DocumentationContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> _models.DocumentationContract: + """Creates a new Documentation or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DocumentationContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "DocumentationContract", is_xml=True) + + request = build_create_or_update_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, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("DocumentationContract", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("DocumentationContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" + } + + @overload + def update( + self, + resource_group_name: str, + service_name: str, + documentation_id: str, + if_match: str, + parameters: _models.DocumentationUpdateContract, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DocumentationContract: + """Updates the details of the Documentation for an API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param documentation_id: Documentation identifier. Must be unique in the current API Management + service instance. Required. + :type documentation_id: str + :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: Documentation Update parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.DocumentationUpdateContract + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default 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: + """ + + @overload + def update( + self, + resource_group_name: str, + service_name: str, + documentation_id: str, + if_match: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DocumentationContract: + """Updates the details of the Documentation for an API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param documentation_id: Documentation identifier. Must be unique in the current API Management + service instance. Required. + :type documentation_id: str + :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: Documentation Update parameters. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DocumentationContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.DocumentationContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + service_name: str, + documentation_id: str, + if_match: str, + parameters: Union[_models.DocumentationUpdateContract, IO], + **kwargs: Any + ) -> _models.DocumentationContract: + """Updates the details of the Documentation for an API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param documentation_id: Documentation identifier. Must be unique in the current API Management + service instance. Required. + :type documentation_id: str + :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: 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 + :return: DocumentationContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.DocumentationContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DocumentationContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "DocumentationUpdateContract") + + request = build_update_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, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("DocumentationContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, documentation_id: str, if_match: str, **kwargs: Any + ) -> None: + """Deletes the specified Documentation from an API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param documentation_id: Documentation identifier. Must be unique in the current API Management + service instance. Required. + :type documentation_id: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" + } 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 fca351177cd3..b1803006385e 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +49,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +58,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -72,10 +69,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -102,7 +99,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +108,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -121,10 +120,10 @@ def build_get_entity_tag_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "templateName": _SERIALIZER.url("template_name", template_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,7 +144,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +153,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -164,10 +165,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "templateName": _SERIALIZER.url("template_name", template_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -190,8 +191,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -200,7 +201,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -210,10 +213,10 @@ def build_create_or_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "templateName": _SERIALIZER.url("template_name", template_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -240,8 +243,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -250,7 +253,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -260,10 +265,10 @@ def build_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "templateName": _SERIALIZER.url("template_name", template_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -289,7 +294,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -298,7 +303,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -308,10 +315,10 @@ def build_delete_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "templateName": _SERIALIZER.url("template_name", template_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -354,7 +361,8 @@ def list_by_service( ) -> Iterable["_models.EmailTemplateContract"]: """Gets all email templates. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -376,10 +384,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmailTemplateCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EmailTemplateCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -405,7 +411,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -421,7 +427,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -429,14 +435,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EmailTemplateCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -449,7 +456,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates" + } @distributed_trace def get_entity_tag( @@ -461,7 +470,8 @@ def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the email template specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -490,10 +500,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -506,10 +514,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -526,7 +535,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" + } @distributed_trace def get( @@ -538,7 +549,8 @@ def get( ) -> _models.EmailTemplateContract: """Gets the details of the email template specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -567,10 +579,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmailTemplateContract] + 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( resource_group_name=resource_group_name, @@ -583,10 +593,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -606,7 +617,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" + } @overload def create_or_update( @@ -622,7 +635,8 @@ def create_or_update( ) -> _models.EmailTemplateContract: """Updates an Email Template. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -663,7 +677,8 @@ def create_or_update( ) -> _models.EmailTemplateContract: """Updates an Email Template. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -702,7 +717,8 @@ def create_or_update( ) -> _models.EmailTemplateContract: """Updates an Email Template. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -715,8 +731,8 @@ def create_or_update( "passwordResetByAdminNotificationMessage", "rejectDeveloperNotificationMessage", and "requestDeveloperNotificationMessage". Required. :type template_name: str or ~azure.mgmt.apimanagement.models.TemplateName - :param parameters: Email Template update parameters. Is either a model type or a IO type. - Required. + :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 :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -740,11 +756,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmailTemplateContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EmailTemplateContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -769,10 +783,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -789,11 +804,13 @@ def create_or_update( deserialized = self._deserialize("EmailTemplateContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" + } @overload def update( @@ -809,7 +826,8 @@ def update( ) -> _models.EmailTemplateContract: """Updates API Management email template. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -850,7 +868,8 @@ def update( ) -> _models.EmailTemplateContract: """Updates API Management email template. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -889,7 +908,8 @@ def update( ) -> _models.EmailTemplateContract: """Updates API Management email template. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -905,7 +925,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -926,11 +947,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmailTemplateContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EmailTemplateContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -955,10 +974,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -978,7 +998,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -991,7 +1013,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Reset the Email Template to default template provided by the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1023,10 +1046,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1040,10 +1061,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1056,4 +1078,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}" + } 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 8bcd2091dea1..4f83945d0071 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +50,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -74,10 +71,10 @@ def build_list_by_service_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -100,7 +97,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +106,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -120,10 +119,10 @@ def build_get_entity_tag_request( ), "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,8 +139,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +149,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -161,10 +162,10 @@ def build_create_or_update_request( ), "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -183,7 +184,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +193,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -203,10 +206,10 @@ def build_delete_request( ), "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -249,7 +252,8 @@ def list_by_service( ) -> Iterable["_models.ApiContract"]: """Lists a collection of the APIs associated with a gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -273,10 +277,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -303,7 +305,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -319,7 +321,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -327,14 +329,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ApiCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -347,7 +350,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis" + } @distributed_trace def get_entity_tag( @@ -355,7 +360,8 @@ def get_entity_tag( ) -> bool: """Checks that API entity specified by identifier is associated with the Gateway entity. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -381,10 +387,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -398,10 +402,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,7 +423,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}" + } @overload def create_or_update( @@ -434,7 +441,8 @@ def create_or_update( ) -> _models.ApiContract: """Adds an API to the specified Gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -469,7 +477,8 @@ def create_or_update( ) -> _models.ApiContract: """Adds an API to the specified Gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -502,7 +511,8 @@ def create_or_update( ) -> _models.ApiContract: """Adds an API to the specified Gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -512,7 +522,7 @@ 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 model type or a IO type. Default value is None. + :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. @@ -533,11 +543,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -565,10 +573,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -585,11 +594,13 @@ def create_or_update( deserialized = self._deserialize("ApiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}"} # 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 @@ -597,7 +608,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified API from the specified Gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -623,10 +635,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -640,10 +650,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -656,4 +667,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}" + } 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 565ae194ee52..4a86827e9853 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +50,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -74,10 +71,10 @@ def build_list_by_service_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -105,7 +102,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +111,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -127,10 +126,10 @@ def build_get_entity_tag_request( "certificateId": _SERIALIZER.url( "certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -152,7 +151,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -161,7 +160,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -174,10 +175,10 @@ def build_get_request( "certificateId": _SERIALIZER.url( "certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -201,8 +202,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -211,7 +212,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -224,10 +227,10 @@ def build_create_or_update_request( "certificateId": _SERIALIZER.url( "certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -255,7 +258,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -264,7 +267,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -277,10 +282,10 @@ def build_delete_request( "certificateId": _SERIALIZER.url( "certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -324,7 +329,8 @@ def list_by_service( ) -> Iterable["_models.GatewayCertificateAuthorityContract"]: """Lists the collection of Certificate Authorities for the specified Gateway entity. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -349,10 +355,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayCertificateAuthorityCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GatewayCertificateAuthorityCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -379,7 +383,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -395,7 +399,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -403,14 +407,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("GatewayCertificateAuthorityCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -423,7 +428,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities" + } @distributed_trace def get_entity_tag( @@ -431,7 +438,8 @@ def get_entity_tag( ) -> bool: """Checks if Certificate entity is assigned to Gateway entity as Certificate Authority. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -457,10 +465,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -474,10 +480,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -494,7 +501,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}" + } @distributed_trace def get( @@ -502,7 +511,8 @@ def get( ) -> _models.GatewayCertificateAuthorityContract: """Get assigned Gateway Certificate Authority details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -528,10 +538,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayCertificateAuthorityContract] + 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( resource_group_name=resource_group_name, @@ -545,10 +553,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -568,7 +577,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}" + } @overload def create_or_update( @@ -585,7 +596,8 @@ def create_or_update( ) -> _models.GatewayCertificateAuthorityContract: """Assign Certificate entity to Gateway entity as Certificate Authority. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -624,7 +636,8 @@ def create_or_update( ) -> _models.GatewayCertificateAuthorityContract: """Assign Certificate entity to Gateway entity as Certificate Authority. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -661,7 +674,8 @@ def create_or_update( ) -> _models.GatewayCertificateAuthorityContract: """Assign Certificate entity to Gateway entity as Certificate Authority. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -671,7 +685,7 @@ 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 model type or a IO type. Required. + :param parameters: Is either a GatewayCertificateAuthorityContract type or a IO type. Required. :type parameters: ~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -695,11 +709,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayCertificateAuthorityContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayCertificateAuthorityContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -725,10 +737,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -750,11 +763,13 @@ def create_or_update( deserialized = self._deserialize("GatewayCertificateAuthorityContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}"} # 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 @@ -768,7 +783,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Remove relationship between Certificate Authority and Gateway entity. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -797,10 +813,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -815,10 +829,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -831,4 +846,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}" + } 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 92723e77990d..41fad0f86a7e 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +50,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -74,10 +71,10 @@ def build_list_by_service_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -100,7 +97,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +106,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -120,10 +119,10 @@ def build_get_entity_tag_request( ), "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1), "hcId": _SERIALIZER.url("hc_id", hc_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,7 +139,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +148,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -160,10 +161,10 @@ def build_get_request( ), "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1), "hcId": _SERIALIZER.url("hc_id", hc_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -187,8 +188,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -197,7 +198,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -208,10 +211,10 @@ def build_create_or_update_request( ), "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1), "hcId": _SERIALIZER.url("hc_id", hc_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -239,7 +242,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -248,7 +251,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -259,10 +264,10 @@ def build_delete_request( ), "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1), "hcId": _SERIALIZER.url("hc_id", hc_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -306,7 +311,8 @@ def list_by_service( ) -> Iterable["_models.GatewayHostnameConfigurationContract"]: """Lists the collection of hostname configurations for the specified gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -333,10 +339,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayHostnameConfigurationCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GatewayHostnameConfigurationCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -363,7 +367,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -379,7 +383,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -387,14 +391,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("GatewayHostnameConfigurationCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -407,7 +412,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations" + } @distributed_trace def get_entity_tag( @@ -416,7 +423,8 @@ def get_entity_tag( """Checks that hostname configuration entity specified by identifier exists for specified Gateway entity. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -442,10 +450,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -459,10 +465,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -479,7 +486,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}" + } @distributed_trace def get( @@ -487,7 +496,8 @@ def get( ) -> _models.GatewayHostnameConfigurationContract: """Get details of a hostname configuration. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -513,10 +523,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayHostnameConfigurationContract] + 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( resource_group_name=resource_group_name, @@ -530,10 +538,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -553,7 +562,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}" + } @overload def create_or_update( @@ -570,7 +581,8 @@ def create_or_update( ) -> _models.GatewayHostnameConfigurationContract: """Creates of updates hostname configuration for a Gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -609,7 +621,8 @@ def create_or_update( ) -> _models.GatewayHostnameConfigurationContract: """Creates of updates hostname configuration for a Gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -646,7 +659,8 @@ def create_or_update( ) -> _models.GatewayHostnameConfigurationContract: """Creates of updates hostname configuration for a Gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -656,7 +670,8 @@ 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 model type or a IO type. Required. + :param parameters: Is either a GatewayHostnameConfigurationContract type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -680,11 +695,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayHostnameConfigurationContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayHostnameConfigurationContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -710,10 +723,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -735,11 +749,13 @@ def create_or_update( deserialized = self._deserialize("GatewayHostnameConfigurationContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}"} # 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 @@ -747,7 +763,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified hostname configuration from the specified Gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -776,10 +793,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -794,10 +809,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -810,4 +826,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}" + } 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 e821135c634e..6b02ffbf6d86 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +49,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +58,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -72,10 +69,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -98,7 +95,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +104,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -117,10 +116,10 @@ def build_get_entity_tag_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -137,7 +136,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +145,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -156,10 +157,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -182,8 +183,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +193,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -202,10 +205,10 @@ def build_create_or_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -226,8 +229,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -236,7 +239,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -246,10 +251,10 @@ def build_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -269,7 +274,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -278,7 +283,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -288,10 +295,10 @@ def build_delete_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -309,7 +316,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -318,7 +325,9 @@ def build_list_keys_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listKeys", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -328,10 +337,10 @@ def build_list_keys_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -348,8 +357,8 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -358,7 +367,9 @@ def build_regenerate_key_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/regenerateKey", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -368,10 +379,10 @@ def build_regenerate_key_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -390,8 +401,8 @@ def build_generate_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -400,7 +411,9 @@ def build_generate_token_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/generateToken", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -410,10 +423,10 @@ def build_generate_token_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -457,7 +470,8 @@ def list_by_service( ) -> Iterable["_models.GatewayContract"]: """Lists a collection of gateways registered with service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -480,10 +494,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GatewayCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -509,7 +521,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -525,7 +537,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -533,14 +545,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("GatewayCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -553,13 +566,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -582,10 +598,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, gateway_id _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -598,10 +612,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, gateway_id params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -618,7 +633,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, gateway_id return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" + } @distributed_trace def get( @@ -626,7 +643,8 @@ def get( ) -> _models.GatewayContract: """Gets the details of the Gateway specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -649,10 +667,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayContract] + 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( resource_group_name=resource_group_name, @@ -665,10 +681,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -688,7 +705,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" + } @overload def create_or_update( @@ -704,7 +723,8 @@ def create_or_update( ) -> _models.GatewayContract: """Creates or updates a Gateway to be used in Api Management instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -739,7 +759,8 @@ def create_or_update( ) -> _models.GatewayContract: """Creates or updates a Gateway to be used in Api Management instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -772,14 +793,15 @@ def create_or_update( ) -> _models.GatewayContract: """Creates or updates a Gateway to be used in Api Management instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param parameters: Is either a GatewayContract type or a IO type. Required. :type parameters: ~azure.mgmt.apimanagement.models.GatewayContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -803,11 +825,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -832,10 +852,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -857,11 +878,13 @@ def create_or_update( deserialized = self._deserialize("GatewayContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" + } @overload def update( @@ -877,7 +900,8 @@ def update( ) -> _models.GatewayContract: """Updates the details of the gateway specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -912,7 +936,8 @@ def update( ) -> _models.GatewayContract: """Updates the details of the gateway specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -945,7 +970,8 @@ def update( ) -> _models.GatewayContract: """Updates the details of the gateway specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -955,7 +981,7 @@ 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 model type or a IO type. Required. + :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. @@ -976,11 +1002,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1005,10 +1029,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1028,7 +1053,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1036,7 +1063,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific Gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1062,10 +1090,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1079,10 +1105,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1095,7 +1122,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}" + } @distributed_trace def list_keys( @@ -1103,7 +1132,8 @@ def list_keys( ) -> _models.GatewayKeysContract: """Retrieves gateway keys. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1126,10 +1156,8 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayKeysContract] + 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( resource_group_name=resource_group_name, @@ -1142,10 +1170,11 @@ def list_keys( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1165,7 +1194,9 @@ def list_keys( return deserialized - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listKeys" + } @overload def regenerate_key( # pylint: disable=inconsistent-return-statements @@ -1180,7 +1211,8 @@ def regenerate_key( # pylint: disable=inconsistent-return-statements ) -> None: """Regenerates specified gateway key invalidating any tokens created with it. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1211,7 +1243,8 @@ def regenerate_key( # pylint: disable=inconsistent-return-statements ) -> None: """Regenerates specified gateway key invalidating any tokens created with it. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1240,14 +1273,16 @@ def regenerate_key( # pylint: disable=inconsistent-return-statements ) -> None: """Regenerates specified gateway key invalidating any tokens created with it. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param parameters: Is either a GatewayKeyRegenerationRequestContract type or a IO 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. @@ -1268,11 +1303,9 @@ def regenerate_key( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1296,10 +1329,11 @@ def regenerate_key( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1312,7 +1346,9 @@ def regenerate_key( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - regenerate_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/regenerateKey"} # type: ignore + regenerate_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/regenerateKey" + } @overload def generate_token( @@ -1327,7 +1363,8 @@ def generate_token( ) -> _models.GatewayTokenContract: """Gets the Shared Access Authorization Token for the gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1358,7 +1395,8 @@ def generate_token( ) -> _models.GatewayTokenContract: """Gets the Shared Access Authorization Token for the gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1387,14 +1425,15 @@ def generate_token( ) -> _models.GatewayTokenContract: """Gets the Shared Access Authorization Token for the gateway. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :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. @@ -1415,11 +1454,9 @@ def generate_token( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GatewayTokenContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayTokenContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1443,10 +1480,11 @@ def generate_token( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1463,4 +1501,6 @@ def generate_token( return deserialized - generate_token.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/generateToken"} # type: ignore + generate_token.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/generateToken" + } 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 6236fd367147..5a31953f2f33 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +51,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +60,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -74,10 +71,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -100,7 +97,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +106,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -119,10 +118,10 @@ def build_get_entity_tag_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "schemaId": _SERIALIZER.url("schema_id", schema_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,7 +138,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,7 +147,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -158,10 +159,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "schemaId": _SERIALIZER.url("schema_id", schema_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,8 +185,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +195,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -204,10 +207,10 @@ def build_create_or_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "schemaId": _SERIALIZER.url("schema_id", schema_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -228,7 +231,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -237,7 +240,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -247,10 +252,10 @@ def build_delete_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "schemaId": _SERIALIZER.url("schema_id", schema_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -293,7 +298,8 @@ def list_by_service( ) -> Iterable["_models.GlobalSchemaContract"]: """Lists a collection of schemas registered with service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -315,10 +321,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GlobalSchemaCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GlobalSchemaCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -344,7 +348,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -360,7 +364,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -368,14 +372,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("GlobalSchemaCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -388,13 +393,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -417,10 +425,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, schema_id: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -433,10 +439,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, schema_id: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -453,7 +460,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, schema_id: return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" + } @distributed_trace def get( @@ -461,7 +470,8 @@ def get( ) -> _models.GlobalSchemaContract: """Gets the details of the Schema specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -484,10 +494,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GlobalSchemaContract] + 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( resource_group_name=resource_group_name, @@ -500,10 +508,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -523,7 +532,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" + } def _create_or_update_initial( self, @@ -545,11 +556,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.GlobalSchemaContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.GlobalSchemaContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -574,10 +583,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -604,7 +614,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" + } @overload def begin_create_or_update( @@ -620,7 +632,8 @@ def begin_create_or_update( ) -> LROPoller[_models.GlobalSchemaContract]: """Creates new or updates existing specified Schema of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -663,7 +676,8 @@ def begin_create_or_update( ) -> LROPoller[_models.GlobalSchemaContract]: """Creates new or updates existing specified Schema of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -704,14 +718,16 @@ def begin_create_or_update( ) -> LROPoller[_models.GlobalSchemaContract]: """Creates new or updates existing specified Schema of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -735,16 +751,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GlobalSchemaContract] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GlobalSchemaContract] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, schema_id=schema_id, @@ -770,9 +784,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -784,9 +798,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -794,7 +810,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific Schema. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -820,10 +837,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -837,10 +852,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -853,4 +869,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}" + } 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 new file mode 100644 index 000000000000..7985f4ebacc9 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_operations.py @@ -0,0 +1,1067 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_api_request( + resource_group_name: str, + service_name: str, + api_id: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1) + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_entity_tag_request( + resource_group_name: str, service_name: str, api_id: str, resolver_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), + "resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, service_name: str, api_id: str, resolver_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), + "resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), + "resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), + "resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), + "resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class GraphQLApiResolverOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s + :attr:`graph_ql_api_resolver` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_api( + self, + resource_group_name: str, + service_name: str, + api_id: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ResolverContract"]: + """Lists a collection of the resolvers for the specified GraphQL API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :param filter: | Field | Usage | Supported operators | Supported + functions |
|-------------|-------------|-------------|-------------|
| name | + filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
| + displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith + |
| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, + endswith |
| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, + endswith |
. Default value is None. + :type filter: str + :param top: Number of records to return. Default value is None. + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResolverCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ResolverCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_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 + ) -> bool: + """Gets the entity state (Etag) version of the GraphQL API resolver specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if cls: + return cls(pipeline_response, None, response_headers) + 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 + ) -> _models.ResolverContract: + """Gets the details of the GraphQL API Resolver specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResolverContract] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ResolverContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + parameters: _models.ResolverContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResolverContract: + """Creates a new resolver in the GraphQL API or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ResolverContract + :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 JSON body. + Default 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: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResolverContract: + """Creates a new resolver in the GraphQL API or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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. Required. + :type parameters: IO + :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: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + parameters: Union[_models.ResolverContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> _models.ResolverContract: + """Creates a new resolver in the GraphQL API or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResolverContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResolverContract", is_xml=True) + + request = build_create_or_update_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, + if_match=if_match, + api_version=api_version, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ResolverContract", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ResolverContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + 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, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + if_match: str, + parameters: _models.ResolverUpdateContract, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResolverContract: + """Updates the details of the resolver in the GraphQL API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 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: GraphQL API Resolver Update parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.ResolverUpdateContract + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default 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: + """ + + @overload + def update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + if_match: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResolverContract: + """Updates the details of the resolver in the GraphQL API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 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: GraphQL API Resolver Update parameters. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResolverContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.ResolverContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + if_match: str, + parameters: Union[_models.ResolverUpdateContract, IO], + **kwargs: Any + ) -> _models.ResolverContract: + """Updates the details of the resolver in the GraphQL API specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 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: 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 + :return: ResolverContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.ResolverContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResolverContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResolverUpdateContract") + + request = build_update_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, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ResolverContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, api_id: str, resolver_id: str, if_match: str, **kwargs: Any + ) -> None: + """Deletes the specified resolver in the GraphQL API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + resolver_id=resolver_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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" + } 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 new file mode 100644 index 000000000000..c305803667e5 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_policy_operations.py @@ -0,0 +1,865 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_resolver_request( + resource_group_name: str, service_name: str, api_id: str, resolver_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), + "resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_entity_tag_request( + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + policy_id: Union[str, _models.PolicyIdName], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), + "resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1), + "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + policy_id: Union[str, _models.PolicyIdName], + subscription_id: str, + *, + format: Union[str, _models.PolicyExportFormat] = "xml", + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), + "resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1), + "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + policy_id: Union[str, _models.PolicyIdName], + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), + "resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1), + "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + policy_id: Union[str, _models.PolicyIdName], + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), + "resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1), + "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class GraphQLApiResolverPolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s + :attr:`graph_ql_api_resolver_policy` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resolver( + self, resource_group_name: str, service_name: str, api_id: str, resolver_id: str, **kwargs: Any + ) -> Iterable["_models.PolicyContract"]: + """Get the list of policy configuration at the GraphQL API Resolver level. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PolicyCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resolver.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies" + } + + @distributed_trace + def get_entity_tag( + self, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + policy_id: Union[str, _models.PolicyIdName], + **kwargs: Any + ) -> bool: + """Gets the entity state (Etag) version of the GraphQL API resolver policy specified by its + identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + resolver_id=resolver_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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if cls: + return cls(pipeline_response, None, response_headers) + 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, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + policy_id: Union[str, _models.PolicyIdName], + format: Union[str, _models.PolicyExportFormat] = "xml", + **kwargs: Any + ) -> _models.PolicyContract: + """Get the policy configuration at the GraphQL API Resolver level. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 policy_id: The identifier of the Policy. "policy" Required. + :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + resolver_id=resolver_id, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("PolicyContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + policy_id: Union[str, _models.PolicyIdName], + parameters: _models.PolicyContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PolicyContract: + """Creates or updates policy configuration for the GraphQL API Resolver level. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 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: ~azure.mgmt.apimanagement.models.PolicyContract + :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 JSON body. + Default 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: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + policy_id: Union[str, _models.PolicyIdName], + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PolicyContract: + """Creates or updates policy configuration for the GraphQL API Resolver level. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 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 + :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: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + policy_id: Union[str, _models.PolicyIdName], + parameters: Union[_models.PolicyContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> _models.PolicyContract: + """Creates or updates policy configuration for the GraphQL API Resolver level. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 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 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PolicyContract", is_xml=True) + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + resolver_id=resolver_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("PolicyContract", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("PolicyContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + 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, + resource_group_name: str, + service_name: str, + api_id: str, + resolver_id: str, + policy_id: Union[str, _models.PolicyIdName], + if_match: str, + **kwargs: Any + ) -> None: + """Deletes the policy configuration at the GraphQL Api Resolver. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: 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 + :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 policy_id: The identifier of the Policy. "policy" Required. + :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + resolver_id=resolver_id, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}" + } 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 b51f280020d7..ac6e31de1d32 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +49,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +58,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -72,10 +69,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -98,7 +95,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +104,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -117,10 +116,10 @@ def build_get_entity_tag_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -137,7 +136,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +145,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -156,10 +157,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -182,8 +183,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +193,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -202,10 +205,10 @@ def build_create_or_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -226,8 +229,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -236,7 +239,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -246,10 +251,10 @@ def build_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -269,7 +274,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -278,7 +283,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -288,10 +295,10 @@ def build_delete_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -334,7 +341,11 @@ def list_by_service( ) -> Iterable["_models.GroupContract"]: """Lists a collection of groups defined within a service instance. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-create-groups + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -357,10 +368,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GroupCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -386,7 +395,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -402,7 +411,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -410,14 +419,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("GroupCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -430,13 +440,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -459,10 +472,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, group_id: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -475,10 +486,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, group_id: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -495,13 +507,16 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, group_id: return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -524,10 +539,8 @@ def get(self, resource_group_name: str, service_name: str, group_id: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupContract] + 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( resource_group_name=resource_group_name, @@ -540,10 +553,11 @@ def get(self, resource_group_name: str, service_name: str, group_id: str, **kwar params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -563,7 +577,9 @@ def get(self, resource_group_name: str, service_name: str, group_id: str, **kwar return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" + } @overload def create_or_update( @@ -579,7 +595,8 @@ def create_or_update( ) -> _models.GroupContract: """Creates or Updates a group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -614,7 +631,8 @@ def create_or_update( ) -> _models.GroupContract: """Creates or Updates a group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -647,14 +665,16 @@ def create_or_update( ) -> _models.GroupContract: """Creates or Updates a group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a GroupCreateParameters type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.GroupCreateParameters or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -678,11 +698,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GroupContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -707,10 +725,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -732,11 +751,13 @@ def create_or_update( deserialized = self._deserialize("GroupContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" + } @overload def update( @@ -752,7 +773,8 @@ def update( ) -> _models.GroupContract: """Updates the details of the group specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -787,7 +809,8 @@ def update( ) -> _models.GroupContract: """Updates the details of the group specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -820,7 +843,8 @@ def update( ) -> _models.GroupContract: """Updates the details of the group specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -830,7 +854,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -851,11 +876,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GroupContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -880,10 +903,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -903,7 +927,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -911,7 +937,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific group of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -937,10 +964,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -954,10 +979,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -970,4 +996,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}" + } 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 7ee6db225510..b8f81ab60158 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,9 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -74,10 +71,10 @@ def build_list_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -100,7 +97,7 @@ def build_check_entity_exists_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +106,9 @@ def build_check_entity_exists_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -120,10 +119,10 @@ def build_check_entity_exists_request( ), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1), "userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,7 +139,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +148,9 @@ def build_create_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -160,10 +161,10 @@ def build_create_request( ), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1), "userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -180,7 +181,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +190,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -200,10 +203,10 @@ def build_delete_request( ), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1), "userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -246,7 +249,8 @@ def list( ) -> Iterable["_models.UserContract"]: """Lists a collection of user entities associated with the group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -274,10 +278,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UserCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -304,7 +306,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -320,7 +322,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -328,14 +330,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("UserCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -348,7 +351,9 @@ 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"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users" + } @distributed_trace def check_entity_exists( @@ -356,7 +361,8 @@ def check_entity_exists( ) -> bool: """Checks that user entity specified by identifier is associated with the group entity. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -382,10 +388,8 @@ def check_entity_exists( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -399,10 +403,11 @@ def check_entity_exists( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -416,7 +421,9 @@ def check_entity_exists( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - check_entity_exists.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}"} # type: ignore + check_entity_exists.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}" + } @distributed_trace def create( @@ -424,7 +431,8 @@ def create( ) -> _models.UserContract: """Add existing user to existing group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -450,10 +458,8 @@ def create( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserContract] + 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( resource_group_name=resource_group_name, @@ -467,10 +473,11 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -487,11 +494,13 @@ def create( deserialized = self._deserialize("UserContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}"} # 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 @@ -499,7 +508,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Remove existing user from existing group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -525,10 +535,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -542,10 +550,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -558,4 +567,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}" + } 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 6f686de08295..fc5952d5a389 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +51,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -65,10 +62,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,7 +86,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +95,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -108,10 +107,10 @@ def build_get_entity_tag_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "identityProviderName": _SERIALIZER.url("identity_provider_name", identity_provider_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -132,7 +131,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -141,7 +140,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -151,10 +152,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "identityProviderName": _SERIALIZER.url("identity_provider_name", identity_provider_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -177,8 +178,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -187,7 +188,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -197,10 +200,10 @@ def build_create_or_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "identityProviderName": _SERIALIZER.url("identity_provider_name", identity_provider_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -227,8 +230,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -237,7 +240,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -247,10 +252,10 @@ def build_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "identityProviderName": _SERIALIZER.url("identity_provider_name", identity_provider_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -276,7 +281,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -285,7 +290,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -295,10 +302,10 @@ def build_delete_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "identityProviderName": _SERIALIZER.url("identity_provider_name", identity_provider_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -320,7 +327,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -329,7 +336,9 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -339,10 +348,10 @@ def build_list_secrets_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "identityProviderName": _SERIALIZER.url("identity_provider_name", identity_provider_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -378,7 +387,12 @@ def list_by_service( ) -> Iterable["_models.IdentityProviderContract"]: """Lists a collection of Identity Provider configured in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-aad#how-to-authorize-developer-accounts-using-azure-active-directory + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -391,10 +405,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IdentityProviderList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IdentityProviderList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -417,7 +429,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -433,7 +445,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -441,14 +453,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IdentityProviderList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -461,7 +474,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders" + } @distributed_trace def get_entity_tag( @@ -473,7 +488,8 @@ def get_entity_tag( ) -> bool: """Gets the entity state (Etag) version of the identityProvider specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -496,10 +512,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -512,10 +526,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -532,7 +547,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" + } @distributed_trace def get( @@ -545,7 +562,8 @@ def get( """Gets the configuration details of the identity Provider configured in specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -568,10 +586,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IdentityProviderContract] + 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( resource_group_name=resource_group_name, @@ -584,10 +600,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -607,7 +624,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" + } @overload def create_or_update( @@ -623,7 +642,8 @@ def create_or_update( ) -> _models.IdentityProviderContract: """Creates or Updates the IdentityProvider configuration. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -658,7 +678,8 @@ def create_or_update( ) -> _models.IdentityProviderContract: """Creates or Updates the IdentityProvider configuration. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -691,14 +712,16 @@ def create_or_update( ) -> _models.IdentityProviderContract: """Creates or Updates the IdentityProvider configuration. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a IdentityProviderCreateContract type or a IO + type. Required. :type parameters: ~azure.mgmt.apimanagement.models.IdentityProviderCreateContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -722,11 +745,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IdentityProviderContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IdentityProviderContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -751,10 +772,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -776,11 +798,13 @@ def create_or_update( deserialized = self._deserialize("IdentityProviderContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" + } @overload def update( @@ -796,7 +820,8 @@ def update( ) -> _models.IdentityProviderContract: """Updates an existing IdentityProvider configuration. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -831,7 +856,8 @@ def update( ) -> _models.IdentityProviderContract: """Updates an existing IdentityProvider configuration. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -864,7 +890,8 @@ def update( ) -> _models.IdentityProviderContract: """Updates an existing IdentityProvider configuration. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -874,7 +901,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -895,11 +923,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IdentityProviderContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IdentityProviderContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -924,10 +950,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -947,7 +974,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -960,7 +989,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified identity provider configuration. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -986,10 +1016,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1003,10 +1031,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1019,7 +1048,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}" + } @distributed_trace def list_secrets( @@ -1031,7 +1062,8 @@ def list_secrets( ) -> _models.ClientSecretContract: """Gets the client secret details of the Identity Provider. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1054,10 +1086,8 @@ def list_secrets( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClientSecretContract] + 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( resource_group_name=resource_group_name, @@ -1070,10 +1100,11 @@ def list_secrets( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1093,4 +1124,6 @@ def list_secrets( return deserialized - list_secrets.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}/listSecrets"} # type: ignore + list_secrets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}/listSecrets" + } 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 dce45f1284cf..3505c0ddfa84 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +49,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +58,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -72,10 +69,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -98,7 +95,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +104,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues/{issueId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -119,10 +118,10 @@ def build_get_request( "issueId": _SERIALIZER.url( "issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,7 +163,8 @@ def list_by_service( ) -> Iterable["_models.IssueContract"]: """Lists a collection of issues in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -189,10 +189,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IssueCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -218,7 +216,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -234,7 +232,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -242,14 +240,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IssueCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -262,13 +261,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -291,10 +293,8 @@ def get(self, resource_group_name: str, service_name: str, issue_id: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IssueContract] + 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( resource_group_name=resource_group_name, @@ -307,10 +307,11 @@ def get(self, resource_group_name: str, service_name: str, issue_id: str, **kwar params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -330,4 +331,6 @@ def get(self, resource_group_name: str, service_name: str, issue_id: str, **kwar return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues/{issueId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues/{issueId}" + } 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 99573624b469..0e9ceae5142e 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +49,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +58,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -72,10 +69,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -98,7 +95,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +104,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -117,10 +116,10 @@ def build_get_entity_tag_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -137,7 +136,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +145,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -156,10 +157,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -182,8 +183,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +193,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -202,10 +205,10 @@ def build_create_or_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -226,8 +229,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -236,7 +239,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -246,10 +251,10 @@ def build_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -269,7 +274,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -278,7 +283,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -288,10 +295,10 @@ def build_delete_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -334,7 +341,11 @@ def list_by_service( ) -> Iterable["_models.LoggerContract"]: """Lists a collection of loggers in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-log-event-hubs + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -357,10 +368,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LoggerCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LoggerCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -386,7 +395,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -402,7 +411,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -410,14 +419,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("LoggerCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -430,13 +440,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -459,10 +472,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, logger_id: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -475,10 +486,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, logger_id: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -495,13 +507,16 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, logger_id: return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -524,10 +539,8 @@ def get(self, resource_group_name: str, service_name: str, logger_id: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LoggerContract] + 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( resource_group_name=resource_group_name, @@ -540,10 +553,11 @@ def get(self, resource_group_name: str, service_name: str, logger_id: str, **kwa params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -563,7 +577,9 @@ def get(self, resource_group_name: str, service_name: str, logger_id: str, **kwa return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" + } @overload def create_or_update( @@ -579,7 +595,8 @@ def create_or_update( ) -> _models.LoggerContract: """Creates or Updates a logger. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -614,7 +631,8 @@ def create_or_update( ) -> _models.LoggerContract: """Creates or Updates a logger. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -647,14 +665,15 @@ def create_or_update( ) -> _models.LoggerContract: """Creates or Updates a logger. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a LoggerContract type or a IO type. Required. :type parameters: ~azure.mgmt.apimanagement.models.LoggerContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -678,11 +697,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LoggerContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LoggerContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -707,10 +724,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -732,11 +750,13 @@ def create_or_update( deserialized = self._deserialize("LoggerContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" + } @overload def update( @@ -752,7 +772,8 @@ def update( ) -> _models.LoggerContract: """Updates an existing logger. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -787,7 +808,8 @@ def update( ) -> _models.LoggerContract: """Updates an existing logger. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -820,7 +842,8 @@ def update( ) -> _models.LoggerContract: """Updates an existing logger. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -830,7 +853,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -851,11 +875,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LoggerContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LoggerContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -880,10 +902,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -903,7 +926,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -911,7 +936,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified logger. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -937,10 +963,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -954,10 +978,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -970,4 +995,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}" + } 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 3d98adafae4a..8fce3091fa76 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +52,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +61,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -75,10 +72,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -105,7 +102,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +111,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -126,10 +125,10 @@ def build_get_entity_tag_request( "namedValueId": _SERIALIZER.url( "named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,7 +145,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -155,7 +154,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -167,10 +168,10 @@ def build_get_request( "namedValueId": _SERIALIZER.url( "named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -193,8 +194,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -203,7 +204,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -215,10 +218,10 @@ def build_create_or_update_request( "namedValueId": _SERIALIZER.url( "named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -245,8 +248,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -255,7 +258,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -267,10 +272,10 @@ def build_update_request( "namedValueId": _SERIALIZER.url( "named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -296,7 +301,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -305,7 +310,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -317,10 +324,10 @@ def build_delete_request( "namedValueId": _SERIALIZER.url( "named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -338,7 +345,7 @@ def build_list_value_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -347,7 +354,9 @@ def build_list_value_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/listValue", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -359,10 +368,10 @@ def build_list_value_request( "namedValueId": _SERIALIZER.url( "named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -379,7 +388,7 @@ def build_refresh_secret_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -388,7 +397,9 @@ def build_refresh_secret_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/refreshSecret", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -400,10 +411,10 @@ def build_refresh_secret_request( "namedValueId": _SERIALIZER.url( "named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -446,7 +457,11 @@ def list_by_service( ) -> Iterable["_models.NamedValueContract"]: """Lists a collection of named values defined within a service instance. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-properties + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -471,10 +486,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NamedValueCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NamedValueCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -501,7 +514,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -517,7 +530,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -525,14 +538,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("NamedValueCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -545,13 +559,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -573,10 +590,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, named_valu _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -589,10 +604,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, named_valu params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -609,7 +625,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, named_valu return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" + } @distributed_trace def get( @@ -617,7 +635,8 @@ def get( ) -> _models.NamedValueContract: """Gets the details of the named value specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -639,10 +658,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NamedValueContract] + 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( resource_group_name=resource_group_name, @@ -655,10 +672,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -678,7 +696,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" + } def _create_or_update_initial( self, @@ -700,11 +720,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.NamedValueContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.NamedValueContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -729,10 +747,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -759,7 +778,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" + } @overload def begin_create_or_update( @@ -775,7 +796,8 @@ def begin_create_or_update( ) -> LROPoller[_models.NamedValueContract]: """Creates or updates named value. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -817,7 +839,8 @@ def begin_create_or_update( ) -> LROPoller[_models.NamedValueContract]: """Creates or updates named value. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -857,13 +880,15 @@ def begin_create_or_update( ) -> LROPoller[_models.NamedValueContract]: """Creates or updates named value. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a NamedValueCreateContract type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.NamedValueCreateContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -887,16 +912,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NamedValueContract] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NamedValueContract] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, @@ -922,9 +945,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -936,9 +959,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" + } def _update_initial( self, @@ -960,11 +985,9 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.NamedValueContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.NamedValueContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -989,10 +1012,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1014,7 +1038,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" + } @overload def begin_update( @@ -1030,7 +1056,8 @@ def begin_update( ) -> LROPoller[_models.NamedValueContract]: """Updates the specific named value. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1072,7 +1099,8 @@ def begin_update( ) -> LROPoller[_models.NamedValueContract]: """Updates the specific named value. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1112,7 +1140,8 @@ def begin_update( ) -> LROPoller[_models.NamedValueContract]: """Updates the specific named value. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1121,7 +1150,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -1142,16 +1172,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NamedValueContract] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NamedValueContract] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, @@ -1177,9 +1205,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1191,9 +1219,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1201,7 +1231,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific named value from the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1226,10 +1257,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1243,10 +1272,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1259,7 +1289,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}" + } @distributed_trace def list_value( @@ -1267,7 +1299,8 @@ def list_value( ) -> _models.NamedValueSecretContract: """Gets the secret of the named value specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1289,10 +1322,8 @@ def list_value( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NamedValueSecretContract] + 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( resource_group_name=resource_group_name, @@ -1305,10 +1336,11 @@ def list_value( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1328,7 +1360,9 @@ def list_value( return deserialized - list_value.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/listValue"} # type: ignore + list_value.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/listValue" + } def _refresh_secret_initial( self, resource_group_name: str, service_name: str, named_value_id: str, **kwargs: Any @@ -1344,10 +1378,8 @@ def _refresh_secret_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.NamedValueContract]] + 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( resource_group_name=resource_group_name, @@ -1360,10 +1392,11 @@ def _refresh_secret_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1385,7 +1418,9 @@ def _refresh_secret_initial( return deserialized - _refresh_secret_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/refreshSecret"} # type: ignore + _refresh_secret_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/refreshSecret" + } @distributed_trace def begin_refresh_secret( @@ -1393,7 +1428,8 @@ def begin_refresh_secret( ) -> LROPoller[_models.NamedValueContract]: """Refresh the secret of the named value specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1415,15 +1451,13 @@ def begin_refresh_secret( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NamedValueContract] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NamedValueContract] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._refresh_secret_initial( # type: ignore + raw_result = self._refresh_secret_initial( resource_group_name=resource_group_name, service_name=service_name, named_value_id=named_value_id, @@ -1446,9 +1480,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1460,6 +1494,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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"} # type: ignore + begin_refresh_secret.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/refreshSecret" + } 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 d8d3042f9c44..49f12ec5ad0e 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, List, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,8 +49,10 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/networkstatus", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -66,7 +63,7 @@ def build_list_by_service_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +80,7 @@ def build_list_by_location_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,8 +89,10 @@ def build_list_by_location_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/locations/{locationName}/networkstatus", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -105,7 +104,7 @@ def build_list_by_location_request( "locationName": _SERIALIZER.url("location_name", location_name, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -143,7 +142,8 @@ def list_by_service( depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -163,10 +163,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.NetworkStatusContractByLocation]] + 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( resource_group_name=resource_group_name, @@ -178,10 +176,11 @@ def list_by_service( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -198,7 +197,9 @@ def list_by_service( return deserialized - list_by_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/networkstatus"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/networkstatus" + } @distributed_trace def list_by_location( @@ -208,7 +209,8 @@ def list_by_location( depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -231,10 +233,8 @@ def list_by_location( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NetworkStatusContract] + 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( resource_group_name=resource_group_name, @@ -247,10 +247,11 @@ def list_by_location( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -267,4 +268,6 @@ def list_by_location( return deserialized - list_by_location.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/locations/{locationName}/networkstatus"} # type: ignore + list_by_location.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/locations/{locationName}/networkstatus" + } 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 495f78da58f1..698cfa3232eb 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +48,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +57,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -71,10 +68,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if top is not None: @@ -99,7 +96,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +105,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -118,10 +117,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "notificationName": _SERIALIZER.url("notification_name", notification_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -144,7 +143,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +152,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -163,10 +164,10 @@ def build_create_or_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "notificationName": _SERIALIZER.url("notification_name", notification_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,7 +210,8 @@ def list_by_service( ) -> Iterable["_models.NotificationContract"]: """Lists a collection of properties defined within a service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -226,10 +228,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotificationCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NotificationCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -254,7 +254,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -270,7 +270,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -278,14 +278,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("NotificationCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -298,7 +299,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications" + } @distributed_trace def get( @@ -310,7 +313,8 @@ def get( ) -> _models.NotificationContract: """Gets the details of the Notification specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -335,10 +339,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotificationContract] + 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( resource_group_name=resource_group_name, @@ -351,10 +353,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -371,7 +374,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}" + } @distributed_trace def create_or_update( @@ -384,7 +389,8 @@ def create_or_update( ) -> _models.NotificationContract: """Create or Update API Management publisher notification. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -412,10 +418,8 @@ def create_or_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotificationContract] + 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( resource_group_name=resource_group_name, @@ -429,10 +433,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -449,4 +454,6 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}" + } 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 ed35c8d3dde3..48fc7a45d9e2 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +44,7 @@ def build_list_by_notification_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +53,9 @@ def build_list_by_notification_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -68,10 +65,10 @@ def build_list_by_notification_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "notificationName": _SERIALIZER.url("notification_name", notification_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -93,7 +90,7 @@ def build_check_entity_exists_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +99,9 @@ def build_check_entity_exists_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -113,10 +112,10 @@ def build_check_entity_exists_request( ), "notificationName": _SERIALIZER.url("notification_name", notification_name, "str"), "email": _SERIALIZER.url("email", email, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -138,7 +137,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -147,7 +146,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -158,10 +159,10 @@ def build_create_or_update_request( ), "notificationName": _SERIALIZER.url("notification_name", notification_name, "str"), "email": _SERIALIZER.url("email", email, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -183,7 +184,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +193,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -203,10 +206,10 @@ def build_delete_request( ), "notificationName": _SERIALIZER.url("notification_name", notification_name, "str"), "email": _SERIALIZER.url("email", email, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -246,7 +249,8 @@ def list_by_notification( ) -> _models.RecipientEmailCollection: """Gets the list of the Notification Recipient Emails subscribed to a notification. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -271,10 +275,8 @@ def list_by_notification( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RecipientEmailCollection] + 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( resource_group_name=resource_group_name, @@ -287,10 +289,11 @@ def list_by_notification( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -307,7 +310,9 @@ def list_by_notification( return deserialized - list_by_notification.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails"} # type: ignore + list_by_notification.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails" + } @distributed_trace def check_entity_exists( @@ -320,7 +325,8 @@ def check_entity_exists( ) -> bool: """Determine if Notification Recipient Email subscribed to the notification. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -347,10 +353,8 @@ def check_entity_exists( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -364,10 +368,11 @@ def check_entity_exists( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -381,7 +386,9 @@ def check_entity_exists( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - check_entity_exists.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}"} # type: ignore + check_entity_exists.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}" + } @distributed_trace def create_or_update( @@ -394,7 +401,8 @@ def create_or_update( ) -> _models.RecipientEmailContract: """Adds the Email address to the list of Recipients for the Notification. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -421,10 +429,8 @@ def create_or_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RecipientEmailContract] + 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( resource_group_name=resource_group_name, @@ -438,10 +444,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -458,11 +465,13 @@ def create_or_update( deserialized = self._deserialize("RecipientEmailContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}"} # 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 @@ -475,7 +484,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Removes the email from the list of Notification. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -502,10 +512,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -519,10 +527,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -535,4 +544,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}" + } 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 fa948d5b7758..dae6cdae34e9 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +44,7 @@ def build_list_by_notification_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +53,9 @@ def build_list_by_notification_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -68,10 +65,10 @@ def build_list_by_notification_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "notificationName": _SERIALIZER.url("notification_name", notification_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -93,7 +90,7 @@ def build_check_entity_exists_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +99,9 @@ def build_check_entity_exists_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -113,10 +112,10 @@ def build_check_entity_exists_request( ), "notificationName": _SERIALIZER.url("notification_name", notification_name, "str"), "userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -138,7 +137,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -147,7 +146,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -158,10 +159,10 @@ def build_create_or_update_request( ), "notificationName": _SERIALIZER.url("notification_name", notification_name, "str"), "userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -183,7 +184,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +193,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -203,10 +206,10 @@ def build_delete_request( ), "notificationName": _SERIALIZER.url("notification_name", notification_name, "str"), "userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -246,7 +249,8 @@ def list_by_notification( ) -> _models.RecipientUserCollection: """Gets the list of the Notification Recipient User subscribed to the notification. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -271,10 +275,8 @@ def list_by_notification( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RecipientUserCollection] + 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( resource_group_name=resource_group_name, @@ -287,10 +289,11 @@ def list_by_notification( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -307,7 +310,9 @@ def list_by_notification( return deserialized - list_by_notification.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers"} # type: ignore + list_by_notification.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers" + } @distributed_trace def check_entity_exists( @@ -320,7 +325,8 @@ def check_entity_exists( ) -> bool: """Determine if the Notification Recipient User is subscribed to the notification. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -348,10 +354,8 @@ def check_entity_exists( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -365,10 +369,11 @@ def check_entity_exists( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -382,7 +387,9 @@ def check_entity_exists( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - check_entity_exists.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}"} # type: ignore + check_entity_exists.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}" + } @distributed_trace def create_or_update( @@ -395,7 +402,8 @@ def create_or_update( ) -> _models.RecipientUserContract: """Adds the API Management User to the list of Recipients for the Notification. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -423,10 +431,8 @@ def create_or_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RecipientUserContract] + 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( resource_group_name=resource_group_name, @@ -440,10 +446,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -460,11 +467,13 @@ def create_or_update( deserialized = self._deserialize("RecipientUserContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}"} # 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 @@ -477,7 +486,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Removes the API Management user from the list of Notification. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -505,10 +515,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -522,10 +530,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -538,4 +547,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}" + } 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 f7a46b328f8e..e6940813a8cf 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +49,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +58,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -72,10 +69,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -98,7 +95,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +104,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -117,10 +116,10 @@ def build_get_entity_tag_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "opid": _SERIALIZER.url("opid", opid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -137,7 +136,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +145,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -156,10 +157,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "opid": _SERIALIZER.url("opid", opid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -182,8 +183,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +193,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -202,10 +205,10 @@ def build_create_or_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "opid": _SERIALIZER.url("opid", opid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -226,8 +229,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -236,7 +239,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -246,10 +251,10 @@ def build_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "opid": _SERIALIZER.url("opid", opid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -269,7 +274,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -278,7 +283,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -288,10 +295,10 @@ def build_delete_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "opid": _SERIALIZER.url("opid", opid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -309,7 +316,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -318,7 +325,9 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -328,10 +337,10 @@ def build_list_secrets_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "opid": _SERIALIZER.url("opid", opid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -373,7 +382,8 @@ def list_by_service( ) -> Iterable["_models.OpenidConnectProviderContract"]: """Lists of all the OpenId Connect Providers. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -397,10 +407,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenIdConnectProviderCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OpenIdConnectProviderCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -426,7 +434,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -442,7 +450,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -450,14 +458,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OpenIdConnectProviderCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -470,13 +479,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -498,10 +510,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, opid: str, _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -514,10 +524,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, opid: str, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -534,7 +545,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, opid: str, return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" + } @distributed_trace def get( @@ -542,7 +555,8 @@ def get( ) -> _models.OpenidConnectProviderContract: """Gets specific OpenID Connect Provider without secrets. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -564,10 +578,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenidConnectProviderContract] + 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( resource_group_name=resource_group_name, @@ -580,10 +592,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -603,7 +616,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" + } @overload def create_or_update( @@ -619,7 +634,8 @@ def create_or_update( ) -> _models.OpenidConnectProviderContract: """Creates or updates the OpenID Connect Provider. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -653,7 +669,8 @@ def create_or_update( ) -> _models.OpenidConnectProviderContract: """Creates or updates the OpenID Connect Provider. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -685,13 +702,15 @@ def create_or_update( ) -> _models.OpenidConnectProviderContract: """Creates or updates the OpenID Connect Provider. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :param opid: Identifier of the OpenID Connect Provider. Required. :type opid: str - :param parameters: Create parameters. Is either a model type or a IO type. Required. + :param parameters: Create parameters. Is either a OpenidConnectProviderContract type or a IO + type. Required. :type parameters: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -715,11 +734,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenidConnectProviderContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OpenidConnectProviderContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -744,10 +761,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -769,11 +787,13 @@ def create_or_update( deserialized = self._deserialize("OpenidConnectProviderContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" + } @overload def update( @@ -789,7 +809,8 @@ def update( ) -> _models.OpenidConnectProviderContract: """Updates the specific OpenID Connect Provider. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -823,7 +844,8 @@ def update( ) -> _models.OpenidConnectProviderContract: """Updates the specific OpenID Connect Provider. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -855,7 +877,8 @@ def update( ) -> _models.OpenidConnectProviderContract: """Updates the specific OpenID Connect Provider. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -864,7 +887,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -885,11 +909,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenidConnectProviderContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OpenidConnectProviderContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -914,10 +936,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -937,7 +960,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -945,7 +970,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific OpenID Connect Provider of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -970,10 +996,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -987,10 +1011,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1003,7 +1028,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}" + } @distributed_trace def list_secrets( @@ -1011,7 +1038,8 @@ def list_secrets( ) -> _models.ClientSecretContract: """Gets the client secret details of the OpenID Connect Provider. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1033,10 +1061,8 @@ def list_secrets( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClientSecretContract] + 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( resource_group_name=resource_group_name, @@ -1049,10 +1075,11 @@ def list_secrets( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1072,4 +1099,6 @@ def list_secrets( return deserialized - list_secrets.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}/listSecrets"} # type: ignore + list_secrets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}/listSecrets" + } 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 6e548450588a..a9971cd614a1 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +51,7 @@ def build_list_by_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +60,9 @@ def build_list_by_tags_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operationsByTags", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -75,10 +72,10 @@ def build_list_by_tags_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -132,7 +129,8 @@ def list_by_tags( ) -> Iterable["_models.TagResourceContract"]: """Lists a collection of operations associated with tags. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -163,10 +161,8 @@ def list_by_tags( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagResourceCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TagResourceCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -194,7 +190,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -210,7 +206,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -218,14 +214,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TagResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -238,4 +235,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operationsByTags"} # type: ignore + 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 ca2cb4800b92..a315dc37d53d 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,8 +49,10 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/outboundNetworkDependenciesEndpoints", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -66,7 +63,7 @@ def build_list_by_service_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -102,7 +99,8 @@ def list_by_service( ) -> _models.OutboundEnvironmentEndpointList: """Gets the network endpoints of all outbound dependencies of a ApiManagement service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -122,10 +120,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointList] + 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( resource_group_name=resource_group_name, @@ -137,10 +133,11 @@ def list_by_service( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -157,4 +154,6 @@ def list_by_service( return deserialized - list_by_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/outboundNetworkDependenciesEndpoints" + } 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 2d4075f077ff..0f0475392d8a 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +45,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +54,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyDescriptions", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -68,10 +65,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if scope is not None: @@ -113,7 +110,8 @@ def list_by_service( ) -> _models.PolicyDescriptionCollection: """Lists all policy descriptions. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -136,10 +134,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyDescriptionCollection] + 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( resource_group_name=resource_group_name, @@ -152,10 +148,11 @@ def list_by_service( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -172,4 +169,6 @@ def list_by_service( return deserialized - list_by_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyDescriptions"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyDescriptions" + } 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 new file mode 100644 index 000000000000..761515899f58 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_fragment_operations.py @@ -0,0 +1,999 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_service_request( + resource_group_name: str, + service_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1) + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_entity_tag_request( + resource_group_name: str, service_name: str, id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + service_name: str, + id: str, + subscription_id: str, + *, + format: Optional[Union[str, _models.PolicyFragmentContentFormat]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + service_name: str, + id: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, id: str, subscription_id: str, *, if_match: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_references_request( + resource_group_name: str, + service_name: str, + id: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}/listReferences", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1) + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class PolicyFragmentOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s + :attr:`policy_fragment` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_service( + self, + resource_group_name: str, + service_name: str, + filter: Optional[str] = None, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> _models.PolicyFragmentCollection: + """Gets all policy fragments. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param filter: | Field | Usage | Supported operators | Supported + functions |
|-------------|-------------|-------------|-------------|
| name | + filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
| + description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith + |
| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith + |
. Default value is None. + :type filter: str + :param orderby: OData order by query option. Default value is None. + :type orderby: str + :param top: Number of records to return. Default value is None. + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PolicyFragmentCollection] = kwargs.pop("cls", None) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + orderby=orderby, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PolicyFragmentCollection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments" + } + + @distributed_trace + def get_entity_tag(self, resource_group_name: str, service_name: str, id: str, **kwargs: Any) -> bool: + """Gets the entity state (Etag) version of a policy fragment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if cls: + return cls(pipeline_response, None, response_headers) + 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, + resource_group_name: str, + service_name: str, + id: str, + format: Optional[Union[str, _models.PolicyFragmentContentFormat]] = None, + **kwargs: Any + ) -> _models.PolicyFragmentContract: + """Gets a policy fragment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param id: A resource identifier. Required. + :type id: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PolicyFragmentContract] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("PolicyFragmentContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + id: str, + parameters: Union[_models.PolicyFragmentContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.PolicyFragmentContract]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.PolicyFragmentContract]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PolicyFragmentContract", is_xml=True) + + request = build_create_or_update_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, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("PolicyFragmentContract", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("PolicyFragmentContract", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + id: str, + parameters: _models.PolicyFragmentContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PolicyFragmentContract]: + """Creates or updates a policy fragment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param id: A resource identifier. Required. + :type id: str + :param parameters: The policy fragment contents to apply. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PolicyFragmentContract + :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 JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PolicyFragmentContract]: + """Creates or updates a policy fragment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param id: A resource identifier. Required. + :type id: str + :param parameters: The policy fragment contents to apply. Required. + :type parameters: IO + :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] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + id: str, + parameters: Union[_models.PolicyFragmentContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.PolicyFragmentContract]: + """Creates or updates a policy fragment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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 + :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] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PolicyFragmentContract] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + id=id, + parameters=parameters, + if_match=if_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("PolicyFragmentContract", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, id: str, if_match: str, **kwargs: Any + ) -> None: + """Deletes a policy fragment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param id: A resource identifier. Required. + :type id: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" + } + + @distributed_trace + def list_references( + self, + resource_group_name: str, + service_name: str, + id: str, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> _models.ResourceCollection: + """Lists policy resources that reference the policy fragment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param id: A resource identifier. Required. + :type id: str + :param top: Number of records to return. Default value is None. + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceCollection] = kwargs.pop("cls", None) + + request = build_list_references_request( + resource_group_name=resource_group_name, + service_name=service_name, + id=id, + subscription_id=self._config.subscription_id, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ResourceCollection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_references.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}/listReferences" + } 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 8dd051cdca15..6a3f7c760432 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +49,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -63,10 +60,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,7 +84,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +93,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -106,10 +105,10 @@ def build_get_entity_tag_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -132,7 +131,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -141,7 +140,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -151,10 +152,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if format is not None: @@ -179,8 +180,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +190,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -199,10 +202,10 @@ def build_create_or_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,7 +232,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -238,7 +241,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -248,10 +253,10 @@ def build_delete_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -286,7 +291,8 @@ def __init__(self, *args, **kwargs): def list_by_service(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.PolicyCollection: """Lists all the Global Policy definitions of the Api Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -306,10 +312,8 @@ def list_by_service(self, resource_group_name: str, service_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyCollection] + 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( resource_group_name=resource_group_name, @@ -321,10 +325,11 @@ def list_by_service(self, resource_group_name: str, service_name: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -341,7 +346,9 @@ def list_by_service(self, resource_group_name: str, service_name: str, **kwargs: return deserialized - list_by_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies" + } @distributed_trace def get_entity_tag( @@ -350,7 +357,8 @@ def get_entity_tag( """Gets the entity state (Etag) version of the Global policy definition in the Api Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -372,10 +380,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -388,10 +394,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -408,7 +415,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}" + } @distributed_trace def get( @@ -421,7 +430,8 @@ def get( ) -> _models.PolicyContract: """Get the Global policy definition of the Api Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -446,10 +456,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyContract] + 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( resource_group_name=resource_group_name, @@ -463,10 +471,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -486,7 +495,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}" + } @overload def create_or_update( @@ -502,7 +513,8 @@ def create_or_update( ) -> _models.PolicyContract: """Creates or updates the global policy configuration of the Api Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -536,7 +548,8 @@ def create_or_update( ) -> _models.PolicyContract: """Creates or updates the global policy configuration of the Api Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -568,13 +581,15 @@ def create_or_update( ) -> _models.PolicyContract: """Creates or updates the global policy configuration of the Api Management service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -598,11 +613,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -627,10 +640,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -652,11 +666,13 @@ def create_or_update( deserialized = self._deserialize("PolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}"} # 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 @@ -669,7 +685,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the global policy configuration of the Api Management Service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -694,10 +711,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -711,10 +726,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -727,4 +743,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}" + } 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 new file mode 100644 index 000000000000..3a84cac39c28 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_config_operations.py @@ -0,0 +1,812 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_service_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_entity_tag_request( + resource_group_name: str, service_name: str, portal_config_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "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 + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, service_name: str, portal_config_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "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 + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, + service_name: str, + portal_config_id: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "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 + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + service_name: str, + portal_config_id: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "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 + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class PortalConfigOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s + :attr:`portal_config` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_service( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> _models.PortalConfigCollection: + """Lists the developer portal configurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PortalConfigCollection] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PortalConfigCollection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs" + } + + @distributed_trace + def get_entity_tag(self, resource_group_name: str, service_name: str, portal_config_id: str, **kwargs: Any) -> bool: + """Gets the entity state (Etag) version of the developer portal configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if cls: + return cls(pipeline_response, None, response_headers) + 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 + ) -> _models.PortalConfigContract: + """Get the developer portal configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PortalConfigContract] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("PortalConfigContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}" + } + + @overload + def update( + self, + resource_group_name: str, + service_name: str, + portal_config_id: str, + if_match: str, + parameters: _models.PortalConfigContract, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PortalConfigContract: + """Update the developer portal configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param portal_config_id: Portal configuration identifier. Required. + :type portal_config_id: str + :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 the developer portal configuration. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalConfigContract + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default 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: + """ + + @overload + def update( + self, + resource_group_name: str, + service_name: str, + portal_config_id: str, + if_match: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PortalConfigContract: + """Update the developer portal configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param portal_config_id: Portal configuration identifier. Required. + :type portal_config_id: str + :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 the developer portal configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PortalConfigContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + service_name: str, + portal_config_id: str, + if_match: str, + parameters: Union[_models.PortalConfigContract, IO], + **kwargs: Any + ) -> _models.PortalConfigContract: + """Update the developer portal configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param portal_config_id: Portal configuration identifier. Required. + :type portal_config_id: str + :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 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 + :return: PortalConfigContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PortalConfigContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PortalConfigContract", is_xml=True) + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + portal_config_id=portal_config_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PortalConfigContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + portal_config_id: str, + if_match: str, + parameters: _models.PortalConfigContract, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PortalConfigContract: + """Create or update the developer portal configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param portal_config_id: Portal configuration identifier. Required. + :type portal_config_id: str + :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 the developer portal configuration. Required. + :type parameters: ~azure.mgmt.apimanagement.models.PortalConfigContract + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default 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: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + portal_config_id: str, + if_match: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PortalConfigContract: + """Create or update the developer portal configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param portal_config_id: Portal configuration identifier. Required. + :type portal_config_id: str + :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 the developer portal configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PortalConfigContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + service_name: str, + portal_config_id: str, + if_match: str, + parameters: Union[_models.PortalConfigContract, IO], + **kwargs: Any + ) -> _models.PortalConfigContract: + """Create or update the developer portal configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param portal_config_id: Portal configuration identifier. Required. + :type portal_config_id: str + :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 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 + :return: PortalConfigContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PortalConfigContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PortalConfigContract", is_xml=True) + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + portal_config_id=portal_config_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PortalConfigContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}" + } 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 6a3bf0c868d3..90c074ee1537 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +51,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +60,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -74,10 +71,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -100,7 +97,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +106,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -121,10 +120,10 @@ def build_get_entity_tag_request( "portalRevisionId": _SERIALIZER.url( "portal_revision_id", portal_revision_id, "str", max_length=256, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -141,7 +140,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +149,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -162,10 +163,10 @@ def build_get_request( "portalRevisionId": _SERIALIZER.url( "portal_revision_id", portal_revision_id, "str", max_length=256, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -182,8 +183,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +193,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -204,10 +207,10 @@ def build_create_or_update_request( "portalRevisionId": _SERIALIZER.url( "portal_revision_id", portal_revision_id, "str", max_length=256, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -232,8 +235,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -242,7 +245,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -254,10 +259,10 @@ def build_update_request( "portalRevisionId": _SERIALIZER.url( "portal_revision_id", portal_revision_id, "str", max_length=256, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -302,7 +307,8 @@ def list_by_service( ) -> Iterable["_models.PortalRevisionContract"]: """Lists developer portal's revisions. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -332,10 +338,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalRevisionCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PortalRevisionCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -361,7 +365,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -377,7 +381,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -385,14 +389,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PortalRevisionCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -405,7 +410,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions" + } @distributed_trace def get_entity_tag( @@ -413,7 +420,8 @@ def get_entity_tag( ) -> bool: """Gets the developer portal revision specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -436,10 +444,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -452,10 +458,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -472,7 +479,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" + } @distributed_trace def get( @@ -480,7 +489,8 @@ def get( ) -> _models.PortalRevisionContract: """Gets the developer portal's revision specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -503,10 +513,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalRevisionContract] + 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( resource_group_name=resource_group_name, @@ -519,10 +527,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -542,7 +551,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" + } def _create_or_update_initial( self, @@ -563,11 +574,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PortalRevisionContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.PortalRevisionContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -591,10 +600,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -616,7 +626,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" + } @overload def begin_create_or_update( @@ -632,7 +644,8 @@ def begin_create_or_update( """Creates a new developer portal's revision by running the portal's publishing. The ``isCurrent`` property indicates if the revision is publicly accessible. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -672,7 +685,8 @@ def begin_create_or_update( """Creates a new developer portal's revision by running the portal's publishing. The ``isCurrent`` property indicates if the revision is publicly accessible. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -710,14 +724,15 @@ def begin_create_or_update( """Creates a new developer portal's revision by running the portal's publishing. The ``isCurrent`` property indicates if the revision is publicly accessible. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :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. @@ -738,16 +753,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalRevisionContract] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PortalRevisionContract] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, portal_revision_id=portal_revision_id, @@ -772,9 +785,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -786,9 +799,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" + } def _update_initial( self, @@ -810,11 +825,9 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PortalRevisionContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.PortalRevisionContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -839,10 +852,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -864,7 +878,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" + } @overload def begin_update( @@ -880,7 +896,8 @@ def begin_update( ) -> LROPoller[_models.PortalRevisionContract]: """Updates the description of specified portal revision or makes it current. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -923,7 +940,8 @@ def begin_update( ) -> LROPoller[_models.PortalRevisionContract]: """Updates the description of specified portal revision or makes it current. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -964,7 +982,8 @@ def begin_update( ) -> LROPoller[_models.PortalRevisionContract]: """Updates the description of specified portal revision or makes it current. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -974,7 +993,7 @@ 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 model type or a IO type. Required. + :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. @@ -995,16 +1014,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalRevisionContract] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PortalRevisionContract] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, service_name=service_name, portal_revision_id=portal_revision_id, @@ -1030,9 +1047,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1044,6 +1061,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}" + } 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 a7f0ce34734d..7ae2162628a8 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +49,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -63,10 +60,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -102,7 +99,8 @@ def list_by_service( ) -> _models.PortalSettingsCollection: """Lists a collection of portalsettings defined within a service instance.. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -122,10 +120,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalSettingsCollection] + 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( resource_group_name=resource_group_name, @@ -137,10 +133,11 @@ def list_by_service( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -157,4 +154,6 @@ def list_by_service( return deserialized - list_by_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings" + } 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 9064db4c3c4d..82a5c20e0560 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +44,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,8 +53,10 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -70,7 +67,7 @@ def build_list_by_service_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -91,7 +88,7 @@ def build_get_by_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +97,9 @@ def build_get_by_name_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -112,10 +111,10 @@ def build_get_by_name_request( "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,8 +135,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +145,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -158,10 +159,10 @@ def build_create_or_update_request( "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,7 +185,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -193,7 +194,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -205,10 +208,10 @@ def build_delete_request( "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -225,7 +228,7 @@ def build_list_private_link_resources_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -234,8 +237,10 @@ def build_list_private_link_resources_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -246,7 +251,7 @@ def build_list_private_link_resources_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -267,7 +272,7 @@ def build_get_private_link_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -276,8 +281,10 @@ def build_get_private_link_resource_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources/{privateLinkSubResourceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -291,7 +298,7 @@ def build_get_private_link_resource_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -327,7 +334,8 @@ def list_by_service( ) -> Iterable["_models.PrivateEndpointConnection"]: """Lists all private endpoint connections of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -341,10 +349,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -367,7 +373,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -383,7 +389,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -391,14 +397,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -411,7 +418,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections" + } @distributed_trace def get_by_name( @@ -419,7 +428,8 @@ def get_by_name( ) -> _models.PrivateEndpointConnection: """Gets the details of the Private Endpoint Connection specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -441,10 +451,8 @@ def get_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + 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( resource_group_name=resource_group_name, @@ -457,10 +465,11 @@ def get_by_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -477,7 +486,9 @@ def get_by_name( return deserialized - get_by_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get_by_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _create_or_update_initial( self, @@ -498,11 +509,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -526,10 +535,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -548,7 +558,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload def begin_create_or_update( @@ -563,7 +575,8 @@ def begin_create_or_update( ) -> LROPoller[_models.PrivateEndpointConnection]: """Creates a new Private Endpoint Connection or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -603,7 +616,8 @@ def begin_create_or_update( ) -> LROPoller[_models.PrivateEndpointConnection]: """Creates a new Private Endpoint Connection or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -640,13 +654,15 @@ def begin_create_or_update( ) -> LROPoller[_models.PrivateEndpointConnection]: """Creates a new Private Endpoint Connection or updates an existing one. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param private_endpoint_connection_request: Is either a PrivateEndpointConnectionRequest type + or a IO 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'. @@ -669,16 +685,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -699,7 +713,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -711,9 +725,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -729,10 +745,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -745,10 +759,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -761,7 +776,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def begin_delete( @@ -769,7 +786,8 @@ def begin_delete( ) -> LROPoller[None]: """Deletes the specified Private Endpoint Connection. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -790,13 +808,11 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -815,7 +831,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -827,9 +843,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def list_private_link_resources( @@ -837,7 +855,8 @@ def list_private_link_resources( ) -> _models.PrivateLinkResourceListResult: """Gets the private link resources. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -857,10 +876,8 @@ def list_private_link_resources( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourceListResult] + 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( resource_group_name=resource_group_name, @@ -872,10 +889,11 @@ def list_private_link_resources( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -892,7 +910,9 @@ def list_private_link_resources( return deserialized - list_private_link_resources.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources"} # type: ignore + list_private_link_resources.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources" + } @distributed_trace def get_private_link_resource( @@ -900,7 +920,8 @@ def get_private_link_resource( ) -> _models.PrivateLinkResource: """Gets the private link resources. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -922,10 +943,8 @@ def get_private_link_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] + 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( resource_group_name=resource_group_name, @@ -938,10 +957,11 @@ def get_private_link_resource( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -958,4 +978,6 @@ def get_private_link_resource( return deserialized - get_private_link_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources/{privateLinkSubResourceName}"} # type: ignore + get_private_link_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources/{privateLinkSubResourceName}" + } 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 c5bfb6f4884a..58fdaf86a5ca 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +50,7 @@ def build_list_by_product_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,9 @@ def build_list_by_product_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -74,10 +71,10 @@ def build_list_by_product_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -100,7 +97,7 @@ def build_check_entity_exists_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +106,9 @@ def build_check_entity_exists_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -120,10 +119,10 @@ def build_check_entity_exists_request( ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,7 +139,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +148,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -160,10 +161,10 @@ def build_create_or_update_request( ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -180,7 +181,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +190,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -200,10 +203,10 @@ def build_delete_request( ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -246,7 +249,8 @@ def list_by_product( ) -> Iterable["_models.ApiContract"]: """Lists a collection of the APIs associated with a product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -274,10 +278,8 @@ def list_by_product( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -304,7 +306,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -320,7 +322,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -328,14 +330,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ApiCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -348,7 +351,9 @@ 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"} # type: ignore + list_by_product.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis" + } @distributed_trace def check_entity_exists( @@ -356,7 +361,8 @@ def check_entity_exists( ) -> bool: """Checks that API entity specified by identifier is associated with the Product entity. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -382,10 +388,8 @@ def check_entity_exists( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -399,10 +403,11 @@ def check_entity_exists( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -416,7 +421,9 @@ def check_entity_exists( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - check_entity_exists.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}"} # type: ignore + check_entity_exists.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}" + } @distributed_trace def create_or_update( @@ -424,7 +431,8 @@ def create_or_update( ) -> _models.ApiContract: """Adds an API to the specified product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -450,10 +458,8 @@ def create_or_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApiContract] + 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( resource_group_name=resource_group_name, @@ -467,10 +473,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -487,11 +494,13 @@ def create_or_update( deserialized = self._deserialize("ApiContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}"} # 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 @@ -499,7 +508,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified API from the specified product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -525,10 +535,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -542,10 +550,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -558,4 +567,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}" + } 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 8d8588002512..dfb80a201e14 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +50,7 @@ def build_list_by_product_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,9 @@ def build_list_by_product_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -74,10 +71,10 @@ def build_list_by_product_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -100,7 +97,7 @@ def build_check_entity_exists_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +106,9 @@ def build_check_entity_exists_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -120,10 +119,10 @@ def build_check_entity_exists_request( ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,7 +139,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +148,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -160,10 +161,10 @@ def build_create_or_update_request( ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -180,7 +181,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +190,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -200,10 +203,10 @@ def build_delete_request( ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -246,7 +249,8 @@ def list_by_product( ) -> Iterable["_models.GroupContract"]: """Lists the collection of developer groups associated with the specified product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -270,10 +274,8 @@ def list_by_product( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GroupCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -300,7 +302,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -316,7 +318,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -324,14 +326,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("GroupCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -344,7 +347,9 @@ 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"} # type: ignore + list_by_product.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups" + } @distributed_trace def check_entity_exists( @@ -352,7 +357,8 @@ def check_entity_exists( ) -> bool: """Checks that Group entity specified by identifier is associated with the Product entity. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -378,10 +384,8 @@ def check_entity_exists( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -395,10 +399,11 @@ def check_entity_exists( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -412,7 +417,9 @@ def check_entity_exists( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - check_entity_exists.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}"} # type: ignore + check_entity_exists.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}" + } @distributed_trace def create_or_update( @@ -420,7 +427,8 @@ def create_or_update( ) -> _models.GroupContract: """Adds the association between the specified developer group with the specified product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -446,10 +454,8 @@ def create_or_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupContract] + 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( resource_group_name=resource_group_name, @@ -463,10 +469,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -483,11 +490,13 @@ def create_or_update( deserialized = self._deserialize("GroupContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}"} # 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 @@ -495,7 +504,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the association between the specified group and product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -521,10 +531,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -538,10 +546,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -554,4 +563,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}" + } 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 a9e8bee59713..4f7c954894ac 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +51,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +60,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -74,10 +71,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -104,7 +101,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +110,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -123,10 +122,10 @@ def build_get_entity_tag_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -143,7 +142,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +151,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -162,10 +163,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,8 +189,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +199,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -208,10 +211,10 @@ def build_create_or_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -232,8 +235,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -242,7 +245,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -252,10 +257,10 @@ def build_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -282,7 +287,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -291,7 +296,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -301,10 +308,10 @@ def build_delete_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if delete_subscriptions is not None: @@ -332,7 +339,7 @@ def build_list_by_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -341,7 +348,9 @@ def build_list_by_tags_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/productsByTags", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -350,10 +359,10 @@ def build_list_by_tags_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -407,7 +416,8 @@ def list_by_service( ) -> Iterable["_models.ProductContract"]: """Lists a collection of products in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -437,10 +447,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProductCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProductCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -468,7 +476,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -484,7 +492,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -492,14 +500,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProductCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -512,13 +521,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -541,10 +553,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, product_id _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -557,10 +567,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, product_id params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -577,7 +588,9 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, product_id return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" + } @distributed_trace def get( @@ -585,7 +598,8 @@ def get( ) -> _models.ProductContract: """Gets the details of the product specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -608,10 +622,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProductContract] + 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( resource_group_name=resource_group_name, @@ -624,10 +636,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -647,7 +660,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" + } @overload def create_or_update( @@ -663,7 +678,8 @@ def create_or_update( ) -> _models.ProductContract: """Creates or Updates a product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -698,7 +714,8 @@ def create_or_update( ) -> _models.ProductContract: """Creates or Updates a product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -731,14 +748,16 @@ def create_or_update( ) -> _models.ProductContract: """Creates or Updates a product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -762,11 +781,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProductContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ProductContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -791,10 +808,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -816,11 +834,13 @@ def create_or_update( deserialized = self._deserialize("ProductContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" + } @overload def update( @@ -836,7 +856,8 @@ def update( ) -> _models.ProductContract: """Update existing product details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -871,7 +892,8 @@ def update( ) -> _models.ProductContract: """Update existing product details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -904,7 +926,8 @@ def update( ) -> _models.ProductContract: """Update existing product details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -914,7 +937,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -935,11 +959,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProductContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ProductContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -964,10 +986,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -987,7 +1010,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1001,7 +1026,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1030,10 +1056,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1048,10 +1072,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1064,7 +1089,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}" + } @distributed_trace def list_by_tags( @@ -1079,7 +1106,8 @@ def list_by_tags( ) -> Iterable["_models.TagResourceContract"]: """Lists a collection of products associated with tags. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1106,10 +1134,8 @@ def list_by_tags( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagResourceCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TagResourceCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1136,7 +1162,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1152,7 +1178,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1160,14 +1186,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TagResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1180,4 +1207,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/productsByTags"} # type: ignore + 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 843bf0f30075..84a96ad592bb 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_by_product_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +49,9 @@ def build_list_by_product_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -64,10 +61,10 @@ def build_list_by_product_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,7 +86,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +95,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -109,10 +108,10 @@ def build_get_entity_tag_request( ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,7 +135,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +144,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -156,10 +157,10 @@ def build_get_request( ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if format is not None: @@ -185,8 +186,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -195,7 +196,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -206,10 +209,10 @@ def build_create_or_update_request( ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,7 +240,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -246,7 +249,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -257,10 +262,10 @@ def build_delete_request( ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), "policyId": _SERIALIZER.url("policy_id", policy_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -297,7 +302,8 @@ def list_by_product( ) -> _models.PolicyCollection: """Get the policy configuration at the Product level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -320,10 +326,8 @@ def list_by_product( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyCollection] + 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( resource_group_name=resource_group_name, @@ -336,10 +340,11 @@ def list_by_product( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -356,7 +361,9 @@ def list_by_product( return deserialized - list_by_product.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies"} # type: ignore + list_by_product.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies" + } @distributed_trace def get_entity_tag( @@ -369,7 +376,8 @@ def get_entity_tag( ) -> bool: """Get the ETag of the policy configuration at the Product level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -394,10 +402,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -411,10 +417,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -431,7 +438,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}" + } @distributed_trace def get( @@ -445,7 +454,8 @@ def get( ) -> _models.PolicyContract: """Get the policy configuration at the Product level. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -473,10 +483,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyContract] + 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( resource_group_name=resource_group_name, @@ -491,10 +499,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -514,7 +523,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}" + } @overload def create_or_update( @@ -531,7 +542,8 @@ def create_or_update( ) -> _models.PolicyContract: """Creates or updates policy configuration for the Product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -569,7 +581,8 @@ def create_or_update( ) -> _models.PolicyContract: """Creates or updates policy configuration for the Product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -605,7 +618,8 @@ def create_or_update( ) -> _models.PolicyContract: """Creates or updates policy configuration for the Product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -614,7 +628,8 @@ 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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -638,11 +653,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -668,10 +681,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -693,11 +707,13 @@ def create_or_update( deserialized = self._deserialize("PolicyContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}"} # 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 @@ -711,7 +727,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the policy configuration at the Product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -739,10 +756,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -757,10 +772,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -773,4 +789,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}" + } 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 736d1931c18b..6e5316d1b9d2 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,9 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/subscriptions", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -74,10 +71,10 @@ def build_list_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -126,7 +123,8 @@ def list( ) -> Iterable["_models.SubscriptionContract"]: """Lists the collection of subscriptions to the specified product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -158,10 +156,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SubscriptionCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -188,7 +184,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -204,7 +200,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -212,14 +208,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SubscriptionCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,4 +229,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}/products/{productId}/subscriptions"} # type: ignore + 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 new file mode 100644 index 000000000000..03540d486094 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wiki_operations.py @@ -0,0 +1,830 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_entity_tag_request( + resource_group_name: str, service_name: str, product_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, service_name: str, product_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + service_name: str, + product_id: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, service_name: str, product_id: str, subscription_id: str, *, if_match: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, product_id: str, subscription_id: str, *, if_match: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProductWikiOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s + :attr:`product_wiki` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get_entity_tag(self, resource_group_name: str, service_name: str, product_id: str, **kwargs: Any) -> bool: + """Gets the entity state (Etag) version of the Wiki for a Product specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if cls: + return cls(pipeline_response, None, response_headers) + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WikiContract] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("WikiContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + product_id: str, + parameters: _models.WikiContract, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WikiContract: + """Creates a new Wiki for a Product or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param product_id: Product identifier. Must be unique in the current API Management service + instance. Required. + :type product_id: str + :param parameters: Create parameters. Required. + :type parameters: ~azure.mgmt.apimanagement.models.WikiContract + :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 JSON body. + Default 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: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + product_id: str, + parameters: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WikiContract: + """Creates a new Wiki for a Product or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param product_id: Product identifier. Must be unique in the current API Management service + instance. Required. + :type product_id: str + :param parameters: Create parameters. Required. + :type parameters: IO + :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: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + service_name: str, + product_id: str, + parameters: Union[_models.WikiContract, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> _models.WikiContract: + """Creates a new Wiki for a Product or updates an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :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 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WikiContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "WikiContract", is_xml=True) + + request = build_create_or_update_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, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("WikiContract", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("WikiContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + 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, + resource_group_name: str, + service_name: str, + product_id: str, + if_match: str, + parameters: _models.WikiUpdateContract, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WikiContract: + """Updates the details of the Wiki for a Product specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param product_id: Product identifier. Must be unique in the current API Management service + instance. Required. + :type product_id: str + :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. Required. + :type parameters: ~azure.mgmt.apimanagement.models.WikiUpdateContract + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default 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: + """ + + @overload + def update( + self, + resource_group_name: str, + service_name: str, + product_id: str, + if_match: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WikiContract: + """Updates the details of the Wiki for a Product specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param product_id: Product identifier. Must be unique in the current API Management service + instance. Required. + :type product_id: str + :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. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WikiContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.WikiContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + service_name: str, + product_id: str, + if_match: str, + parameters: Union[_models.WikiUpdateContract, IO], + **kwargs: Any + ) -> _models.WikiContract: + """Updates the details of the Wiki for a Product specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param product_id: Product identifier. Must be unique in the current API Management service + instance. Required. + :type product_id: str + :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 + :return: WikiContract or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.WikiContract + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WikiContract] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "WikiUpdateContract") + + request = build_update_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, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("WikiContract", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, product_id: str, if_match: str, **kwargs: Any + ) -> None: + """Deletes the specified Wiki from a Product. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param product_id: Product identifier. Must be unique in the current API Management service + instance. Required. + :type product_id: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" + } 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 new file mode 100644 index 000000000000..52032fd1074b --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wikis_operations.py @@ -0,0 +1,225 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, + service_name: str, + product_id: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", + service_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", + ), + "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1) + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProductWikisOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s + :attr:`product_wikis` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + product_id: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.WikiContract"]: + """Gets the details of the Wiki for a Product specified by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of the API Management service. Required. + :type service_name: str + :param product_id: Product identifier. Must be unique in the current API Management service + instance. Required. + :type product_id: str + :param filter: | Field | Usage | Supported operators | Supported + functions |
|-------------|-------------|-------------|-------------|
| name | + filter | eq | contains |
. Default value is None. + :type filter: str + :param top: Number of records to return. Default value is None. + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WikiCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + filter=filter, + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WikiCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 7890551942c8..605c2e17418c 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +49,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -64,10 +61,10 @@ def build_list_by_service_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "quotaCounterKey": _SERIALIZER.url("quota_counter_key", quota_counter_key, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,8 +81,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +91,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -104,10 +103,10 @@ def build_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "quotaCounterKey": _SERIALIZER.url("quota_counter_key", quota_counter_key, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,7 +145,12 @@ def list_by_service( """Lists a collection of current quota counter periods associated with the counter-key configured in the policy on the specified service instance. The api does not support paging yet. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-product-with-rules#a-namepolicies-ato-configure-call-rate-limit-and-quota-policies + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -171,10 +175,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.QuotaCounterCollection] + 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( resource_group_name=resource_group_name, @@ -187,10 +189,11 @@ def list_by_service( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -207,7 +210,9 @@ def list_by_service( return deserialized - list_by_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}" + } @overload def update( @@ -223,7 +228,8 @@ def update( """Updates all the quota counter values specified with the existing quota counter key to a value in the specified service instance. This should be used for reset of the quota counter values. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -258,7 +264,8 @@ def update( """Updates all the quota counter values specified with the existing quota counter key to a value in the specified service instance. This should be used for reset of the quota counter values. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -291,7 +298,8 @@ def update( """Updates all the quota counter values specified with the existing quota counter key to a value in the specified service instance. This should be used for reset of the quota counter values. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -301,7 +309,7 @@ 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 model type or a IO type. Required. + 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. @@ -322,11 +330,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.QuotaCounterCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.QuotaCounterCollection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -350,10 +356,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -370,4 +377,6 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}" + } 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 da0948f9d350..d9dac39cb621 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +45,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +54,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -70,10 +67,10 @@ def build_get_request( ), "quotaCounterKey": _SERIALIZER.url("quota_counter_key", quota_counter_key, "str"), "quotaPeriodKey": _SERIALIZER.url("quota_period_key", quota_period_key, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,8 +92,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +102,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -116,10 +115,10 @@ def build_update_request( ), "quotaCounterKey": _SERIALIZER.url("quota_counter_key", quota_counter_key, "str"), "quotaPeriodKey": _SERIALIZER.url("quota_period_key", quota_period_key, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -158,7 +157,12 @@ def get( """Gets the value of the quota counter associated with the counter-key in the policy for the specific period in service instance. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-product-with-rules#a-namepolicies-ato-configure-call-rate-limit-and-quota-policies + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -185,10 +189,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.QuotaCounterContract] + 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( resource_group_name=resource_group_name, @@ -202,10 +204,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -222,7 +225,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}" + } @overload def update( @@ -238,7 +243,8 @@ def update( ) -> _models.QuotaCounterContract: """Updates an existing quota counter value in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -275,7 +281,8 @@ def update( ) -> _models.QuotaCounterContract: """Updates an existing quota counter value in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -310,7 +317,8 @@ def update( ) -> _models.QuotaCounterContract: """Updates an existing quota counter value in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -322,7 +330,7 @@ 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 model type or a IO type. Required. + 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. @@ -343,11 +351,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.QuotaCounterContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.QuotaCounterContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -372,10 +378,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -392,4 +399,6 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}" + } 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 4a0f44305bf1..46a24e66c17a 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +51,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/regions", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -65,10 +62,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,7 +101,8 @@ def list_by_service( ) -> Iterable["_models.RegionContract"]: """Lists all azure regions in which the service exists. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -116,10 +114,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RegionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -142,7 +138,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -158,7 +154,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -166,14 +162,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RegionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,4 +183,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}/regions"} # type: ignore + 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 57d86539752a..3438453d34a9 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 @@ -7,7 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +51,7 @@ def build_list_by_api_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +60,9 @@ def build_list_by_api_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byApi", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -74,10 +71,10 @@ def build_list_by_api_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["$filter"] = _SERIALIZER.query("filter", filter, "str") @@ -109,7 +106,7 @@ def build_list_by_user_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,7 +115,9 @@ def build_list_by_user_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byUser", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -127,10 +126,10 @@ def build_list_by_user_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["$filter"] = _SERIALIZER.query("filter", filter, "str") @@ -162,7 +161,7 @@ def build_list_by_operation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +170,9 @@ def build_list_by_operation_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byOperation", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -180,10 +181,10 @@ def build_list_by_operation_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["$filter"] = _SERIALIZER.query("filter", filter, "str") @@ -215,7 +216,7 @@ def build_list_by_product_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -224,7 +225,9 @@ def build_list_by_product_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byProduct", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -233,10 +236,10 @@ def build_list_by_product_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["$filter"] = _SERIALIZER.query("filter", filter, "str") @@ -267,7 +270,7 @@ def build_list_by_geo_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -276,7 +279,9 @@ def build_list_by_geo_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byGeo", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -285,10 +290,10 @@ def build_list_by_geo_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["$filter"] = _SERIALIZER.query("filter", filter, "str") @@ -318,7 +323,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -327,7 +332,9 @@ def build_list_by_subscription_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/bySubscription", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -336,10 +343,10 @@ def build_list_by_subscription_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["$filter"] = _SERIALIZER.query("filter", filter, "str") @@ -372,7 +379,7 @@ def build_list_by_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -381,7 +388,9 @@ def build_list_by_time_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byTime", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -390,10 +399,10 @@ def build_list_by_time_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["$filter"] = _SERIALIZER.query("filter", filter, "str") @@ -425,7 +434,7 @@ def build_list_by_request_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -434,7 +443,9 @@ def build_list_by_request_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byRequest", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -443,10 +454,10 @@ def build_list_by_request_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["$filter"] = _SERIALIZER.query("filter", filter, "str") @@ -494,7 +505,8 @@ def list_by_api( ) -> Iterable["_models.ReportRecordContract"]: """Lists report records by API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -515,10 +527,8 @@ def list_by_api( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReportCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -545,7 +555,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -561,7 +571,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -569,14 +579,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -589,7 +600,9 @@ 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"} # type: ignore + list_by_api.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byApi" + } @distributed_trace def list_by_user( @@ -604,7 +617,8 @@ def list_by_user( ) -> Iterable["_models.ReportRecordContract"]: """Lists report records by User. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -638,10 +652,8 @@ def list_by_user( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReportCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -668,7 +680,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -684,7 +696,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -692,14 +704,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -712,7 +725,9 @@ 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"} # type: ignore + list_by_user.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byUser" + } @distributed_trace def list_by_operation( @@ -727,7 +742,8 @@ def list_by_operation( ) -> Iterable["_models.ReportRecordContract"]: """Lists report records by API Operations. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -761,10 +777,8 @@ def list_by_operation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReportCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -791,7 +805,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -807,7 +821,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -815,14 +829,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -835,7 +850,9 @@ 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"} # type: ignore + list_by_operation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byOperation" + } @distributed_trace def list_by_product( @@ -850,7 +867,8 @@ def list_by_product( ) -> Iterable["_models.ReportRecordContract"]: """Lists report records by Product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -883,10 +901,8 @@ def list_by_product( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReportCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -913,7 +929,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -929,7 +945,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -937,14 +953,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -957,7 +974,9 @@ 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"} # type: ignore + list_by_product.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byProduct" + } @distributed_trace def list_by_geo( @@ -971,7 +990,8 @@ def list_by_geo( ) -> Iterable["_models.ReportRecordContract"]: """Lists report records by geography. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1002,10 +1022,8 @@ def list_by_geo( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReportCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1031,7 +1049,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1047,7 +1065,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1055,14 +1073,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1075,7 +1094,9 @@ 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"} # type: ignore + list_by_geo.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byGeo" + } @distributed_trace def list_by_subscription( @@ -1090,7 +1111,8 @@ def list_by_subscription( ) -> Iterable["_models.ReportRecordContract"]: """Lists report records by subscription. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1123,10 +1145,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReportCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1153,7 +1173,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1169,7 +1189,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1177,14 +1197,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1197,7 +1218,9 @@ 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"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/bySubscription" + } @distributed_trace def list_by_time( @@ -1213,7 +1236,8 @@ def list_by_time( ) -> Iterable["_models.ReportRecordContract"]: """Lists report records by Time. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1250,10 +1274,8 @@ def list_by_time( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReportCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1281,7 +1303,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1297,7 +1319,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1305,14 +1327,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1325,7 +1348,9 @@ 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"} # type: ignore + list_by_time.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byTime" + } @distributed_trace def list_by_request( @@ -1339,7 +1364,8 @@ def list_by_request( ) -> Iterable["_models.RequestReportRecordContract"]: """Lists report records by Request. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1363,10 +1389,8 @@ def list_by_request( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RequestReportCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RequestReportCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1392,7 +1416,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1408,7 +1432,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1416,14 +1440,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RequestReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1436,4 +1461,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_request.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byRequest"} # type: ignore + 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 bb499d872b1a..e496673402e3 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +49,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -63,10 +60,10 @@ def build_get_entity_tag_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,7 +78,7 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +87,9 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -99,10 +98,10 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_ min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,8 +118,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +128,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -138,10 +139,10 @@ def build_update_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -161,8 +162,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +172,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -180,10 +183,10 @@ def build_create_or_update_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -221,7 +224,8 @@ def __init__(self, *args, **kwargs): def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the SignInSettings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -241,10 +245,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -256,10 +258,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -276,13 +279,16 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -302,10 +308,8 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalSigninSettings] + 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( resource_group_name=resource_group_name, @@ -317,10 +321,11 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -340,7 +345,9 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin" + } @overload def update( # pylint: disable=inconsistent-return-statements @@ -355,7 +362,8 @@ def update( # pylint: disable=inconsistent-return-statements ) -> None: """Update Sign-In settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -386,7 +394,8 @@ def update( # pylint: disable=inconsistent-return-statements ) -> None: """Update Sign-In settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -415,14 +424,16 @@ def update( # pylint: disable=inconsistent-return-statements ) -> None: """Update Sign-In settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :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. @@ -443,11 +454,9 @@ def update( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -471,10 +480,11 @@ def update( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -487,7 +497,9 @@ def update( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin" + } @overload def create_or_update( @@ -502,7 +514,8 @@ def create_or_update( ) -> _models.PortalSigninSettings: """Create or Update Sign-In settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -533,7 +546,8 @@ def create_or_update( ) -> _models.PortalSigninSettings: """Create or Update Sign-In settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -562,11 +576,13 @@ def create_or_update( ) -> _models.PortalSigninSettings: """Create or Update Sign-In settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -590,11 +606,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalSigninSettings] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PortalSigninSettings] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -618,10 +632,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -638,4 +653,6 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin" + } 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 d13f8bc76337..372004dbd9f9 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +49,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -63,10 +60,10 @@ def build_get_entity_tag_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,7 +78,7 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +87,9 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -99,10 +98,10 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_ min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,8 +118,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +128,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -138,10 +139,10 @@ def build_update_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -161,8 +162,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +172,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -180,10 +183,10 @@ def build_create_or_update_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -221,7 +224,8 @@ def __init__(self, *args, **kwargs): def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: Any) -> bool: """Gets the entity state (Etag) version of the SignUpSettings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -241,10 +245,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -256,10 +258,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -276,13 +279,16 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs: return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -302,10 +308,8 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalSignupSettings] + 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( resource_group_name=resource_group_name, @@ -317,10 +321,11 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -340,7 +345,9 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup" + } @overload def update( # pylint: disable=inconsistent-return-statements @@ -355,7 +362,8 @@ def update( # pylint: disable=inconsistent-return-statements ) -> None: """Update Sign-Up settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -386,7 +394,8 @@ def update( # pylint: disable=inconsistent-return-statements ) -> None: """Update Sign-Up settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -415,14 +424,16 @@ def update( # pylint: disable=inconsistent-return-statements ) -> None: """Update Sign-Up settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :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. @@ -443,11 +454,9 @@ def update( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -471,10 +480,11 @@ def update( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -487,7 +497,9 @@ def update( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup" + } @overload def create_or_update( @@ -502,7 +514,8 @@ def create_or_update( ) -> _models.PortalSignupSettings: """Create or Update Sign-Up settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -533,7 +546,8 @@ def create_or_update( ) -> _models.PortalSignupSettings: """Create or Update Sign-Up settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -562,11 +576,13 @@ def create_or_update( ) -> _models.PortalSignupSettings: """Create or Update Sign-Up settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :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 model type or a IO type. Required. + :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 if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -590,11 +606,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PortalSignupSettings] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PortalSignupSettings] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -618,10 +632,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -638,4 +653,6 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup" + } 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 394367993d04..2d3184d4b5b7 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +49,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +58,9 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -72,10 +69,10 @@ def build_list_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -98,7 +95,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +104,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -117,10 +116,10 @@ def build_get_entity_tag_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -137,7 +136,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +145,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -156,10 +157,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,8 +185,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +195,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -204,10 +207,10 @@ def build_create_or_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if notify is not None: @@ -240,8 +243,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -250,7 +253,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -260,10 +265,10 @@ def build_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if notify is not None: @@ -287,7 +292,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -296,7 +301,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -306,10 +313,10 @@ def build_delete_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -327,7 +334,7 @@ def build_regenerate_primary_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -336,7 +343,9 @@ def build_regenerate_primary_key_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regeneratePrimaryKey", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -346,10 +355,10 @@ def build_regenerate_primary_key_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -366,7 +375,7 @@ def build_regenerate_secondary_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -375,7 +384,9 @@ def build_regenerate_secondary_key_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regenerateSecondaryKey", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -385,10 +396,10 @@ def build_regenerate_secondary_key_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -405,7 +416,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -414,7 +425,9 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -424,10 +437,10 @@ def build_list_secrets_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -469,7 +482,8 @@ def list( ) -> Iterable["_models.SubscriptionContract"]: """Lists all subscriptions of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -498,10 +512,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SubscriptionCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -527,7 +539,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -543,7 +555,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -551,14 +563,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SubscriptionCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -571,14 +584,17 @@ 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"} # type: ignore + 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 identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -601,10 +617,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, sid: str, _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -617,10 +631,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, sid: str, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -637,13 +652,16 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, sid: str, return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -666,10 +684,8 @@ def get(self, resource_group_name: str, service_name: str, sid: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionContract] + 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( resource_group_name=resource_group_name, @@ -682,10 +698,11 @@ def get(self, resource_group_name: str, service_name: str, sid: str, **kwargs: A params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -705,7 +722,9 @@ def get(self, resource_group_name: str, service_name: str, sid: str, **kwargs: A return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" + } @overload def create_or_update( @@ -723,7 +742,8 @@ def create_or_update( ) -> _models.SubscriptionContract: """Creates or updates the subscription of specified user to the specified product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -770,7 +790,8 @@ def create_or_update( ) -> _models.SubscriptionContract: """Creates or updates the subscription of specified user to the specified product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -815,14 +836,16 @@ def create_or_update( ) -> _models.SubscriptionContract: """Creates or updates the subscription of specified user to the specified product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a SubscriptionCreateParameters type or a IO + type. Required. :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionCreateParameters or IO :param notify: Notify change in Subscription State. @@ -856,11 +879,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SubscriptionContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -887,10 +908,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -912,11 +934,13 @@ def create_or_update( 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 + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" + } @overload def update( @@ -934,7 +958,8 @@ def update( ) -> _models.SubscriptionContract: """Updates the details of a subscription specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -981,7 +1006,8 @@ def update( ) -> _models.SubscriptionContract: """Updates the details of a subscription specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1026,7 +1052,8 @@ def update( ) -> _models.SubscriptionContract: """Updates the details of a subscription specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1036,7 +1063,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: Update parameters. Is either a model type or a IO type. Required. + :param parameters: Update parameters. Is either a SubscriptionUpdateParameters type or a IO + type. Required. :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionUpdateParameters or IO :param notify: Notify change in Subscription State. @@ -1067,11 +1095,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SubscriptionContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1098,10 +1124,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1121,7 +1148,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1129,7 +1158,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes the specified subscription. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1155,10 +1185,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1172,10 +1200,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1188,7 +1217,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}" + } @distributed_trace def regenerate_primary_key( # pylint: disable=inconsistent-return-statements @@ -1196,7 +1227,8 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements ) -> None: """Regenerates primary key of existing subscription of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1219,10 +1251,8 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -1235,10 +1265,11 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1251,7 +1282,9 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - regenerate_primary_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regeneratePrimaryKey"} # type: ignore + regenerate_primary_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regeneratePrimaryKey" + } @distributed_trace def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements @@ -1259,7 +1292,8 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements ) -> None: """Regenerates secondary key of existing subscription of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1282,10 +1316,8 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -1298,10 +1330,11 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1314,7 +1347,9 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - regenerate_secondary_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regenerateSecondaryKey"} # type: ignore + regenerate_secondary_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regenerateSecondaryKey" + } @distributed_trace def list_secrets( @@ -1322,7 +1357,8 @@ def list_secrets( ) -> _models.SubscriptionKeysContract: """Gets the specified Subscription keys. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1345,10 +1381,8 @@ def list_secrets( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionKeysContract] + 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( resource_group_name=resource_group_name, @@ -1361,10 +1395,11 @@ def list_secrets( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1384,4 +1419,6 @@ def list_secrets( return deserialized - list_secrets.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/listSecrets"} # type: ignore + list_secrets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/listSecrets" + } 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 989428267e49..87c1137c31ba 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +51,7 @@ def build_list_by_operation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +60,9 @@ def build_list_by_operation_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -76,10 +73,10 @@ def build_list_by_operation_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -108,7 +105,7 @@ def build_get_entity_state_by_operation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -117,7 +114,9 @@ def build_get_entity_state_by_operation_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -129,10 +128,10 @@ def build_get_entity_state_by_operation_request( "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1), "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +154,7 @@ def build_get_by_operation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +163,9 @@ def build_get_by_operation_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -176,10 +177,10 @@ def build_get_by_operation_request( "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1), "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -202,7 +203,7 @@ def build_assign_to_operation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -211,7 +212,9 @@ def build_assign_to_operation_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -223,10 +226,10 @@ def build_assign_to_operation_request( "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1), "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -249,7 +252,7 @@ def build_detach_from_operation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -258,7 +261,9 @@ def build_detach_from_operation_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -270,10 +275,10 @@ def build_detach_from_operation_request( "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1), "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -298,7 +303,7 @@ def build_list_by_api_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -307,7 +312,9 @@ def build_list_by_api_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -317,10 +324,10 @@ def build_list_by_api_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -343,7 +350,7 @@ def build_get_entity_state_by_api_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -352,7 +359,9 @@ def build_get_entity_state_by_api_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -363,10 +372,10 @@ def build_get_entity_state_by_api_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -383,7 +392,7 @@ def build_get_by_api_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -392,7 +401,9 @@ def build_get_by_api_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -403,10 +414,10 @@ def build_get_by_api_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -423,7 +434,7 @@ def build_assign_to_api_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -432,7 +443,9 @@ def build_assign_to_api_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -443,10 +456,10 @@ def build_assign_to_api_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -463,7 +476,7 @@ def build_detach_from_api_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -472,7 +485,9 @@ def build_detach_from_api_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -483,10 +498,10 @@ def build_detach_from_api_request( ), "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"), "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -511,7 +526,7 @@ def build_list_by_product_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -520,7 +535,9 @@ def build_list_by_product_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -530,10 +547,10 @@ def build_list_by_product_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -556,7 +573,7 @@ def build_get_entity_state_by_product_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -565,7 +582,9 @@ def build_get_entity_state_by_product_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -576,10 +595,10 @@ def build_get_entity_state_by_product_request( ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -596,7 +615,7 @@ def build_get_by_product_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -605,7 +624,9 @@ def build_get_by_product_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -616,10 +637,10 @@ def build_get_by_product_request( ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -636,7 +657,7 @@ def build_assign_to_product_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -645,7 +666,9 @@ def build_assign_to_product_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -656,10 +679,10 @@ def build_assign_to_product_request( ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -676,7 +699,7 @@ def build_detach_from_product_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -685,7 +708,9 @@ def build_detach_from_product_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -696,10 +721,10 @@ def build_detach_from_product_request( ), "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1), "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -724,7 +749,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -733,7 +758,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -742,10 +769,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -770,7 +797,7 @@ def build_get_entity_state_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -779,7 +806,9 @@ def build_get_entity_state_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -789,10 +818,10 @@ def build_get_entity_state_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -809,7 +838,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -818,7 +847,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -828,10 +859,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -854,8 +885,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -864,7 +895,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -874,10 +907,10 @@ def build_create_or_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -898,8 +931,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -908,7 +941,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -918,10 +953,10 @@ def build_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -941,7 +976,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -950,7 +985,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -960,10 +997,10 @@ def build_delete_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1008,7 +1045,8 @@ def list_by_operation( ) -> Iterable["_models.TagContract"]: """Lists all Tags associated with the Operation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1036,10 +1074,8 @@ def list_by_operation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TagCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1067,7 +1103,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1083,7 +1119,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1091,14 +1127,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TagCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1111,7 +1148,9 @@ 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"} # type: ignore + 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( @@ -1119,7 +1158,8 @@ def get_entity_state_by_operation( ) -> bool: """Gets the entity state version of the tag specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1148,10 +1188,8 @@ def get_entity_state_by_operation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -1166,10 +1204,11 @@ def get_entity_state_by_operation( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1186,7 +1225,9 @@ def get_entity_state_by_operation( return cls(pipeline_response, None, response_headers) 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}"} # type: ignore + 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( @@ -1194,7 +1235,8 @@ def get_by_operation( ) -> _models.TagContract: """Get tag associated with the Operation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1223,10 +1265,8 @@ def get_by_operation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagContract] + 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( resource_group_name=resource_group_name, @@ -1241,10 +1281,11 @@ def get_by_operation( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1264,7 +1305,9 @@ def get_by_operation( return deserialized - get_by_operation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}"} # type: ignore + get_by_operation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}" + } @distributed_trace def assign_to_operation( @@ -1272,7 +1315,8 @@ def assign_to_operation( ) -> _models.TagContract: """Assign tag to the Operation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1301,10 +1345,8 @@ def assign_to_operation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagContract] + 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( resource_group_name=resource_group_name, @@ -1319,10 +1361,11 @@ def assign_to_operation( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1339,11 +1382,13 @@ def assign_to_operation( deserialized = self._deserialize("TagContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - assign_to_operation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}"} # 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 @@ -1351,7 +1396,8 @@ def detach_from_operation( # pylint: disable=inconsistent-return-statements ) -> None: """Detach the tag from the Operation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1380,10 +1426,8 @@ def detach_from_operation( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -1398,10 +1442,11 @@ def detach_from_operation( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1414,7 +1459,9 @@ def detach_from_operation( # pylint: disable=inconsistent-return-statements 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}"} # type: ignore + detach_from_operation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}" + } @distributed_trace def list_by_api( @@ -1429,7 +1476,8 @@ def list_by_api( ) -> Iterable["_models.TagContract"]: """Lists all Tags associated with the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1454,10 +1502,8 @@ def list_by_api( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TagCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1484,7 +1530,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1500,7 +1546,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1508,14 +1554,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TagCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1528,7 +1575,9 @@ 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"} # type: ignore + 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( @@ -1536,7 +1585,8 @@ def get_entity_state_by_api( ) -> bool: """Gets the entity state version of the tag specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1562,10 +1612,8 @@ def get_entity_state_by_api( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -1579,10 +1627,11 @@ def get_entity_state_by_api( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1599,7 +1648,9 @@ def get_entity_state_by_api( return cls(pipeline_response, None, response_headers) 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}"} # type: ignore + 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( @@ -1607,7 +1658,8 @@ def get_by_api( ) -> _models.TagContract: """Get tag associated with the API. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1633,10 +1685,8 @@ def get_by_api( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagContract] + 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( resource_group_name=resource_group_name, @@ -1650,10 +1700,11 @@ def get_by_api( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1673,7 +1724,9 @@ def get_by_api( return deserialized - get_by_api.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}"} # type: ignore + get_by_api.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}" + } @distributed_trace def assign_to_api( @@ -1681,7 +1734,8 @@ def assign_to_api( ) -> _models.TagContract: """Assign tag to the Api. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1707,10 +1761,8 @@ def assign_to_api( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagContract] + 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( resource_group_name=resource_group_name, @@ -1724,10 +1776,11 @@ def assign_to_api( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1749,11 +1802,13 @@ def assign_to_api( deserialized = self._deserialize("TagContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - assign_to_api.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}"} # 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 @@ -1761,7 +1816,8 @@ def detach_from_api( # pylint: disable=inconsistent-return-statements ) -> None: """Detach the tag from the Api. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1787,10 +1843,8 @@ def detach_from_api( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -1804,10 +1858,11 @@ def detach_from_api( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1820,7 +1875,9 @@ def detach_from_api( # pylint: disable=inconsistent-return-statements 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}"} # type: ignore + detach_from_api.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}" + } @distributed_trace def list_by_product( @@ -1835,7 +1892,8 @@ def list_by_product( ) -> Iterable["_models.TagContract"]: """Lists all Tags associated with the Product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1860,10 +1918,8 @@ def list_by_product( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TagCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1890,7 +1946,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1906,7 +1962,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1914,14 +1970,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TagCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1934,7 +1991,9 @@ 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"} # type: ignore + 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( @@ -1942,7 +2001,8 @@ def get_entity_state_by_product( ) -> bool: """Gets the entity state version of the tag specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1968,10 +2028,8 @@ def get_entity_state_by_product( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -1985,10 +2043,11 @@ def get_entity_state_by_product( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2005,7 +2064,9 @@ def get_entity_state_by_product( return cls(pipeline_response, None, response_headers) 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}"} # type: ignore + 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( @@ -2013,7 +2074,8 @@ def get_by_product( ) -> _models.TagContract: """Get tag associated with the Product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -2039,10 +2101,8 @@ def get_by_product( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagContract] + 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( resource_group_name=resource_group_name, @@ -2056,10 +2116,11 @@ def get_by_product( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2079,7 +2140,9 @@ def get_by_product( return deserialized - get_by_product.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}"} # type: ignore + get_by_product.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}" + } @distributed_trace def assign_to_product( @@ -2087,7 +2150,8 @@ def assign_to_product( ) -> _models.TagContract: """Assign tag to the Product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -2113,10 +2177,8 @@ def assign_to_product( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagContract] + 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( resource_group_name=resource_group_name, @@ -2130,10 +2192,11 @@ def assign_to_product( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2150,11 +2213,13 @@ def assign_to_product( deserialized = self._deserialize("TagContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - assign_to_product.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}"} # 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 @@ -2162,7 +2227,8 @@ def detach_from_product( # pylint: disable=inconsistent-return-statements ) -> None: """Detach the tag from the Product. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -2188,10 +2254,8 @@ def detach_from_product( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -2205,10 +2269,11 @@ def detach_from_product( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2221,7 +2286,9 @@ def detach_from_product( # pylint: disable=inconsistent-return-statements 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}"} # type: ignore + detach_from_product.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}" + } @distributed_trace def list_by_service( @@ -2236,7 +2303,8 @@ def list_by_service( ) -> Iterable["_models.TagContract"]: """Lists a collection of tags defined within a service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -2260,10 +2328,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TagCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -2290,7 +2356,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -2306,7 +2372,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2314,14 +2380,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TagCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2334,13 +2401,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -2363,10 +2433,8 @@ def get_entity_state(self, resource_group_name: str, service_name: str, tag_id: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -2379,10 +2447,11 @@ def get_entity_state(self, resource_group_name: str, service_name: str, tag_id: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2399,13 +2468,16 @@ def get_entity_state(self, resource_group_name: str, service_name: str, tag_id: return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_state.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -2428,10 +2500,8 @@ def get(self, resource_group_name: str, service_name: str, tag_id: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagContract] + 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( resource_group_name=resource_group_name, @@ -2444,10 +2514,11 @@ def get(self, resource_group_name: str, service_name: str, tag_id: str, **kwargs params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2467,7 +2538,9 @@ def get(self, resource_group_name: str, service_name: str, tag_id: str, **kwargs return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}" + } @overload def create_or_update( @@ -2483,7 +2556,8 @@ def create_or_update( ) -> _models.TagContract: """Creates a tag. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -2518,7 +2592,8 @@ def create_or_update( ) -> _models.TagContract: """Creates a tag. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -2551,14 +2626,16 @@ def create_or_update( ) -> _models.TagContract: """Creates a tag. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :param parameters: Create parameters. Is either a TagCreateUpdateParameters type or a IO type. + Required. :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters or IO :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. Default value is None. @@ -2582,11 +2659,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TagContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2611,10 +2686,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2636,11 +2712,13 @@ def create_or_update( deserialized = self._deserialize("TagContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}" + } @overload def update( @@ -2656,7 +2734,8 @@ def update( ) -> _models.TagContract: """Updates the details of the tag specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -2691,7 +2770,8 @@ def update( ) -> _models.TagContract: """Updates the details of the tag specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -2724,7 +2804,8 @@ def update( ) -> _models.TagContract: """Updates the details of the tag specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -2734,7 +2815,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -2755,11 +2837,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TagContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2784,10 +2864,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2807,7 +2888,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -2815,7 +2898,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific tag of the API Management service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -2841,10 +2925,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -2858,10 +2940,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2874,4 +2957,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}" + } 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 54ae85ed6006..4a69f326b9ce 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +49,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +58,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tagResources", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -72,10 +69,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -123,7 +120,8 @@ def list_by_service( ) -> Iterable["_models.TagResourceContract"]: """Lists a collection of resources associated with tags. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -155,10 +153,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TagResourceCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TagResourceCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -184,7 +180,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -200,7 +196,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -208,14 +204,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TagResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -228,4 +225,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}/tagResources"} # type: ignore + 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 eedaef725aac..1cc20a35c83c 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +44,7 @@ def build_regenerate_primary_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +53,9 @@ def build_regenerate_primary_key_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regeneratePrimaryKey", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -67,11 +64,11 @@ def build_regenerate_primary_key_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "accessName": _SERIALIZER.url("access_name", access_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -92,7 +89,7 @@ def build_regenerate_secondary_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +98,9 @@ def build_regenerate_secondary_key_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regenerateSecondaryKey", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -110,11 +109,11 @@ def build_regenerate_secondary_key_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "accessName": _SERIALIZER.url("access_name", access_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -150,7 +149,8 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements ) -> None: """Regenerate primary access key for GIT. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -173,10 +173,8 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -189,10 +187,11 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -205,7 +204,9 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements 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"} # type: ignore + regenerate_primary_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regeneratePrimaryKey" + } @distributed_trace def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements @@ -213,7 +214,8 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements ) -> None: """Regenerate secondary access key for GIT. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -236,10 +238,8 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -252,10 +252,11 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -268,4 +269,6 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements 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"} # type: ignore + regenerate_secondary_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regenerateSecondaryKey" + } 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 412158f07893..b6c4a33f0e2a 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +51,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -65,10 +62,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -91,7 +88,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +97,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -109,11 +108,11 @@ def build_get_entity_tag_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "accessName": _SERIALIZER.url("access_name", access_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,7 +133,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +142,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -152,11 +153,11 @@ def build_get_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "accessName": _SERIALIZER.url("access_name", access_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -179,8 +180,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +190,9 @@ def build_create_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -199,10 +202,10 @@ def build_create_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "accessName": _SERIALIZER.url("access_name", access_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -228,8 +231,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -238,7 +241,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -248,10 +253,10 @@ def build_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "accessName": _SERIALIZER.url("access_name", access_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -275,7 +280,7 @@ def build_regenerate_primary_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -284,7 +289,9 @@ def build_regenerate_primary_key_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regeneratePrimaryKey", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -293,11 +300,11 @@ def build_regenerate_primary_key_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "accessName": _SERIALIZER.url("access_name", access_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -318,7 +325,7 @@ def build_regenerate_secondary_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -327,7 +334,9 @@ def build_regenerate_secondary_key_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regenerateSecondaryKey", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -336,11 +345,11 @@ def build_regenerate_secondary_key_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "accessName": _SERIALIZER.url("access_name", access_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -361,7 +370,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -370,7 +379,9 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -379,11 +390,11 @@ def build_list_secrets_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "accessName": _SERIALIZER.url("access_name", access_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -419,7 +430,8 @@ def list_by_service( ) -> Iterable["_models.AccessInformationContract"]: """Returns list of access infos - for Git and Management endpoints. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -435,10 +447,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessInformationCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AccessInformationCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -462,7 +472,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -478,7 +488,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -486,14 +496,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessInformationCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -506,7 +517,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant" + } @distributed_trace def get_entity_tag( @@ -514,7 +527,8 @@ def get_entity_tag( ) -> bool: """Tenant access metadata. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -537,10 +551,8 @@ def get_entity_tag( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -553,10 +565,11 @@ def get_entity_tag( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -573,7 +586,9 @@ def get_entity_tag( return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}"} # type: ignore + get_entity_tag.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}" + } @distributed_trace def get( @@ -581,7 +596,8 @@ def get( ) -> _models.AccessInformationContract: """Get tenant access information details without secrets. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -604,10 +620,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessInformationContract] + 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( resource_group_name=resource_group_name, @@ -620,10 +634,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -643,7 +658,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}" + } @overload def create( @@ -659,7 +676,8 @@ def create( ) -> _models.AccessInformationContract: """Update tenant access information details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -694,7 +712,8 @@ def create( ) -> _models.AccessInformationContract: """Update tenant access information details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -727,7 +746,8 @@ def create( ) -> _models.AccessInformationContract: """Update tenant access information details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -738,7 +758,7 @@ 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 - model type or a IO type. Required. + 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. @@ -759,11 +779,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessInformationContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessInformationContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -788,10 +806,11 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -811,7 +830,9 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}" + } @overload def update( @@ -827,7 +848,8 @@ def update( ) -> _models.AccessInformationContract: """Update tenant access information details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -862,7 +884,8 @@ def update( ) -> _models.AccessInformationContract: """Update tenant access information details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -895,7 +918,8 @@ def update( ) -> _models.AccessInformationContract: """Update tenant access information details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -906,7 +930,7 @@ 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 - model type or a IO type. Required. + 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. @@ -927,11 +951,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessInformationContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessInformationContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -956,10 +978,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -979,7 +1002,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}" + } @distributed_trace def regenerate_primary_key( # pylint: disable=inconsistent-return-statements @@ -987,7 +1012,8 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements ) -> None: """Regenerate primary access key. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1010,10 +1036,8 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -1026,10 +1050,11 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1042,7 +1067,9 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - regenerate_primary_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regeneratePrimaryKey"} # type: ignore + regenerate_primary_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regeneratePrimaryKey" + } @distributed_trace def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements @@ -1050,7 +1077,8 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements ) -> None: """Regenerate secondary access key. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1073,10 +1101,8 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -1089,10 +1115,11 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1105,7 +1132,9 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - regenerate_secondary_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regenerateSecondaryKey"} # type: ignore + regenerate_secondary_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regenerateSecondaryKey" + } @distributed_trace def list_secrets( @@ -1113,7 +1142,8 @@ def list_secrets( ) -> _models.AccessInformationSecretsContract: """Get tenant access information details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1136,10 +1166,8 @@ def list_secrets( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessInformationSecretsContract] + 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( resource_group_name=resource_group_name, @@ -1152,10 +1180,11 @@ def list_secrets( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1175,4 +1204,6 @@ def list_secrets( return deserialized - list_secrets.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/listSecrets"} # type: ignore + list_secrets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/listSecrets" + } 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 683f189d7913..527b7edc5b2a 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,8 +46,8 @@ def build_deploy_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,9 @@ def build_deploy_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -70,11 +67,11 @@ def build_deploy_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,8 +94,8 @@ def build_save_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +104,9 @@ def build_save_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -116,11 +115,11 @@ def build_save_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -143,8 +142,8 @@ def build_validate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +152,9 @@ def build_validate_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -162,11 +163,11 @@ def build_validate_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -189,7 +190,7 @@ def build_get_sync_state_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +199,9 @@ def build_get_sync_state_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/syncState", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -207,11 +210,11 @@ def build_get_sync_state_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -260,11 +263,9 @@ def _deploy_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.OperationResultContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.OperationResultContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -288,10 +289,11 @@ def _deploy_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -310,7 +312,9 @@ def _deploy_initial( return deserialized - _deploy_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy"} # type: ignore + _deploy_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy" + } @overload def begin_deploy( @@ -326,7 +330,12 @@ def begin_deploy( """This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-configuration-repository-git/#to-deploy-any-service-configuration-changes-to-the-api-management-service-instance + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -366,7 +375,12 @@ def begin_deploy( """This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-configuration-repository-git/#to-deploy-any-service-configuration-changes-to-the-api-management-service-instance + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -404,15 +418,20 @@ def begin_deploy( """This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-configuration-repository-git/#to-deploy-any-service-configuration-changes-to-the-api-management-service-instance + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :param configuration_name: The identifier of the Git Configuration Operation. "configuration" Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName - :param parameters: Deploy Configuration parameters. Is either a model type or a IO type. - Required. + :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. @@ -433,16 +452,14 @@ def begin_deploy( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationResultContract] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationResultContract] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._deploy_initial( # type: ignore + raw_result = self._deploy_initial( resource_group_name=resource_group_name, service_name=service_name, configuration_name=configuration_name, @@ -463,9 +480,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -477,9 +494,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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"} # type: ignore + begin_deploy.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy" + } def _save_initial( self, @@ -500,11 +519,9 @@ def _save_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.OperationResultContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.OperationResultContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -528,10 +545,11 @@ def _save_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -550,7 +568,9 @@ def _save_initial( return deserialized - _save_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save"} # type: ignore + _save_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save" + } @overload def begin_save( @@ -566,7 +586,12 @@ def begin_save( """This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-configuration-repository-git/#to-save-the-service-configuration-to-the-git-repository + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -606,7 +631,12 @@ def begin_save( """This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-configuration-repository-git/#to-save-the-service-configuration-to-the-git-repository + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -644,15 +674,20 @@ def begin_save( """This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + .. seealso:: + - + https://azure.microsoft.com/en-us/documentation/articles/api-management-configuration-repository-git/#to-save-the-service-configuration-to-the-git-repository + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :param configuration_name: The identifier of the Git Configuration Operation. "configuration" Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName - :param parameters: Save Configuration parameters. Is either a model type or a IO type. - Required. + :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. @@ -673,16 +708,14 @@ def begin_save( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationResultContract] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationResultContract] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._save_initial( # type: ignore + raw_result = self._save_initial( resource_group_name=resource_group_name, service_name=service_name, configuration_name=configuration_name, @@ -703,9 +736,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -717,9 +750,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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"} # type: ignore + begin_save.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save" + } def _validate_initial( self, @@ -740,11 +775,9 @@ def _validate_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.OperationResultContract]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.OperationResultContract]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -768,10 +801,11 @@ def _validate_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -790,7 +824,9 @@ def _validate_initial( return deserialized - _validate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate"} # type: ignore + _validate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate" + } @overload def begin_validate( @@ -806,7 +842,8 @@ def begin_validate( """This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -846,7 +883,8 @@ def begin_validate( """This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -884,15 +922,16 @@ def begin_validate( """This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :param configuration_name: The identifier of the Git Configuration Operation. "configuration" Required. :type configuration_name: str or ~azure.mgmt.apimanagement.models.ConfigurationIdName - :param parameters: Validate Configuration parameters. Is either a model type or a IO type. - Required. + :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. @@ -913,16 +952,14 @@ def begin_validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationResultContract] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationResultContract] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._validate_initial( # type: ignore + raw_result = self._validate_initial( resource_group_name=resource_group_name, service_name=service_name, configuration_name=configuration_name, @@ -943,9 +980,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -957,9 +994,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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"} # type: ignore + begin_validate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate" + } @distributed_trace def get_sync_state( @@ -972,7 +1011,8 @@ def get_sync_state( """Gets the status of the most recent synchronization between the configuration database and the Git repository. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -995,10 +1035,8 @@ def get_sync_state( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TenantConfigurationSyncStateContract] + 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( resource_group_name=resource_group_name, @@ -1011,10 +1049,11 @@ def get_sync_state( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1031,4 +1070,6 @@ def get_sync_state( return deserialized - get_sync_state.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/syncState"} # type: ignore + get_sync_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/syncState" + } 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 97a36c8ab1dc..b3ecd1b79f73 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +51,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -65,10 +62,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -91,7 +88,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +97,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings/{settingsType}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -109,11 +108,11 @@ def build_get_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "settingsType": _SERIALIZER.url("settings_type", settings_type, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -149,7 +148,8 @@ def list_by_service( ) -> Iterable["_models.TenantSettingsContract"]: """Public settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -164,10 +164,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TenantSettingsCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TenantSettingsCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -191,7 +189,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -207,7 +205,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -215,14 +213,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TenantSettingsCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -235,7 +234,9 @@ 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"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings" + } @distributed_trace def get( @@ -247,7 +248,8 @@ def get( ) -> _models.TenantSettingsContract: """Get tenant settings. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -269,10 +271,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TenantSettingsContract] + 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( resource_group_name=resource_group_name, @@ -285,10 +285,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -308,4 +309,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings/{settingsType}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings/{settingsType}" + } 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 d28401ff0b91..5f5c557091f9 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +46,7 @@ def build_send_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +55,9 @@ def build_send_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/confirmations/password/send", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -70,10 +67,10 @@ def build_send_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,7 +113,8 @@ def send( # pylint: disable=inconsistent-return-statements ) -> None: """Sends confirmation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -143,10 +141,8 @@ def send( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -160,10 +156,11 @@ def send( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,4 +173,6 @@ def send( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - send.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/confirmations/password/send"} # type: ignore + send.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/confirmations/password/send" + } 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 fee50bef1451..27fb7d2158cd 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,9 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/groups", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -74,10 +71,10 @@ def build_list_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -126,7 +123,8 @@ def list( ) -> Iterable["_models.GroupContract"]: """Lists all user groups. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -153,10 +151,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GroupCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -183,7 +179,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -199,7 +195,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -207,14 +203,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("GroupCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -227,4 +224,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}/groups"} # type: ignore + 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 59c5cd79b2f9..8004ad420d34 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +51,9 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/identities", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -66,10 +63,10 @@ def build_list_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,7 +102,8 @@ def list( ) -> Iterable["_models.UserIdentityContract"]: """List of all user identities. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -121,10 +119,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserIdentityCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UserIdentityCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -148,7 +144,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -164,7 +160,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -172,14 +168,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("UserIdentityCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -192,4 +189,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}/identities"} # type: ignore + 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 c10142942357..522e63171c12 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +50,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,9 @@ def build_list_by_service_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -73,10 +70,10 @@ def build_list_by_service_request( min_length=1, pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -101,7 +98,7 @@ def build_get_entity_tag_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +107,9 @@ def build_get_entity_tag_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -120,10 +119,10 @@ def build_get_entity_tag_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,7 +139,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +148,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -159,10 +160,10 @@ def build_get_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,8 +187,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -196,7 +197,9 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -206,10 +209,10 @@ def build_create_or_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if notify is not None: @@ -232,8 +235,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -242,7 +245,9 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -252,10 +257,10 @@ def build_update_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -284,7 +289,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -293,7 +298,9 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -303,10 +310,10 @@ def build_delete_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if delete_subscriptions is not None: @@ -330,7 +337,7 @@ def build_generate_sso_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -339,7 +346,9 @@ def build_generate_sso_url_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/generateSsoUrl", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -349,10 +358,10 @@ def build_generate_sso_url_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -369,8 +378,8 @@ def build_get_shared_access_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -379,7 +388,9 @@ def build_get_shared_access_token_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/token", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -389,10 +400,10 @@ def build_get_shared_access_token_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -437,7 +448,8 @@ def list_by_service( ) -> Iterable["_models.UserContract"]: """Lists a collection of registered users in the specified service instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -465,10 +477,8 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UserCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -495,7 +505,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -511,7 +521,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -519,14 +529,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("UserCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -539,13 +550,16 @@ 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"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -568,10 +582,8 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, user_id: s _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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( resource_group_name=resource_group_name, @@ -584,10 +596,11 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, user_id: s params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -604,13 +617,16 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, user_id: s return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - get_entity_tag.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}"} # type: ignore + 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. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -633,10 +649,8 @@ def get(self, resource_group_name: str, service_name: str, user_id: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserContract] + 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( resource_group_name=resource_group_name, @@ -649,10 +663,11 @@ def get(self, resource_group_name: str, service_name: str, user_id: str, **kwarg params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -672,7 +687,9 @@ def get(self, resource_group_name: str, service_name: str, user_id: str, **kwarg return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" + } @overload def create_or_update( @@ -689,7 +706,8 @@ def create_or_update( ) -> _models.UserContract: """Creates or Updates a user. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -727,7 +745,8 @@ def create_or_update( ) -> _models.UserContract: """Creates or Updates a user. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -763,14 +782,16 @@ def create_or_update( ) -> _models.UserContract: """Creates or Updates a user. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :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 model type or a IO type. Required. + :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 notify: Send an Email notification to the User. Default value is None. :type notify: bool @@ -796,11 +817,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.UserContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -826,10 +845,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -851,11 +871,13 @@ def create_or_update( deserialized = self._deserialize("UserContract", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" + } @overload def update( @@ -871,7 +893,8 @@ def update( ) -> _models.UserContract: """Updates the details of the user specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -906,7 +929,8 @@ def update( ) -> _models.UserContract: """Updates the details of the user specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -939,7 +963,8 @@ def update( ) -> _models.UserContract: """Updates the details of the user specified by its identifier. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -949,7 +974,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: Update parameters. Is either a model type or a IO type. Required. + :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. @@ -970,11 +996,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserContract] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.UserContract] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -999,10 +1023,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1022,7 +1047,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1038,7 +1065,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes specific user. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1073,10 +1101,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1093,10 +1119,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1109,7 +1136,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}" + } @distributed_trace def generate_sso_url( @@ -1118,7 +1147,8 @@ def generate_sso_url( """Retrieves a redirection URL containing an authentication token for signing a given user into the developer portal. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1141,10 +1171,8 @@ def generate_sso_url( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GenerateSsoUrlResult] + 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( resource_group_name=resource_group_name, @@ -1157,10 +1185,11 @@ def generate_sso_url( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1177,7 +1206,9 @@ def generate_sso_url( return deserialized - generate_sso_url.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/generateSsoUrl"} # type: ignore + generate_sso_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/generateSsoUrl" + } @overload def get_shared_access_token( @@ -1192,7 +1223,8 @@ def get_shared_access_token( ) -> _models.UserTokenResult: """Gets the Shared Access Authorization Token for the User. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1223,7 +1255,8 @@ def get_shared_access_token( ) -> _models.UserTokenResult: """Gets the Shared Access Authorization Token for the User. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -1252,15 +1285,16 @@ def get_shared_access_token( ) -> _models.UserTokenResult: """Gets the Shared Access Authorization Token for the User. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str :param user_id: User identifier. Must be unique in the current API Management service instance. Required. :type user_id: str - :param parameters: Create Authorization Token parameters. Is either a model type or a IO type. - Required. + :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. @@ -1281,11 +1315,9 @@ def get_shared_access_token( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserTokenResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.UserTokenResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1309,10 +1341,11 @@ def get_shared_access_token( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1329,4 +1362,6 @@ def get_shared_access_token( return deserialized - get_shared_access_token.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/token"} # type: ignore + get_shared_access_token.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/token" + } 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 34e7d92f9fef..2e21b683ab62 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,9 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -74,10 +71,10 @@ def build_list_request( pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ), "userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -100,7 +97,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: Literal["2021-08-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +106,9 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions/{sid}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "serviceName": _SERIALIZER.url( "service_name", service_name, @@ -120,10 +119,10 @@ def build_get_request( ), "userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1), "sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -166,7 +165,8 @@ def list( ) -> Iterable["_models.SubscriptionContract"]: """Lists the collection of subscriptions of the specified user. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -197,10 +197,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SubscriptionCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -227,7 +225,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -243,7 +241,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -251,14 +249,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SubscriptionCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -271,7 +270,9 @@ 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"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions" + } @distributed_trace def get( @@ -279,7 +280,8 @@ def get( ) -> _models.SubscriptionContract: """Gets the specified Subscription entity associated with a particular user. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param service_name: The name of the API Management service. Required. :type service_name: str @@ -305,10 +307,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionContract] + 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( resource_group_name=resource_group_name, @@ -322,10 +322,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -345,4 +346,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions/{sid}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions/{sid}" + } 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 9a18226305cf..7492e40cba37 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementApplyNetworkConfigurationUpdates.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementApplyNetworkConfigurationUpdates.json if __name__ == "__main__": main() 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 b296cdd84e2b..d2f8ac2e2763 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 @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementApproveOrRejectPrivateEndpointConnection.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementApproveOrRejectPrivateEndpointConnection.json if __name__ == "__main__": main() 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 457dfdeb22c3..6b1d365d58ad 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementAuthorizationServerListSecrets.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementAuthorizationServerListSecrets.json if __name__ == "__main__": main() 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 ef4aa3d30beb..621304477ee4 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementBackendReconnect.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementBackendReconnect.json if __name__ == "__main__": main() 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 80f510b7f41d..ec5419a0b331 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 @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementBackupWithAccessKey.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementBackupWithAccessKey.json if __name__ == "__main__": main() 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 6827afbab34f..e7d816c752fb 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 @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementBackupWithSystemManagedIdentity.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementBackupWithSystemManagedIdentity.json if __name__ == "__main__": main() 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 e0bba2354139..32f965284c01 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 @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementBackupWithUserAssignedManagedIdentity.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementBackupWithUserAssignedManagedIdentity.json if __name__ == "__main__": main() 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 db8b4ac5847a..976f9f4020a0 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 @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateAILogger.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateAILogger.json if __name__ == "__main__": main() 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 924310d2062f..6487f27b8682 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 @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApi.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApi.json if __name__ == "__main__": main() 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 2140473f1616..e3055bf29703 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 @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiClone.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiClone.json if __name__ == "__main__": main() 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 6fe98722fd37..7e43e7ae20d4 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 @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiDiagnostic.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiDiagnostic.json if __name__ == "__main__": main() 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 012c14b71db2..8ffe83230dbe 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 @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiIssue.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiIssue.json if __name__ == "__main__": main() 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 8ee2380a1c66..37ae507d7a4e 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 @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiIssueAttachment.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiIssueAttachment.json if __name__ == "__main__": main() 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 03e9766b5974..4d1ef0ed8686 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 @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiIssueComment.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiIssueComment.json if __name__ == "__main__": main() 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 dc5952a36947..2309cb158efc 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 @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiNewVersionUsingExistingApi.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiNewVersionUsingExistingApi.json if __name__ == "__main__": main() 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 1ada8febaf25..48c698684a71 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 @@ -63,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiOperation.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiOperation.json if __name__ == "__main__": main() 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 12479ad7ce08..92c845c9115e 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 @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiOperationPolicy.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiOperationPolicy.json if __name__ == "__main__": main() 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 154bfb852043..317444ce252a 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiOperationTag.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiOperationTag.json if __name__ == "__main__": main() 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 7c1bede510eb..2c701d421385 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 @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiPolicy.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiPolicy.json if __name__ == "__main__": main() 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 b59725e3cf4f..46bb78ce8f07 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 @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiPolicyNonXmlEncoded.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiPolicyNonXmlEncoded.json if __name__ == "__main__": main() 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 2fb2d5f43716..99a29c4708ab 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 @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiRelease.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiRelease.json if __name__ == "__main__": main() 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 797ce04bdd7a..e166f8c2a0ef 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 @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiRevisionFromExistingApi.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiRevisionFromExistingApi.json if __name__ == "__main__": main() 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 048819b7da91..862cdb1258a9 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 @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiSchema.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiSchema.json if __name__ == "__main__": main() 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 756800e3551d..742a72a521cb 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiTag.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiTag.json if __name__ == "__main__": main() 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 7886d75e43d4..20bc8f5dd2b9 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 @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiTagDescription.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiTagDescription.json if __name__ == "__main__": main() 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 1092e0d0ff61..678834ec64eb 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 @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiUsingImportOverrideServiceUrl.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiUsingImportOverrideServiceUrl.json if __name__ == "__main__": main() 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 497fb3863c9d..6eb676e3bd1b 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 @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiUsingOai3Import.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiUsingOai3Import.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..169d67373642 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_oai3_import_with_translate_required_query_parameters_conduct.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_create_api_using_oai3_import_with_translate_required_query_parameters_conduct.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.api.begin_create_or_update( + resource_group_name="rg1", + service_name="apimService1", + api_id="petstore", + parameters={ + "properties": { + "format": "openapi-link", + "path": "petstore", + "translateRequiredQueryParameters": "template", + "value": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiUsingOai3ImportWithTranslateRequiredQueryParametersConduct.json +if __name__ == "__main__": + main() 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 356fbac85316..9113a4808ed5 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 @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiUsingSwaggerImport.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiUsingSwaggerImport.json if __name__ == "__main__": main() 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 ba32e61a77ab..481a913375ea 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 @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiUsingWadlImport.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiUsingWadlImport.json if __name__ == "__main__": main() 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 f7f0d08e3c1b..2f845d4df90c 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 @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiVersionSet.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiVersionSet.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..b34cabd43838 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_wiki.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_create_api_wiki.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.api_wiki.create_or_update( + resource_group_name="rg1", + service_name="apimService1", + api_id="57d1f7558aa04f15146d9d8a", + parameters={"properties": {"documents": [{"documentationId": "docId1"}, {"documentationId": "docId2"}]}}, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiWiki.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..ca5dae66891b --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_auth_servers.py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_create_api_with_multiple_auth_servers.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.api.begin_create_or_update( + resource_group_name="rg1", + service_name="apimService1", + api_id="tempgroup", + parameters={ + "properties": { + "authenticationSettings": { + "oAuth2AuthenticationSettings": [ + {"authorizationServerId": "authorizationServerId2283", "scope": "oauth2scope2580"}, + {"authorizationServerId": "authorizationServerId2284", "scope": "oauth2scope2581"}, + ] + }, + "description": "apidescription5200", + "displayName": "apiname1463", + "path": "newapiPath", + "protocols": ["https", "http"], + "serviceUrl": "http://newechoapi.cloudapp.net/api", + "subscriptionKeyParameterNames": {"header": "header4520", "query": "query3037"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiWithMultipleAuthServers.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..9f8f8a5cc1c2 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_open_id_connect_providers.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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_create_api_with_multiple_open_id_connect_providers.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.api.begin_create_or_update( + resource_group_name="rg1", + service_name="apimService1", + api_id="tempgroup", + parameters={ + "properties": { + "authenticationSettings": { + "openidAuthenticationSettings": [ + { + "bearerTokenSendingMethods": ["authorizationHeader"], + "openidProviderId": "openidProviderId2283", + }, + { + "bearerTokenSendingMethods": ["authorizationHeader"], + "openidProviderId": "openidProviderId2284", + }, + ] + }, + "description": "apidescription5200", + "displayName": "apiname1463", + "path": "newapiPath", + "protocols": ["https", "http"], + "serviceUrl": "http://newechoapi.cloudapp.net/api", + "subscriptionKeyParameterNames": {"header": "header4520", "query": "query3037"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiWithMultipleOpenIdConnectProviders.json +if __name__ == "__main__": + main() 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 151357c83831..7e85fe5de01b 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 @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiWithOpenIdConnect.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateApiWithOpenIdConnect.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..0439fa6f1566 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_auth_code.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_create_authorization_aad_auth_code.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.authorization.create_or_update( + resource_group_name="rg1", + service_name="apimService1", + authorization_provider_id="aadwithauthcode", + authorization_id="authz2", + parameters={"properties": {"authorizationType": "OAuth2", "oauth2grantType": "AuthorizationCode"}}, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateAuthorizationAADAuthCode.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..4f0c0da310b3 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_client_cred.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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_create_authorization_aad_client_cred.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.authorization.create_or_update( + resource_group_name="rg1", + service_name="apimService1", + authorization_provider_id="aadwithclientcred", + authorization_id="authz1", + parameters={ + "properties": { + "authorizationType": "OAuth2", + "oauth2grantType": "AuthorizationCode", + "parameters": { + "clientId": "53790925-fdd3-4b80-bc7a-4c3aaf25801d", + "clientSecret": "FcJkQ3iPSaKAQRA7Ft8Q~fZ1X5vKmqzUAfJagcJ8", + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateAuthorizationAADClientCred.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..581ca0b07051 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_access_policy.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_create_authorization_access_policy.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.authorization_access_policy.create_or_update( + resource_group_name="rg1", + service_name="apimService1", + authorization_provider_id="aadwithauthcode", + authorization_id="authz1", + authorization_access_policy_id="fe0bed83-631f-4149-bd0b-0464b1bc7cab", + parameters={ + "properties": { + "objectId": "fe0bed83-631f-4149-bd0b-0464b1bc7cab", + "tenantId": "13932a0d-5c63-4d37-901d-1df9c97722ff", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateAuthorizationAccessPolicy.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..70f57b9bff91 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_auth_code.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_create_authorization_provider_aad_auth_code.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.authorization_provider.create_or_update( + resource_group_name="rg1", + service_name="apimService1", + authorization_provider_id="aadwithauthcode", + parameters={ + "properties": { + "displayName": "aadwithauthcode", + "identityProvider": "aad", + "oauth2": { + "grantTypes": { + "authorizationCode": { + "clientId": "59790825-fdd3-4b10-bc7a-4c3aaf25801d", + "clientSecret": "Q3iPSaKQ~fZFcJk5vKmqzUAfJagcJ8", + "resourceUri": "https://graph.microsoft.com", + "scopes": "User.Read.All Group.Read.All", + } + }, + "redirectUrl": "https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1", + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateAuthorizationProviderAADAuthCode.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..d12ecabe2e68 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_client_cred.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_create_authorization_provider_aad_client_cred.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.authorization_provider.create_or_update( + resource_group_name="rg1", + service_name="apimService1", + authorization_provider_id="aadwithclientcred", + parameters={ + "properties": { + "displayName": "aadwithclientcred", + "identityProvider": "aad", + "oauth2": { + "grantTypes": { + "authorizationCode": { + "resourceUri": "https://graph.microsoft.com", + "scopes": "User.Read.All Group.Read.All", + } + }, + "redirectUrl": "https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1", + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateAuthorizationProviderAADClientCred.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..62b7bb5db2e1 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_generic_oauth2.py @@ -0,0 +1,61 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_create_authorization_provider_generic_oauth2.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.authorization_provider.create_or_update( + resource_group_name="rg1", + service_name="apimService1", + authorization_provider_id="eventbrite", + parameters={ + "properties": { + "displayName": "eventbrite", + "identityProvider": "oauth2", + "oauth2": { + "grantTypes": { + "authorizationCode": { + "authorizationUrl": "https://www.eventbrite.com/oauth/authorize", + "clientId": "ZYIJTBTABHOUQQDLZY", + "clientSecret": "Q3iPSaKQ~fZFcJk5vKmqzUAfJagcJ8", + "refreshUrl": "https://www.eventbrite.com/oauth/token", + "scopes": None, + "tokenUrl": "https://www.eventbrite.com/oauth/token", + } + }, + "redirectUrl": "https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1", + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateAuthorizationProviderGenericOAuth2.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..96229b9cd3eb --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_oob_google.py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_create_authorization_provider_oob_google.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.authorization_provider.create_or_update( + resource_group_name="rg1", + service_name="apimService1", + authorization_provider_id="google", + parameters={ + "properties": { + "displayName": "google", + "identityProvider": "google", + "oauth2": { + "grantTypes": { + "authorizationCode": { + "clientId": "508791967882-5qv6o2i99a75un7329vlegtk78kr766h.apps.googleusercontent.com", + "clientSecret": "qDN0VyVFjU1OsOyT5Kz8ce", + "scopes": "openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email", + } + }, + "redirectUrl": "https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1", + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateAuthorizationProviderOOBGoogle.json +if __name__ == "__main__": + main() 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 7350918050e8..adc7d2ecf439 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 @@ -49,12 +49,14 @@ def main(): "resourceOwnerUsername": "un", "supportState": True, "tokenEndpoint": "https://www.contoso.com/oauth2/token", + "useInApiDocumentation": True, + "useInTestConsole": False, } }, ) print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateAuthorizationServer.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateAuthorizationServer.json if __name__ == "__main__": main() 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 bace07995ff9..790af3318435 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 @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateBackendProxyBackend.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateBackendProxyBackend.json if __name__ == "__main__": main() 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 04c2ab022e17..236e994dec58 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 @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateBackendServiceFabric.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateBackendServiceFabric.json if __name__ == "__main__": main() 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 03fe76b318cd..6c44b1b7cf0f 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 @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateCache.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateCache.json if __name__ == "__main__": main() 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 9e1215258b32..d2dd2585b7da 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 @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateCertificate.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateCertificate.json if __name__ == "__main__": main() 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 1c781480b49e..c3faea8b5137 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 @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateCertificateWithKeyVault.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateCertificateWithKeyVault.json if __name__ == "__main__": main() 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 83f727ce19dd..4ef87b1d6883 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 @@ -33,10 +33,58 @@ def main(): resource_group_name="rg1", service_name="apimService1", content_type_id="page", + parameters={ + "properties": { + "description": "A regular page", + "name": "Page", + "schema": { + "additionalProperties": False, + "properties": { + "en_us": { + "additionalProperties": False, + "properties": { + "description": { + "description": "Page description. This property gets included in SEO attributes.", + "indexed": True, + "title": "Description", + "type": "string", + }, + "documentId": { + "description": "Reference to page content document.", + "title": "Document ID", + "type": "string", + }, + "keywords": { + "description": "Page keywords. This property gets included in SEO attributes.", + "indexed": True, + "title": "Keywords", + "type": "string", + }, + "permalink": { + "description": "Page permalink, e.g. '/about'.", + "indexed": True, + "title": "Permalink", + "type": "string", + }, + "title": { + "description": "Page title. This property gets included in SEO attributes.", + "indexed": True, + "title": "Title", + "type": "string", + }, + }, + "required": ["title", "permalink", "documentId"], + "type": "object", + } + }, + }, + "version": "1.0.0", + } + }, ) print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateContentType.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateContentType.json if __name__ == "__main__": main() 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 fbea79378d6d..204d891f88bd 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 @@ -34,10 +34,21 @@ def main(): service_name="apimService1", content_type_id="page", content_item_id="4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8", + parameters={ + "properties": { + "en_us": { + "description": "Short story about the company.", + "documentId": "contentTypes/document/contentItems/4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8", + "keywords": "company, about", + "permalink": "/about", + "title": "About", + } + } + }, ) print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateContentTypeContentItem.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateContentTypeContentItem.json if __name__ == "__main__": main() 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 27d85e926440..3f456117a896 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 @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateDiagnostic.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateDiagnostic.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..52e03ac662ba --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_documentation.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_create_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, + 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.documentation.create_or_update( + resource_group_name="rg1", + service_name="apimService1", + documentation_id="57d1f7558aa04f15146d9d8a", + parameters={"properties": {"content": "content", "title": "Title"}}, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateDocumentation.json +if __name__ == "__main__": + main() 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 2d21a0f8082a..433ab5da4548 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 @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateEHLogger.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateEHLogger.json if __name__ == "__main__": main() 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 2e1cc671456e..bb142f0318e5 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGateway.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateGateway.json if __name__ == "__main__": main() 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 1d236c49f074..d7aa3428b5c4 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGatewayApi.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateGatewayApi.json if __name__ == "__main__": main() 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 bcf90dbd16de..c7f97243219c 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGatewayCertificateAuthority.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateGatewayCertificateAuthority.json if __name__ == "__main__": main() 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 37407e2d911c..fe3e5fd4808b 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 @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGatewayHostnameConfiguration.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateGatewayHostnameConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_schema1.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema1.py similarity index 94% rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_schema1.py rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema1.py index e54e25e33730..868cd462c37e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_schema1.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema1.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-apimanagement # USAGE - python api_management_create_schema1.py + python api_management_create_global_schema1.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, @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGlobalSchema1.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateGlobalSchema1.json if __name__ == "__main__": main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_schema2.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema2.py similarity index 94% rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_schema2.py rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema2.py index 85cb27a76c57..87c9d3a6706b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_schema2.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema2.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-apimanagement # USAGE - python api_management_create_schema2.py + python api_management_create_global_schema2.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, @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGlobalSchema2.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateGlobalSchema2.json if __name__ == "__main__": main() 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 3ee098e7d2b6..3d7e92d8cb26 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 @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGraphQLApi.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateGraphQLApi.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..f016ac58ebb2 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_create_graph_ql_api_resolver.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.graph_ql_api_resolver.create_or_update( + resource_group_name="rg1", + service_name="apimService1", + api_id="someAPI", + resolver_id="newResolver", + parameters={ + "properties": { + "description": "A GraphQL Resolver example", + "displayName": "Query Users", + "path": "Query/users", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateGraphQLApiResolver.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..3901da4cadad --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver_policy.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_create_graph_ql_api_resolver_policy.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.graph_ql_api_resolver_policy.create_or_update( + resource_group_name="rg1", + service_name="apimService1", + api_id="5600b57e7e8880006a040001", + resolver_id="5600b57e7e8880006a080001", + policy_id="policy", + parameters={ + "properties": { + "format": "xml", + "value": 'GET/api/users', + } + }, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateGraphQLApiResolverPolicy.json +if __name__ == "__main__": + main() 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 4d319ea8bac6..89b0dc6c14fc 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGroup.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateGroup.json if __name__ == "__main__": main() 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 3b4c1f080951..87c6d7fcf92e 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 @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGroupExternal.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateGroupExternal.json if __name__ == "__main__": main() 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 33d3c78a69f0..fccd7e1a9290 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGroupUser.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateGroupUser.json if __name__ == "__main__": main() 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 7a007e4fad22..18865a3c76c5 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateIdentityProvider.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateIdentityProvider.json if __name__ == "__main__": main() 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 1d280aeec124..af9927ff63a2 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 @@ -71,6 +71,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateMultiRegionServiceWithCustomHostname.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateMultiRegionServiceWithCustomHostname.json if __name__ == "__main__": main() 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 fd88a355e2e8..69b25fdf44ff 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 @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateNamedValue.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateNamedValue.json if __name__ == "__main__": main() 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 e01e01a100fb..3b94f2077706 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 @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateNamedValueWithKeyVault.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateNamedValueWithKeyVault.json if __name__ == "__main__": main() 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 3516bafff0d4..433bb563443a 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateNotification.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateNotification.json if __name__ == "__main__": main() 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 5cec32ab36a5..4f30d7d19f55 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateNotificationRecipientEmail.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateNotificationRecipientEmail.json if __name__ == "__main__": main() 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 43044481046f..699043f63ec4 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateNotificationRecipientUser.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateNotificationRecipientUser.json if __name__ == "__main__": main() 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 1e6482a0c9a8..ab0837f0cf4c 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 @@ -39,12 +39,14 @@ def main(): "clientSecret": "x", "displayName": "templateoidprovider3", "metadataEndpoint": "https://oidprovider-template3.net", + "useInApiDocumentation": True, + "useInTestConsole": False, } }, ) print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateOpenIdConnectProvider.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateOpenIdConnectProvider.json if __name__ == "__main__": main() 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 e9742a11517c..9b4c24c8f5cb 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 @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreatePolicy.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreatePolicy.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..55a1dcc14e32 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy_fragment.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_create_policy_fragment.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.policy_fragment.begin_create_or_update( + resource_group_name="rg1", + service_name="apimService1", + id="policyFragment1", + parameters={ + "properties": { + "description": "A policy fragment example", + "format": "xml", + "value": '', + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreatePolicyFragment.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..4eeb4148d680 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_config.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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_create_portal_config.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.portal_config.create_or_update( + resource_group_name="rg1", + service_name="apimService1", + portal_config_id="default", + if_match="*", + parameters={ + "properties": { + "cors": {"allowedOrigins": ["https://contoso.com"]}, + "csp": { + "allowedSources": ["*.contoso.com"], + "mode": "reportOnly", + "reportUri": ["https://report.contoso.com"], + }, + "delegation": { + "delegateRegistration": False, + "delegateSubscription": False, + "delegationUrl": None, + "validationKey": None, + }, + "enableBasicAuth": True, + "signin": {"require": False}, + "signup": { + "termsOfService": {"requireConsent": False, "text": "I agree to the service terms and conditions."} + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreatePortalConfig.json +if __name__ == "__main__": + main() 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 62a2fe25030a..73e310fb6d9b 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreatePortalRevision.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreatePortalRevision.json if __name__ == "__main__": main() 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 073350be7df7..c77e2b02e86d 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateProduct.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateProduct.json if __name__ == "__main__": main() 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 471de8a231d6..ab4c4248c5e1 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateProductApi.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateProductApi.json if __name__ == "__main__": main() 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 a906ed19af38..06d29c486b42 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateProductGroup.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateProductGroup.json if __name__ == "__main__": main() 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 92cadbac4fbf..30c59b32f27d 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 @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateProductPolicy.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateProductPolicy.json if __name__ == "__main__": main() 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 dd925a9faceb..2094e08d3989 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateProductTag.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateProductTag.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..2608f17ebbcc --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_wiki.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_create_product_wiki.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.product_wiki.create_or_update( + resource_group_name="rg1", + service_name="apimService1", + product_id="57d1f7558aa04f15146d9d8a", + parameters={"properties": {"documents": [{"documentationId": "docId1"}, {"documentationId": "docId2"}]}}, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateProductWiki.json +if __name__ == "__main__": + main() 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 5e5409801a04..29308687eaff 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 @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateService.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateService.json if __name__ == "__main__": main() 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 1ad3fdb5d01e..ed3bca909c87 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 @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateServiceHavingMsi.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateServiceHavingMsi.json if __name__ == "__main__": main() 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 a87fe1aefdc4..e25dbdab6afc 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 @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateServiceInVnetWithPublicIP.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateServiceInVnetWithPublicIP.json if __name__ == "__main__": main() 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 a74963e33607..8a41d6a2d3a9 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 @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateServiceInZones.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateServiceInZones.json if __name__ == "__main__": main() 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 4b3364dae9fb..de6af52a8d72 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 @@ -74,6 +74,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateServiceWithCustomHostnameKeyVault.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateServiceWithCustomHostnameKeyVault.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..f2bbd8c1a109 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_nat_gateway_enabled.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_create_service_with_nat_gateway_enabled.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.api_management_service.begin_create_or_update( + resource_group_name="rg1", + service_name="apimService1", + parameters={ + "location": "East US", + "properties": { + "natGatewayState": "Enabled", + "publisherEmail": "apim@autorestsdk.com", + "publisherName": "autorestsdk", + }, + "sku": {"capacity": 1, "name": "Premium"}, + "tags": {"tag1": "value1", "tag2": "value2", "tag3": "value3"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateServiceWithNatGatewayEnabled.json +if __name__ == "__main__": + main() 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 624409f404f5..3cf7d4008459 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 @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateServiceWithSystemCertificates.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateServiceWithSystemCertificates.json if __name__ == "__main__": main() 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 11b115e40d28..189b15af1160 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 @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateServiceWithUserAssignedIdentity.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateServiceWithUserAssignedIdentity.json if __name__ == "__main__": main() 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 21430ff88810..a20b87eaf92c 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 @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateSoapPassThroughApiUsingWsdlImport.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateSoapPassThroughApiUsingWsdlImport.json if __name__ == "__main__": main() 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 44f5faff830f..ae13f20c1261 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 @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateSoapToRestApiUsingWsdlImport.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateSoapToRestApiUsingWsdlImport.json if __name__ == "__main__": main() 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 fe46ca95bd65..748c0404a0f0 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 @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateSubscription.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateSubscription.json if __name__ == "__main__": main() 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 f9a0b4f64f2b..b54b13372eab 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateTag.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateTag.json if __name__ == "__main__": main() 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 86eba0da95c6..8e49d287db91 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateTemplate.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateTemplate.json if __name__ == "__main__": main() 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 a2a7bc08c52c..f5670deb29b8 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateTenantAccess.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateTenantAccess.json if __name__ == "__main__": main() 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 509fa3aa7927..e016be80127a 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 @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateUser.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateUser.json if __name__ == "__main__": main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_web_socket_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_websocket_api.py similarity index 92% rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_web_socket_api.py rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_websocket_api.py index c573e4f84b03..f35086d450bc 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_web_socket_api.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_websocket_api.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-apimanagement # USAGE - python api_management_create_web_socket_api.py + python api_management_create_websocket_api.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, @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateWebsocketApi.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementCreateWebsocketApi.json if __name__ == "__main__": main() 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 fdb2121ebacf..8195a60edbcd 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApi.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteApi.json if __name__ == "__main__": main() 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 fed262e8b393..0f60217c1336 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiDiagnostic.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteApiDiagnostic.json if __name__ == "__main__": main() 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 72d7cd712df6..a10cb0ab27c1 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiIssue.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteApiIssue.json if __name__ == "__main__": main() 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 f6050e7d4781..f890f79e61de 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 @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiIssueAttachment.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteApiIssueAttachment.json if __name__ == "__main__": main() 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 1cb77d84b19b..e0038b1bfae8 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 @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiIssueComment.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteApiIssueComment.json if __name__ == "__main__": main() 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 dd5bd5c68f6d..8d4efa3ca16c 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiOperation.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteApiOperation.json if __name__ == "__main__": main() 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 0c750ce0090b..926fc6dc8fc7 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 @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiOperationPolicy.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteApiOperationPolicy.json if __name__ == "__main__": main() 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 776463dc0416..9d1c82de787f 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiOperationTag.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteApiOperationTag.json if __name__ == "__main__": main() 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 4556bc2067c8..1e3f5928103f 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiPolicy.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteApiPolicy.json if __name__ == "__main__": main() 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 fc8f70a11721..29715a6c4b16 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiRelease.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteApiRelease.json if __name__ == "__main__": main() 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 f0538e54b8b4..c7362ba83892 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiSchema.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteApiSchema.json if __name__ == "__main__": main() 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 6f0e6f2789fb..a0ea692ffccd 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiTag.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteApiTag.json if __name__ == "__main__": main() 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 83f8064e095e..b0ccd37bf7a9 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiTagDescription.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteApiTagDescription.json if __name__ == "__main__": main() 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 1c0be5cbc587..28016f0190af 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiVersionSet.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteApiVersionSet.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..51ddcf4df4d0 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_wiki.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_delete_api_wiki.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.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/preview/2022-09-01-preview/examples/ApiManagementDeleteApiWiki.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..94fd40909147 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_delete_authorization.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.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/preview/2022-09-01-preview/examples/ApiManagementDeleteAuthorization.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..327a8ce355c0 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_access_policy.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_delete_authorization_access_policy.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.authorization_access_policy.delete( + resource_group_name="rg1", + service_name="apimService1", + authorization_provider_id="aadwithauthcode", + authorization_id="authz1", + authorization_access_policy_id="fe0bed83-631f-4149-bd0b-0464b1bc7cab", + if_match="*", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteAuthorizationAccessPolicy.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..4494a584ee2e --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_provider.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_delete_authorization_provider.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.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/preview/2022-09-01-preview/examples/ApiManagementDeleteAuthorizationProvider.json +if __name__ == "__main__": + main() 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 35b29bc5a163..6300a5ecb946 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteAuthorizationServer.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteAuthorizationServer.json if __name__ == "__main__": main() 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 5ad894893083..47cfa551892e 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteBackend.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteBackend.json if __name__ == "__main__": main() 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 16b10e26b96c..7484a2393cfe 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteCache.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteCache.json if __name__ == "__main__": main() 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 368c13883f7d..4f1978a077cc 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteCertificate.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteCertificate.json if __name__ == "__main__": main() 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 6204deb123f6..5fe69b737bb5 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteContentType.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteContentType.json if __name__ == "__main__": main() 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 2ef593bf9e62..e46f8edfa407 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteContentTypeContentItem.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteContentTypeContentItem.json if __name__ == "__main__": main() 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 d23e1501f32a..d38bfebbf1a7 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteDiagnostic.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteDiagnostic.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 5ea868c11782..b726ecc34014 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGateway.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteGateway.json if __name__ == "__main__": main() 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 0610a996c36e..f801552f0684 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGatewayApi.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteGatewayApi.json if __name__ == "__main__": main() 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 1965fd7bffbf..b3ed15d44b0f 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGatewayCertificateAuthority.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteGatewayCertificateAuthority.json if __name__ == "__main__": main() 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 a9da051500cc..31bcf60ee447 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGatewayHostnameConfiguration.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteGatewayHostnameConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_global_schema.py similarity index 90% rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_schema.py rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_global_schema.py index b1e7308de0eb..f735bed3456c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_schema.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_global_schema.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-apimanagement # USAGE - python api_management_delete_schema.py + python api_management_delete_global_schema.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, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGlobalSchema.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteGlobalSchema.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..c00237c8eb35 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_delete_graph_ql_api_resolver.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.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/preview/2022-09-01-preview/examples/ApiManagementDeleteGraphQLApiResolver.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..52e88837999d --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver_policy.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_delete_graph_ql_api_resolver_policy.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.graph_ql_api_resolver_policy.delete( + resource_group_name="rg1", + service_name="apimService1", + api_id="testapi", + resolver_id="testResolver", + policy_id="policy", + if_match="*", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteGraphQLApiResolverPolicy.json +if __name__ == "__main__": + main() 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 aff35da8c53c..9b76bb86c64a 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGroup.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteGroup.json if __name__ == "__main__": main() 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 4c90f14959ec..b721129252d1 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGroupUser.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteGroupUser.json if __name__ == "__main__": main() 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 c5bf99819d98..46d3bc464a87 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteIdentityProvider.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteIdentityProvider.json if __name__ == "__main__": main() 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 afca5006422e..7846e23999d1 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteLogger.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteLogger.json if __name__ == "__main__": main() 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 949f595f5ac5..65b62fa0b645 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteNamedValue.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteNamedValue.json if __name__ == "__main__": main() 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 0fcda098b60e..e402bc035dc5 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteNotificationRecipientEmail.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteNotificationRecipientEmail.json if __name__ == "__main__": main() 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 5aa43b0e658c..7e610e5e0d61 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteNotificationRecipientUser.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteNotificationRecipientUser.json if __name__ == "__main__": main() 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 5595180ffea1..8604c262d031 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteOpenIdConnectProvider.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteOpenIdConnectProvider.json if __name__ == "__main__": main() 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 4ddea656a598..a33b6148e97b 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeletePolicy.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeletePolicy.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..f98da6f5b2d2 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy_fragment.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_delete_policy_fragment.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.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/preview/2022-09-01-preview/examples/ApiManagementDeletePolicyFragment.json +if __name__ == "__main__": + main() 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 9e4ea71f2424..ffecce24aad3 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeletePrivateEndpointConnection.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeletePrivateEndpointConnection.json if __name__ == "__main__": main() 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 a762bfe93451..a2b47b8c05da 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteProduct.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteProduct.json if __name__ == "__main__": main() 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 2d6d57f6d488..491d9f49bf40 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteProductApi.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteProductApi.json if __name__ == "__main__": main() 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 416594fdcf15..3e1319bd0462 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteProductGroup.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteProductGroup.json if __name__ == "__main__": main() 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 fefa522e3940..ad1059871376 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteProductPolicy.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteProductPolicy.json if __name__ == "__main__": main() 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 d07cb4e05975..8c5bba49430f 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteProductTag.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteProductTag.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..c9265aaa2428 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_wiki.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_delete_product_wiki.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.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/preview/2022-09-01-preview/examples/ApiManagementDeleteProductWiki.json +if __name__ == "__main__": + main() 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 0d5045ecfc0f..a88899e29644 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteSubscription.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteSubscription.json if __name__ == "__main__": main() 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 3fbb7f193868..89e96d681c79 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteTag.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteTag.json if __name__ == "__main__": main() 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 9a93e7360372..24eae5799584 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteTemplate.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteTemplate.json if __name__ == "__main__": main() 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 522884c2507f..106fc9e85114 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteUser.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteUser.json if __name__ == "__main__": main() 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 0d9a47ff5833..0252d5c2497f 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 @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeletedServicesListBySubscription.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeletedServicesListBySubscription.json if __name__ == "__main__": main() 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 3c093d85ba18..afa2f18c02f5 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeletedServicesPurge.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeletedServicesPurge.json if __name__ == "__main__": main() 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 64fe4ff6cf4c..3834bee44783 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGatewayGenerateToken.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGatewayGenerateToken.json if __name__ == "__main__": main() 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 5155cd99fcd0..a5abaf63fe1f 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGatewayListKeys.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGatewayListKeys.json if __name__ == "__main__": main() 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 63fbd1411ca8..fcd845ff2d0f 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGatewayRegenerateKey.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGatewayRegenerateKey.json if __name__ == "__main__": main() 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 a4bd8e18e425..0aec0c9958e6 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiContract.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiContract.json if __name__ == "__main__": main() 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 83168f03a65b..6d8771a12091 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiDiagnostic.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiDiagnostic.json if __name__ == "__main__": main() 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 4d1cd2d76a86..9e9edca9be55 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiExportInOpenApi2dot0.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiExportInOpenApi2dot0.json if __name__ == "__main__": main() 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 e92557f9fa9f..e93e34e98b80 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiExportInOpenApi3dot0.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiExportInOpenApi3dot0.json if __name__ == "__main__": main() 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 afcde8ec72fd..1bae4b31ab5c 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssue.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiIssue.json if __name__ == "__main__": main() 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 143e4ff14003..4de27d64ff10 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssueAttachment.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiIssueAttachment.json if __name__ == "__main__": main() 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 b6779069198f..ddaa0b49b830 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssueComment.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiIssueComment.json if __name__ == "__main__": main() 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 aeaaa1ea63c7..d621d7d83c3e 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperation.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiOperation.json if __name__ == "__main__": main() 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 2c02f650226c..c97ff76f6a84 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationPetStore.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiOperationPetStore.json if __name__ == "__main__": main() 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 20feee254d3c..7ce884e98f80 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationPolicy.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiOperationPolicy.json if __name__ == "__main__": main() 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 5936c5ad218d..db722f0b606a 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationTag.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiOperationTag.json if __name__ == "__main__": main() 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 c29a5164c49e..ba0b1345fe03 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiPolicy.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiPolicy.json if __name__ == "__main__": main() 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 65fa959acc89..9b6cf670932d 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRelease.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiRelease.json if __name__ == "__main__": main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_revision_contract.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_revision.py similarity index 91% rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_revision_contract.py rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_revision.py index b425a4bb707c..cde9fa056444 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_revision_contract.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_revision.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-apimanagement # USAGE - python api_management_get_api_revision_contract.py + python api_management_get_api_revision.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, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRevision.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiRevision.json if __name__ == "__main__": main() 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 b77aac4a15b7..4bf22cc71424 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiSchema.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiSchema.json if __name__ == "__main__": main() 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 c729d9599f80..79bb7e768a95 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiTag.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiTag.json if __name__ == "__main__": main() 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 e62bc2c99f3c..97162201e842 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiTagDescription.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiTagDescription.json if __name__ == "__main__": main() 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 fa985c1c245a..06dbddfa719f 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiVersionSet.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiVersionSet.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..3dc269e76bef --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_wiki.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_get_api_wiki.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.api_wiki.get( + resource_group_name="rg1", + service_name="apimService1", + api_id="57d1f7558aa04f15146d9d8a", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetApiWiki.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..e4641d8373eb --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_get_authorization.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.authorization.get( + resource_group_name="rg1", + service_name="apimService1", + authorization_provider_id="aadwithauthcode", + authorization_id="authz1", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetAuthorization.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..ae50b417cec6 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_access_policy.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_get_authorization_access_policy.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.authorization_access_policy.get( + resource_group_name="rg1", + service_name="apimService1", + authorization_provider_id="aadwithauthcode", + authorization_id="authz1", + authorization_access_policy_id="fe0bed83-631f-4149-bd0b-0464b1bc7cab", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetAuthorizationAccessPolicy.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..570568c10f8f --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_login_request.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_get_authorization_login_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.authorization_login_links.post( + resource_group_name="rg1", + service_name="apimService1", + authorization_provider_id="aadwithauthcode", + authorization_id="authz1", + parameters={"postLoginRedirectUrl": "https://www.bing.com/"}, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetAuthorizationLoginRequest.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..4d05ac46e0bb --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_provider.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_get_authorization_provider.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.authorization_provider.get( + resource_group_name="rg1", + service_name="apimService1", + authorization_provider_id="aadwithauthcode", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetAuthorizationProvider.json +if __name__ == "__main__": + main() 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 2cc6168b851e..49ab0a9050e0 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetAuthorizationServer.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetAuthorizationServer.json if __name__ == "__main__": main() 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 0d1e9fd08bd7..c12da60b55ea 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetBackend.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetBackend.json if __name__ == "__main__": main() 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 f18af521a1b9..1885fe32e6dc 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCache.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetCache.json if __name__ == "__main__": main() 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 04de3a3262b3..41d7cd77e029 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCertificate.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetCertificate.json if __name__ == "__main__": main() 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 b315560eadb2..c9782389772a 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCertificateWithKeyVault.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetCertificateWithKeyVault.json if __name__ == "__main__": main() 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 e2a7b607291c..3f173d40c52a 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetContentType.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetContentType.json if __name__ == "__main__": main() 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 c360435cade2..7e6393165c23 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetContentTypeContentItem.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetContentTypeContentItem.json if __name__ == "__main__": main() 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 e0456001a1d3..8221dfa63d66 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetDeletedServiceByName.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetDeletedServiceByName.json if __name__ == "__main__": main() 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 3384a73a72d6..0608a6457a9c 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetDiagnostic.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetDiagnostic.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..b2fccdd2f3ae --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_documentation.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_get_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, + 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.documentation.get( + resource_group_name="rg1", + service_name="apimService1", + documentation_id="57d1f7558aa04f15146d9d8a", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetDocumentation.json +if __name__ == "__main__": + main() 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 6f4378e91c74..db6a88da1d7e 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGateway.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetGateway.json if __name__ == "__main__": main() 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 66bf43c49eb7..42f4375dcf6b 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGatewayCertificateAuthority.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetGatewayCertificateAuthority.json if __name__ == "__main__": main() 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 20d5f7949c84..cb084f9dcc65 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGatewayHostnameConfiguration.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetGatewayHostnameConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_schema1.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema1.py similarity index 90% rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_schema1.py rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema1.py index b0a7038fd501..5814a6ad14e7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_schema1.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema1.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-apimanagement # USAGE - python api_management_get_schema1.py + python api_management_get_global_schema1.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, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGlobalSchema1.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetGlobalSchema1.json if __name__ == "__main__": main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_schema2.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema2.py similarity index 90% rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_schema2.py rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema2.py index f0784c459c43..3dfc83f74421 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_schema2.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema2.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-apimanagement # USAGE - python api_management_get_schema2.py + python api_management_get_global_schema2.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, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGlobalSchema2.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetGlobalSchema2.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..9811cf243f26 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_get_graph_ql_api_resolver.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.graph_ql_api_resolver.get( + resource_group_name="rg1", + service_name="apimService1", + api_id="57d2ef278aa04f0888cba3f3", + resolver_id="57d2ef278aa04f0ad01d6cdc", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetGraphQLApiResolver.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..4dc92cc822a1 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver_policy.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_get_graph_ql_api_resolver_policy.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.graph_ql_api_resolver_policy.get( + resource_group_name="rg1", + service_name="apimService1", + api_id="5600b539c53f5b0062040001", + resolver_id="5600b53ac53f5b0062080006", + policy_id="policy", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetGraphQLApiResolverPolicy.json +if __name__ == "__main__": + main() 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 df9ac588d3fe..0cf47c39fbf8 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGroup.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetGroup.json if __name__ == "__main__": main() 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 f88e99c12175..9e6d7f515088 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetIdentityProvider.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetIdentityProvider.json if __name__ == "__main__": main() 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 f1dbc124d2e8..65fd5abc0669 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetIssue.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetIssue.json if __name__ == "__main__": main() 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 630b5ec9dea0..51add25e572d 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetLogger.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetLogger.json if __name__ == "__main__": main() 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 3999accc6e02..696aeef2cdf5 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNamedValue.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetNamedValue.json if __name__ == "__main__": main() 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 a25c8229ed4f..21cb48ba3f38 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNamedValueWithKeyVault.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetNamedValueWithKeyVault.json if __name__ == "__main__": main() 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 944778960ea6..dc8b64805d9a 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNotification.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetNotification.json if __name__ == "__main__": main() 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 15faa6553da2..ede618770ab4 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetOpenIdConnectProvider.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetOpenIdConnectProvider.json if __name__ == "__main__": main() 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 45f316572fac..9eb427e8d8d1 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPolicy.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetPolicy.json if __name__ == "__main__": main() 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 bbe0630c7cc7..15df236ae6de 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPolicyFormat.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetPolicyFormat.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..591f96bb2a50 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_get_policy_fragment.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.policy_fragment.get( + resource_group_name="rg1", + service_name="apimService1", + id="policyFragment1", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetPolicyFragment.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..920bd712f0db --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment_format.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_get_policy_fragment_format.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.policy_fragment.get( + resource_group_name="rg1", + service_name="apimService1", + id="policyFragment1", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetPolicyFragmentFormat.json +if __name__ == "__main__": + main() 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 75b8cfc33fe5..da172cf56f5f 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPortalRevision.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetPortalRevision.json if __name__ == "__main__": main() 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 320b79591c02..7a3b800dfc99 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPrivateEndpointConnection.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetPrivateEndpointConnection.json if __name__ == "__main__": main() 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 fb43c9b56e48..d13e4c965859 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPrivateLinkGroupResource.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetPrivateLinkGroupResource.json if __name__ == "__main__": main() 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 669528e1464c..8b95ba53c124 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProduct.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetProduct.json if __name__ == "__main__": main() 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 be44a68fa64e..f37186ad9d6e 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProductPolicy.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetProductPolicy.json if __name__ == "__main__": main() 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 e3318f993223..bdd2d8f1b96b 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProductTag.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetProductTag.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..3d97684ead5b --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_wiki.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_get_product_wiki.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.product_wiki.get( + resource_group_name="rg1", + service_name="apimService1", + product_id="57d1f7558aa04f15146d9d8a", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetProductWiki.json +if __name__ == "__main__": + main() 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 682fa7e85c21..a22dfe82251d 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetQuotaCounterKeys.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetQuotaCounterKeys.json if __name__ == "__main__": main() 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 3e75899b2571..2401d07f8619 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetQuotaCounterKeysByQuotaPeriod.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetQuotaCounterKeysByQuotaPeriod.json if __name__ == "__main__": main() 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_get_reports_by_api.py index 993ca0604015..4d333d88d906 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_get_reports_by_api.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByApi.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetReportsByApi.json if __name__ == "__main__": main() 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 index 3b301b702dd4..6e99dd5e4020 100644 --- 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByGeo.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/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 index 24881996351a..7e545b6425f5 100644 --- 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByOperation.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/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 index 14ab84e4e254..6c6c8799d815 100644 --- 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByProduct.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/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 index 49ed21159b96..59e07bb85d2c 100644 --- 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByRequest.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/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 index ed666bb2f8b5..953b9a577edf 100644 --- 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsBySubscription.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetReportsBySubscription.json if __name__ == "__main__": main() 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_get_reports_by_time.py index 22172e8c4ac8..24c95e6af551 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_get_reports_by_time.py @@ -6,6 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import isodate + from azure.identity import DefaultAzureCredential from azure.mgmt.apimanagement import ApiManagementClient @@ -33,12 +35,12 @@ def main(): 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="PT15M", + interval=isodate.parse_duration("PT15M"), ) for item in response: print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByTime.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetReportsByTime.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 index b71afcedb3b8..731d45465e71 100644 --- 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByUser.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/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 6e432b99e1a2..bc72913cd6d4 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetSubscription.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetSubscription.json if __name__ == "__main__": main() 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 2671c084bfe2..1ea33cec4f90 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTag.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetTag.json if __name__ == "__main__": main() 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 4b7a90236755..84483fc06051 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTemplate.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetTemplate.json if __name__ == "__main__": main() 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 239fe6c7f941..7eba7a18ee7d 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantAccess.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetTenantAccess.json if __name__ == "__main__": main() 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 2160185dd075..5746548833e5 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantGitAccess.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetTenantGitAccess.json if __name__ == "__main__": main() 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 f4d6ea340737..385ea805196f 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantSettings.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetTenantSettings.json if __name__ == "__main__": main() 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 5dbe4a19cdc2..2b21aa26e8e1 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetUser.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetUser.json if __name__ == "__main__": main() 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 92de18c1adee..b95d3681120d 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetUserSubscription.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementGetUserSubscription.json if __name__ == "__main__": main() 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 9a6889251d15..a6eb493b5bcc 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApi.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadApi.json if __name__ == "__main__": main() 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 89c880924f47..b5b72cc0cbfa 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiDiagnostic.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadApiDiagnostic.json if __name__ == "__main__": main() 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 5717d399a022..bc3b594032d8 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiIssue.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadApiIssue.json if __name__ == "__main__": main() 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 fda60f8de0b4..ffc39fe1354a 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiIssueAttachment.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadApiIssueAttachment.json if __name__ == "__main__": main() 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 71171b85d802..9d13374b723b 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiIssueComment.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadApiIssueComment.json if __name__ == "__main__": main() 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 a816f136b518..b2ca1d1c4fbb 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiOperation.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadApiOperation.json if __name__ == "__main__": main() 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 c4080e717790..01f14026a1ee 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiOperationPolicy.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadApiOperationPolicy.json if __name__ == "__main__": main() 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 89d91898e5ce..39a1deda39ca 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiOperationTag.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadApiOperationTag.json if __name__ == "__main__": main() 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 8b686bdaa757..70cb9edd6f34 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiPolicy.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadApiPolicy.json if __name__ == "__main__": main() 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 90098144d9da..bbdbfab1a2ab 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiRelease.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadApiRelease.json if __name__ == "__main__": main() 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 fa6e98c99635..1cacaeda989f 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiSchema.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadApiSchema.json if __name__ == "__main__": main() 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 27b4ab828f50..f1c5c987e8c3 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiTag.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadApiTag.json if __name__ == "__main__": main() 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 a83b6971427f..31a6ea3b6a81 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiTagDescription.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadApiTagDescription.json if __name__ == "__main__": main() 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 93cf70860407..bcfe38879ec4 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiVersionSet.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadApiVersionSet.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..4c064b5ca528 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_wiki.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_head_api_wiki.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.api_wiki.get_entity_tag( + resource_group_name="rg1", + service_name="apimService1", + api_id="57d1f7558aa04f15146d9d8a", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadApiWiki.json +if __name__ == "__main__": + main() 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 369fb18226dc..6d427154e185 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadAuthorizationServer.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadAuthorizationServer.json if __name__ == "__main__": main() 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 f3aef15f052b..a4c03083e792 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadBackend.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadBackend.json if __name__ == "__main__": main() 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 6ee2d53a4c6e..029f915ff086 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadCache.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadCache.json if __name__ == "__main__": main() 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 01155ea3d400..a4d3a6ce581f 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadCertificate.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadCertificate.json if __name__ == "__main__": main() 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 728a732c7700..23d9cdedf336 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadContentTypeContentItem.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadContentTypeContentItem.json if __name__ == "__main__": main() 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 770e453e8530..86f71351a33b 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadDelegationSettings.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadDelegationSettings.json if __name__ == "__main__": main() 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 9f93d21103db..17fa99af125a 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadDiagnostic.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadDiagnostic.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..eca9b497b347 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_documentation.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_head_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, + 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.documentation.get_entity_tag( + resource_group_name="rg1", + service_name="apimService1", + documentation_id="57d1f7558aa04f15146d9d8a", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadDocumentation.json +if __name__ == "__main__": + main() 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 493dd05a1a98..4b2d58c01c14 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadEmailTemplate.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadEmailTemplate.json if __name__ == "__main__": main() 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 c8a1cccbd33d..d591bcd45f98 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGateway.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadGateway.json if __name__ == "__main__": main() 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 8ab3cae92355..54f7faeae27c 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGatewayApi.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadGatewayApi.json if __name__ == "__main__": main() 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 d2d5e9dfe745..2f601a035791 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGatewayCertificateAuthority.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadGatewayCertificateAuthority.json if __name__ == "__main__": main() 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 1f98c50a7d68..3d22cd3ec587 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGatewayHostnameConfiguration.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadGatewayHostnameConfiguration.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..7e32e700d067 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_global_schema.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_head_global_schema.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.global_schema.get_entity_tag( + resource_group_name="rg1", + service_name="apimService1", + schema_id="myschema", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadGlobalSchema.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..49591ad137a2 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_head_graph_ql_api_resolver.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.graph_ql_api_resolver.get_entity_tag( + resource_group_name="rg1", + service_name="apimService1", + api_id="57d2ef278aa04f0888cba3f3", + resolver_id="57d2ef278aa04f0ad01d6cdc", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadGraphQLApiResolver.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..504cc8fc1579 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver_policy.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_head_graph_ql_api_resolver_policy.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.graph_ql_api_resolver_policy.get_entity_tag( + resource_group_name="rg1", + service_name="apimService1", + api_id="5600b539c53f5b0062040001", + resolver_id="5600b53ac53f5b0062080006", + policy_id="policy", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadGraphQLApiResolverPolicy.json +if __name__ == "__main__": + main() 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 258a7a2b0b4f..65d3e9b144d2 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGroup.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadGroup.json if __name__ == "__main__": main() 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 92a93af12882..c814ef9b4db7 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGroupUser.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadGroupUser.json if __name__ == "__main__": main() 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 d0b20c6dee29..2b3ceb69512c 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadIdentityProvider.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadIdentityProvider.json if __name__ == "__main__": main() 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 aea59443d465..8b0a3e1d9fe8 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadLogger.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadLogger.json if __name__ == "__main__": main() 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 7e6c35254590..de235a45bdc0 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadNamedValue.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadNamedValue.json if __name__ == "__main__": main() 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 d9d00bef6c68..46ba18388625 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadNotificationRecipientEmail.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadNotificationRecipientEmail.json if __name__ == "__main__": main() 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 9f67068e9689..d7b6d95ccff5 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadNotificationRecipientUser.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadNotificationRecipientUser.json if __name__ == "__main__": main() 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 cee7f6ae7ff5..4ab7c9cdaf35 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadOpenIdConnectProvider.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadOpenIdConnectProvider.json if __name__ == "__main__": main() 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 44597983b5d9..46e994031a58 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadPolicy.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadPolicy.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..f044eab22483 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy_fragment.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_head_policy_fragment.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.policy_fragment.get_entity_tag( + resource_group_name="rg1", + service_name="apimService1", + id="policyFragment1", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadPolicyFragment.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..22f266aeb309 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_config.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_head_portal_config.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.portal_config.get_entity_tag( + resource_group_name="rg1", + service_name="apimService1", + portal_config_id="default", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadPortalConfig.json +if __name__ == "__main__": + main() 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 3a36c528fe56..1add765e0448 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadPortalRevision.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadPortalRevision.json if __name__ == "__main__": main() 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 ccdd0d017c23..872160633bbc 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadProduct.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadProduct.json if __name__ == "__main__": main() 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 faf15e4e6aef..4bfe412bd0b4 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadProductApi.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadProductApi.json if __name__ == "__main__": main() 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 f10b2ce0ada4..b234291a5333 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadProductGroup.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadProductGroup.json if __name__ == "__main__": main() 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 4cc00c8e7423..c1823606b7b1 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadProductPolicy.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadProductPolicy.json if __name__ == "__main__": main() 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 0c5e2c9d995d..0e8c233f07e9 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadProductTag.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadProductTag.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..e4c77a95c885 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_wiki.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_head_product_wiki.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.product_wiki.get_entity_tag( + resource_group_name="rg1", + service_name="apimService1", + product_id="57d1f7558aa04f15146d9d8a", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadProductWiki.json +if __name__ == "__main__": + main() 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 397503dba1f5..83f963cebac7 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadSignInSettings.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadSignInSettings.json if __name__ == "__main__": main() 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 8d0b52ff3d7c..a59804c78f4b 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadSignUpSettings.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadSignUpSettings.json if __name__ == "__main__": main() 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 6ef81a99d717..38dfd2134219 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadSubscription.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadSubscription.json if __name__ == "__main__": main() 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 817822f328c2..6ef7f674a7bd 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadTag.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadTag.json if __name__ == "__main__": main() 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 7a2ce446493f..617348425551 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadTenantAccess.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadTenantAccess.json if __name__ == "__main__": main() 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 b3a6fd595a20..4c9bba0fc001 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadUser.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementHeadUser.json if __name__ == "__main__": main() 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 07b36d32e4e3..25f791501d33 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementIdentityProviderListSecrets.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementIdentityProviderListSecrets.json if __name__ == "__main__": main() 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 8b248122010b..f5907d3b016a 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiDiagnostics.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApiDiagnostics.json if __name__ == "__main__": main() 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 3b40b03addf9..2a557e2855eb 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 @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiIssueAttachments.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApiIssueAttachments.json if __name__ == "__main__": main() 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 1f7deec3cedf..79d12dfc6db2 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 @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiIssueComments.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApiIssueComments.json if __name__ == "__main__": main() 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 cd9982855f82..def66e70ceeb 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiIssues.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApiIssues.json if __name__ == "__main__": main() 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 6a3f1fafbab2..4f1a57ffb845 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiOperationPolicies.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApiOperationPolicies.json if __name__ == "__main__": main() 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 ff01e46a7b70..731861589f24 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 @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiOperationTags.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApiOperationTags.json if __name__ == "__main__": main() 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 0907b975054f..afca49cabf76 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiOperations.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApiOperations.json if __name__ == "__main__": main() 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 4a4ab675cd7e..8c44e8afeed0 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiOperationsByTags.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApiOperationsByTags.json if __name__ == "__main__": main() 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 e347875b0331..1e104626ac2d 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiPolicies.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApiPolicies.json if __name__ == "__main__": main() 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 61b68255f99e..909e7aa8bb1e 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiProducts.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApiProducts.json if __name__ == "__main__": main() 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 230978b7efb1..6853f138b37c 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiReleases.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApiReleases.json if __name__ == "__main__": main() 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 4e0580f3461e..5cb40273942b 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiRevisions.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApiRevisions.json if __name__ == "__main__": main() 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 f6dcfcabc67b..8c62af33de53 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiSchemas.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApiSchemas.json if __name__ == "__main__": main() 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 fb896980d457..f3f4191b681c 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiTagDescriptions.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApiTagDescriptions.json if __name__ == "__main__": main() 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 c32bdd6cde1b..c44af4e3d765 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiTags.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApiTags.json if __name__ == "__main__": main() 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 dc7477f6ea01..f12e12fedf15 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiVersionSets.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApiVersionSets.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..3a53ae2bcd2b --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_wikis.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_list_api_wikis.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.api_wikis.list( + resource_group_name="rg1", + service_name="apimService1", + api_id="57d1f7558aa04f15146d9d8a", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApiWikis.json +if __name__ == "__main__": + main() 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 a817a930e355..ccb72c9f164e 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApis.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApis.json if __name__ == "__main__": main() 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 ff4ec45df30d..e786894f0d4b 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApisByTags.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListApisByTags.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..eb72489cca93 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_access_policies.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_list_authorization_access_policies.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.authorization_access_policy.list_by_authorization( + resource_group_name="rg1", + service_name="apimService1", + authorization_provider_id="aadwithauthcode", + authorization_id="authz1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListAuthorizationAccessPolicies.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..7f0ff32a2394 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_providers.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_list_authorization_providers.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.authorization_provider.list_by_service( + resource_group_name="rg1", + service_name="apimService1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListAuthorizationProviders.json +if __name__ == "__main__": + main() 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 6c669a076cf3..5d5d834a686c 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListAuthorizationServers.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListAuthorizationServers.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..fe2f2da7268a --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_auth_code.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_list_authorizations_auth_code.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.authorization.list_by_authorization_provider( + resource_group_name="rg1", + service_name="apimService1", + authorization_provider_id="aadwithauthcode", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListAuthorizationsAuthCode.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..d991a15ed3e7 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_client_cred.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_list_authorizations_client_cred.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.authorization.list_by_authorization_provider( + resource_group_name="rg1", + service_name="apimService1", + authorization_provider_id="aadwithclientcred", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListAuthorizationsClientCred.json +if __name__ == "__main__": + main() 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 261e7bb51f20..5974de876828 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListBackends.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListBackends.json if __name__ == "__main__": main() 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 2eea5a9c1ff3..2e8cdf1bee62 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListCaches.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListCaches.json if __name__ == "__main__": main() 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 a3ff1bd53375..8f00dc118ab8 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListCertificates.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListCertificates.json if __name__ == "__main__": main() 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 407c220d53bb..03fbad9f9fd3 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListContentTypeContentItems.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListContentTypeContentItems.json if __name__ == "__main__": main() 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 0ba80f5504b1..f349354938e2 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListContentTypes.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListContentTypes.json if __name__ == "__main__": main() 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 197e42c82cae..079b907cfe23 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListDiagnostics.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListDiagnostics.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..1280b6c6dcdf --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_documentations.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_list_documentations.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.documentation.list_by_service( + resource_group_name="rg1", + service_name="apimService1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListDocumentations.json +if __name__ == "__main__": + main() 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 4fd36a5898ac..f2f5dbf85cee 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGatewayApis.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListGatewayApis.json if __name__ == "__main__": main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gatewaycertificate_authorities.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_certificate_authorities.py similarity index 89% rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gatewaycertificate_authorities.py rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_certificate_authorities.py index 221f6758bb3b..5571edc79489 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gatewaycertificate_authorities.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_certificate_authorities.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-apimanagement # USAGE - python api_management_list_gatewaycertificate_authorities.py + python api_management_list_gateway_certificate_authorities.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, @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGatewayCertificateAuthorities.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListGatewayCertificateAuthorities.json if __name__ == "__main__": main() 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 828931073417..e72557408fa2 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGatewayHostnameConfigurations.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListGatewayHostnameConfigurations.json if __name__ == "__main__": main() 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 29a67b271f3f..31a604846c6e 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGateways.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListGateways.json if __name__ == "__main__": main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_schemas.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_global_schemas.py similarity index 90% rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_schemas.py rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_global_schemas.py index 5a3cc6847e9c..73816dbb554e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_schemas.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_global_schemas.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-apimanagement # USAGE - python api_management_list_schemas.py + python api_management_list_global_schemas.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, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGlobalSchemas.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListGlobalSchemas.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..64012088dd35 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolver_policies.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_list_graph_ql_api_resolver_policies.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.graph_ql_api_resolver_policy.list_by_resolver( + resource_group_name="rg1", + service_name="apimService1", + api_id="599e2953193c3c0bd0b3e2fa", + resolver_id="599e29ab193c3c0bd0b3e2fb", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListGraphQLApiResolverPolicies.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..ac317fb9fd94 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolvers.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_list_graph_ql_api_resolvers.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.graph_ql_api_resolver.list_by_api( + resource_group_name="rg1", + service_name="apimService1", + api_id="57d2ef278aa04f0888cba3f3", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListGraphQLApiResolvers.json +if __name__ == "__main__": + main() 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 7cf0a81de72c..3718325c8777 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGroupUsers.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListGroupUsers.json if __name__ == "__main__": main() 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 ebb48eaa3e19..060dc46a38de 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGroups.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListGroups.json if __name__ == "__main__": main() 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 b8c68c84928f..8a42601465a0 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListIdentityProviders.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListIdentityProviders.json if __name__ == "__main__": main() 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 9d69bec09967..a2edbd959ed7 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListIssues.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListIssues.json if __name__ == "__main__": main() 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 f92c239ccb68..1063c7d6fa21 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListLoggers.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListLoggers.json if __name__ == "__main__": main() 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 26f797084af9..b06c7f6ccb78 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListNamedValues.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListNamedValues.json if __name__ == "__main__": main() 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 8002bef8f302..468521fadcb8 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListNotificationRecipientEmails.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListNotificationRecipientEmails.json if __name__ == "__main__": main() 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 d746fd552df6..ee784e375aba 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListNotificationRecipientUsers.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListNotificationRecipientUsers.json if __name__ == "__main__": main() 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 a3eba7fa606e..b32ff443dca6 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListNotifications.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListNotifications.json if __name__ == "__main__": main() 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 82b069d74016..bedff7f1ed14 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListOpenIdConnectProviders.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListOpenIdConnectProviders.json if __name__ == "__main__": main() 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 f2622896329b..c54179cdedfa 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 @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListOperations.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListOperations.json if __name__ == "__main__": main() 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 c574e99f012b..de686080c982 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListPolicies.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListPolicies.json if __name__ == "__main__": main() 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 71a389689002..e9394ca8a6ab 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListPolicyDescriptions.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListPolicyDescriptions.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..8095f0f1ffac --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragment_references.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_list_policy_fragment_references.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.policy_fragment.list_references( + resource_group_name="rg1", + service_name="apimService1", + id="policyFragment1", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListPolicyFragmentReferences.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..cd86d1c6fbdc --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragments.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_list_policy_fragments.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.policy_fragment.list_by_service( + resource_group_name="rg1", + service_name="apimService1", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListPolicyFragments.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..ad2157a851fe --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_config.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_list_portal_config.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.portal_config.list_by_service( + resource_group_name="rg1", + service_name="apimService1", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListPortalConfig.json +if __name__ == "__main__": + main() 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 fdfc870d0c42..88c9c779f877 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListPortalRevisions.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListPortalRevisions.json if __name__ == "__main__": main() 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 4f655354db1b..e93300d46601 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListPortalSettings.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListPortalSettings.json if __name__ == "__main__": main() 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 5c2919968a86..5781232ff84e 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListPrivateEndpointConnections.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListPrivateEndpointConnections.json if __name__ == "__main__": main() 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 7c7ae2e1ef75..c002437311e3 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListPrivateLinkGroupResources.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListPrivateLinkGroupResources.json if __name__ == "__main__": main() 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 61d02fbadd28..837db5c653d0 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProductApis.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListProductApis.json if __name__ == "__main__": main() 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 4e8f01ed258e..5865b8e8b13d 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProductGroups.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListProductGroups.json if __name__ == "__main__": main() 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 a506ab819f8d..4a135d12a09f 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProductPolicies.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListProductPolicies.json if __name__ == "__main__": main() 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 6a793d91dd8e..e8124ea6ae70 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProductSubscriptions.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListProductSubscriptions.json if __name__ == "__main__": main() 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 acab02e74716..5976dad66351 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProductTags.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListProductTags.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..60ff2aab9013 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_wikis.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_list_product_wikis.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.product_wikis.list( + resource_group_name="rg1", + service_name="apimService1", + product_id="57d1f7558aa04f15146d9d8a", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListProductWikis.json +if __name__ == "__main__": + main() 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 112288911325..fa023fd7c384 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProducts.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListProducts.json if __name__ == "__main__": main() 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 fbe43add7248..b9d84533795f 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProductsByTags.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListProductsByTags.json if __name__ == "__main__": main() 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 911aace3208b..c3ca2c50182a 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListRegions.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListRegions.json if __name__ == "__main__": main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_portal_settings.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_portal_settings_validation_key.py similarity index 88% rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_portal_settings.py rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_portal_settings_validation_key.py index 333b649b478f..c89acecb3606 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_portal_settings.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_portal_settings_validation_key.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-apimanagement # USAGE - python api_management_list_secrets_portal_settings.py + python api_management_list_secrets_portal_settings_validation_key.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, @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListSecretsPortalSettingsValidationKey.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListSecretsPortalSettingsValidationKey.json if __name__ == "__main__": main() 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 1627b297d486..8eb1a5a0e0c5 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListSecretsTenantAccess.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListSecretsTenantAccess.json if __name__ == "__main__": main() 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 392eb6137336..9270c54ee86c 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 @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListServiceBySubscription.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListServiceBySubscription.json if __name__ == "__main__": main() 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 7e1d08da95f0..63881c20a13c 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 @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListServiceBySubscriptionAndResourceGroup.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListServiceBySubscriptionAndResourceGroup.json if __name__ == "__main__": main() 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 b3ebf4413792..eb7c352277ca 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListSKUs-Consumption.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListSKUs-Consumption.json if __name__ == "__main__": main() 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 f49a33fe9858..70999e43a757 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListSKUs-Dedicated.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListSKUs-Dedicated.json if __name__ == "__main__": main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/lists_all_available_resource_skus.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sku.py similarity index 91% rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/lists_all_available_resource_skus.py rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sku.py index 80cff98cacd2..78272c99c2b8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/lists_all_available_resource_skus.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sku.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-apimanagement # USAGE - python lists_all_available_resource_skus.py + python api_management_list_sku.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListSku.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListSku.json if __name__ == "__main__": main() 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 e3ad4b47a34b..4b25ea3481bf 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListSubscriptions.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListSubscriptions.json if __name__ == "__main__": main() 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 4e6bda398a91..ba422702c807 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListTagResources.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListTagResources.json if __name__ == "__main__": main() 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 67853ecaffd5..906241e38062 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListTags.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListTags.json if __name__ == "__main__": main() 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 6e442e800d64..05262ccc6798 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListTemplates.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListTemplates.json if __name__ == "__main__": main() 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 291b789fe0e9..f39fda6dea65 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListTenantAccess.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListTenantAccess.json if __name__ == "__main__": main() 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 91b416411aa2..348df4e3e8ed 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListTenantSettings.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListTenantSettings.json if __name__ == "__main__": main() 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 3cec1e0cb39c..55d73a97a6b4 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListUserGroups.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListUserGroups.json if __name__ == "__main__": main() 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 b5e0ffdb5e77..a332c71d7290 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListUserIdentities.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListUserIdentities.json if __name__ == "__main__": main() 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 4d86a9db3bfd..4fea25c4e310 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListUserSubscriptions.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListUserSubscriptions.json if __name__ == "__main__": main() 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 e67d677c3dd7..4768e0c55b71 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListUsers.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementListUsers.json if __name__ == "__main__": main() 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 c906cbfb8834..d67e56435c6b 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementNamedValueListValue.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementNamedValueListValue.json if __name__ == "__main__": main() 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 a0074c311b09..3478547f229d 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementOpenidConnectProviderListSecrets.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementOpenidConnectProviderListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/tcp_connectivity_check.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check.py similarity index 91% rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/tcp_connectivity_check.py rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check.py index d0a91754c408..8350f4806b36 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/tcp_connectivity_check.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-apimanagement # USAGE - python tcp_connectivity_check.py + python api_management_perform_connectivity_check.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, @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPerformConnectivityCheck.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementPerformConnectivityCheck.json if __name__ == "__main__": main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/http_connectivity_check.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check_http_connect.py similarity index 89% rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/http_connectivity_check.py rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check_http_connect.py index 069e9e85a2f5..c93ae6e03a0d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/http_connectivity_check.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check_http_connect.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-apimanagement # USAGE - python http_connectivity_check.py + python api_management_perform_connectivity_check_http_connect.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, @@ -37,7 +37,7 @@ def main(): "protocol": "HTTPS", "protocolConfiguration": { "HTTPConfiguration": { - "headers": [{"name": "Authorization", "value": "Bearer myPrecious"}], + "headers": [{"name": "Authorization", "value": "Bearer myPreciousToken"}], "method": "GET", "validStatusCodes": [200, 204], } @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPerformConnectivityCheckHttpConnect.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementPerformConnectivityCheckHttpConnect.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..1593a06e0777 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_config.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_portal_config.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.portal_config.get( + resource_group_name="rg1", + service_name="apimService1", + portal_config_id="default", + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementPortalConfig.json +if __name__ == "__main__": + main() 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 09f231046c64..e0e98fa919fd 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsGetDelegation.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementPortalSettingsGetDelegation.json if __name__ == "__main__": main() 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 682e8bf89e99..1b8c055022df 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsGetSignIn.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementPortalSettingsGetSignIn.json if __name__ == "__main__": main() 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 89fc834217f1..0f970733a4be 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsGetSignUp.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementPortalSettingsGetSignUp.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..e4b845764c8a --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_delegation.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_portal_settings_put_delegation.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.delegation_settings.create_or_update( + resource_group_name="rg1", + service_name="apimService1", + parameters={ + "properties": { + "subscriptions": {"enabled": True}, + "url": "http://contoso.com/delegation", + "userRegistration": {"enabled": True}, + "validationKey": "", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementPortalSettingsPutDelegation.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..2d8121603cb7 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_in.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_portal_settings_put_sign_in.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.sign_in_settings.create_or_update( + resource_group_name="rg1", + service_name="apimService1", + parameters={"properties": {"enabled": True}}, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementPortalSettingsPutSignIn.json +if __name__ == "__main__": + main() 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 new file mode 100644 index 000000000000..df646e44de7c --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_up.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_portal_settings_put_sign_up.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.sign_up_settings.create_or_update( + resource_group_name="rg1", + service_name="apimService1", + parameters={ + "properties": { + "enabled": True, + "termsOfService": {"consentRequired": True, "enabled": True, "text": "Terms of service text."}, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementPortalSettingsPutSignUp.json +if __name__ == "__main__": + main() 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 a117b461f00c..bd6c0b0c69cc 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 @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsUpdateDelegation.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementPortalSettingsUpdateDelegation.json if __name__ == "__main__": main() 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 01c4e2aeb6a6..2c20e7782968 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsUpdateSignIn.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementPortalSettingsUpdateSignIn.json if __name__ == "__main__": main() 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 946079848c43..e0a8d76ff809 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 @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsUpdateSignUp.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementPortalSettingsUpdateSignUp.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..3179d4697594 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_post_authorization_confirm_consent_code_request.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_post_authorization_confirm_consent_code_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.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/preview/2022-09-01-preview/examples/ApiManagementPostAuthorizationConfirmConsentCodeRequest.json +if __name__ == "__main__": + main() 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 dee4090d5723..04e4b677158a 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementRefreshCertificate.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementRefreshCertificate.json if __name__ == "__main__": main() 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 29552fbd89d7..cb30daba86ca 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementRefreshNamedValue.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementRefreshNamedValue.json if __name__ == "__main__": main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_restore_service.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_restore_with_access_key.py similarity index 91% rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_restore_service.py rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_restore_with_access_key.py index 91eedf92d0a2..f7b7f96531c0 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_restore_service.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_restore_with_access_key.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-apimanagement # USAGE - python api_management_restore_service.py + python api_management_restore_with_access_key.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, @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementRestoreWithAccessKey.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementRestoreWithAccessKey.json if __name__ == "__main__": main() 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 abebbe9c43ca..306562395948 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 @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceCheckNameAvailability.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementServiceCheckNameAvailability.json if __name__ == "__main__": main() 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 a006abe5dd09..ac68401f15af 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceDeleteService.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementServiceDeleteService.json if __name__ == "__main__": main() 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 71ffe82e41a3..2d40bb73d080 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 @@ -33,6 +33,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetDomainOwnershipIdentifier.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementServiceGetDomainOwnershipIdentifier.json if __name__ == "__main__": main() 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 a74a52edb0f6..61ad4e1bf5d6 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetMultiRegionInternalVnet.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementServiceGetMultiRegionInternalVnet.json if __name__ == "__main__": main() 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 a8a3ae72a156..a881b2c1b8c0 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetNetworkStatus.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementServiceGetNetworkStatus.json if __name__ == "__main__": main() 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 412b79aebb6e..41848ef8879f 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetNetworkStatusByLocation.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementServiceGetNetworkStatusByLocation.json if __name__ == "__main__": main() 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 c0bd6d78141a..a303c3cf195c 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetOutboundNetworkDependenciesEndpoints.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementServiceGetOutboundNetworkDependenciesEndpoints.json if __name__ == "__main__": main() 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 4a64492432b0..5a77031f64ab 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetService.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementServiceGetService.json if __name__ == "__main__": main() 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 132d792913a9..628f96657371 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetServiceHavingMsi.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementServiceGetServiceHavingMsi.json if __name__ == "__main__": main() 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 8219fe7c80f8..59e133a44b6a 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetSsoToken.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementServiceGetSsoToken.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..9b7b99f2eba3 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_migrate_to_stv2.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_service_migrate_to_stv2.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.api_management_service.begin_migrate_to_stv2( + resource_group_name="rg1", + service_name="apimService1", + ).result() + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementServiceMigrateToStv2.json +if __name__ == "__main__": + main() 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 d5ee1d8ef501..7cb5272a41ac 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementSubscriptionListSecrets.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementSubscriptionListSecrets.json if __name__ == "__main__": main() 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 d7869bcb63e0..31ced3bbc1d3 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementSubscriptionRegeneratePrimaryKey.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementSubscriptionRegeneratePrimaryKey.json if __name__ == "__main__": main() 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 1e4bc347a0ec..9f0719489cc3 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementSubscriptionRegenerateSecondaryKey.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementSubscriptionRegenerateSecondaryKey.json if __name__ == "__main__": main() 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 aea984ac8df3..89809ed48548 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantAccessRegenerateKey.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementTenantAccessRegenerateKey.json if __name__ == "__main__": main() 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 f5639406d50e..292cb8d53c30 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantAccessSyncState.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementTenantAccessSyncState.json if __name__ == "__main__": main() 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 d1cf0525b9d6..4d32a1ec2b6a 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantConfigurationDeploy.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementTenantConfigurationDeploy.json if __name__ == "__main__": main() 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 a62d5828ee05..5d9e1508287f 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantConfigurationSave.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementTenantConfigurationSave.json if __name__ == "__main__": main() 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 bff13fa698c3..06b2a324e580 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantConfigurationValidate.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementTenantConfigurationValidate.json if __name__ == "__main__": main() 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 e8b968939249..2ebfe6248b70 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 @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUndelete.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUndelete.json if __name__ == "__main__": main() 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 bd7acece1aa4..dcff4a1faa07 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 @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateApi.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateApi.json if __name__ == "__main__": main() 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 a70343986eb8..38bb3f68b555 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 @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateApiDiagnostic.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateApiDiagnostic.json if __name__ == "__main__": main() 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 2c1100682e10..ca6a5bfecba5 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 @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateApiIssue.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateApiIssue.json if __name__ == "__main__": main() 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 5babdb551e85..91020356da92 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 @@ -63,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateApiOperation.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateApiOperation.json if __name__ == "__main__": main() 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 6e6fa74d7a69..ed7aece20232 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 @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateApiRelease.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateApiRelease.json if __name__ == "__main__": main() 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 ce00e676ba67..733475d62971 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 @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateApiVersionSet.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateApiVersionSet.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..6b7a5823aef7 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_wiki.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_update_api_wiki.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.api_wiki.update( + resource_group_name="rg1", + service_name="apimService1", + api_id="57d1f7558aa04f15146d9d8a", + if_match="*", + parameters={"properties": {"documents": [{"documentationId": "docId1"}]}}, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateApiWiki.json +if __name__ == "__main__": + main() 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 b06c690a426b..dd5a7903d6a3 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 @@ -34,11 +34,18 @@ def main(): service_name="apimService1", authsid="newauthServer", if_match="*", - parameters={"properties": {"clientId": "update", "clientSecret": "updated"}}, + parameters={ + "properties": { + "clientId": "update", + "clientSecret": "updated", + "useInApiDocumentation": True, + "useInTestConsole": False, + } + }, ) print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateAuthorizationServer.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateAuthorizationServer.json if __name__ == "__main__": main() 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 cb004f26e36e..1911d8da013f 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 @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateBackend.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateBackend.json if __name__ == "__main__": main() 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 21982f0016e9..7bb48bb59c37 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateCache.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateCache.json if __name__ == "__main__": main() 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 010d974bc1ed..41e6947b134e 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 @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateDiagnostic.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateDiagnostic.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 39d57bb7c877..f827de67488c 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateGateway.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateGateway.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..b2c2e81d7155 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_graph_ql_api_resolver.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_update_graph_ql_api_resolver.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.graph_ql_api_resolver.update( + resource_group_name="rg1", + service_name="apimService1", + api_id="echo-api", + resolver_id="resolverId", + if_match="*", + parameters={ + "properties": { + "description": "A GraphQL Resolver example", + "displayName": "Query AdminUsers", + "path": "Query/adminUsers", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateGraphQLApiResolver.json +if __name__ == "__main__": + main() 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 5117c7b59c07..008db3238f24 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateGroup.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateGroup.json if __name__ == "__main__": main() 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 0c1442cb127b..cc4baf2e4052 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateIdentityProvider.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateIdentityProvider.json if __name__ == "__main__": main() 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 76da5e33f45f..58e7c6a8b54b 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateLogger.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateLogger.json if __name__ == "__main__": main() 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 c7bae6a3e547..2e1a48d97e30 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 @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateNamedValue.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateNamedValue.json if __name__ == "__main__": main() 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 d57cf0038654..971edae14ba2 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 @@ -34,11 +34,13 @@ def main(): service_name="apimService1", opid="templateOpenIdConnect2", if_match="*", - parameters={"properties": {"clientSecret": "updatedsecret"}}, + parameters={ + "properties": {"clientSecret": "updatedsecret", "useInApiDocumentation": True, "useInTestConsole": False} + }, ) print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateOpenIdConnectProvider.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateOpenIdConnectProvider.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..192ba0283c7d --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_config.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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_update_portal_config.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.portal_config.update( + resource_group_name="rg1", + service_name="apimService1", + portal_config_id="default", + if_match="*", + parameters={ + "properties": { + "cors": {"allowedOrigins": ["https://contoso.com"]}, + "csp": { + "allowedSources": ["*.contoso.com"], + "mode": "reportOnly", + "reportUri": ["https://report.contoso.com"], + }, + "delegation": { + "delegateRegistration": False, + "delegateSubscription": False, + "delegationUrl": None, + "validationKey": None, + }, + "enableBasicAuth": True, + "signin": {"require": False}, + "signup": { + "termsOfService": {"requireConsent": False, "text": "I agree to the service terms and conditions."} + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdatePortalConfig.json +if __name__ == "__main__": + main() 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 b70a21af124a..efa778a60a23 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdatePortalRevision.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdatePortalRevision.json if __name__ == "__main__": main() 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 bb1533e0f4f8..5eded20b5b0c 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateProduct.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateProduct.json if __name__ == "__main__": main() 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 new file mode 100644 index 000000000000..ac38ca6a95be --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_product_wiki.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apimanagement import ApiManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apimanagement +# USAGE + python api_management_update_product_wiki.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.product_wiki.update( + resource_group_name="rg1", + service_name="apimService1", + product_id="57d1f7558aa04f15146d9d8a", + if_match="*", + parameters={"properties": {"documents": [{"documentationId": "docId1"}]}}, + ) + print(response) + + +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateProductWiki.json +if __name__ == "__main__": + main() 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 4d3197973ba3..6301e4c9bc54 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateQuotaCounterKey.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateQuotaCounterKey.json if __name__ == "__main__": main() 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 cde95b9631b4..bc5c652c60ee 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateQuotaCounterKeyByQuotaPeriod.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateQuotaCounterKeyByQuotaPeriod.json if __name__ == "__main__": main() 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 4962668ad041..e2448f6f0734 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 @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateServiceDisableTls10.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateServiceDisableTls10.json if __name__ == "__main__": main() 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 530e213cf8e1..6701098c5214 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateServicePublisherDetails.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateServicePublisherDetails.json if __name__ == "__main__": main() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_to_new_vnet_and_availability_zones.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_to_new_vnet_and_azs.py similarity index 93% rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_to_new_vnet_and_availability_zones.py rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_to_new_vnet_and_azs.py index 7e96b44e441d..497158649012 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_to_new_vnet_and_availability_zones.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_to_new_vnet_and_azs.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-apimanagement # USAGE - python api_management_update_service_to_new_vnet_and_availability_zones.py + python api_management_update_service_to_new_vnet_and_azs.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, @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateServiceToNewVnetAndAZs.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateServiceToNewVnetAndAZs.json if __name__ == "__main__": main() 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 75a9ca04b9e6..30e589470673 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateSubscription.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateSubscription.json if __name__ == "__main__": main() 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 1169ca14ce7a..ffe5380958dc 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateTag.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateTag.json if __name__ == "__main__": main() 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 9bac0335663f..e8364733a65e 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 @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateTemplate.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateTemplate.json if __name__ == "__main__": main() 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 d402649689ca..09c059410d55 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateTenantAccess.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateTenantAccess.json if __name__ == "__main__": main() 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 ef30db54779a..49f1602eb2bf 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateUser.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUpdateUser.json if __name__ == "__main__": main() 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 88fe7cb7a76c..798e9e632a37 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUserConfirmationPasswordSend.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUserConfirmationPasswordSend.json if __name__ == "__main__": main() 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 8f87af0e789e..33ed54f7d379 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUserGenerateSsoUrl.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUserGenerateSsoUrl.json if __name__ == "__main__": main() 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 d9305e561669..1b61ca9a2110 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUserToken.json +# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementUserToken.json if __name__ == "__main__": main()