From cc6ec6d5f7486191d4d29705760726c639140489 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 5 Apr 2024 01:59:16 +0000 Subject: [PATCH] feat(api): update via SDK Studio (#228) --- api.md | 107 +++++----- src/cloudflare/resources/accounts/members.py | 5 +- src/cloudflare/resources/accounts/roles.py | 14 +- .../alerting/destinations/__init__.py | 24 +-- .../alerting/destinations/destinations.py | 36 ++-- .../alerting/destinations/pagerduty.py | 38 ++-- src/cloudflare/resources/alerting/policies.py | 42 ++-- .../hostname_associations.py | 5 +- .../resources/challenges/widgets.py | 9 +- .../custom_certificates.py | 9 +- .../resources/dns/firewall/firewall.py | 25 +-- .../resources/email_routing/addresses.py | 45 ++--- .../resources/email_routing/email_routing.py | 32 ++- .../email_routing/rules/catch_alls.py | 10 +- .../resources/email_routing/rules/rules.py | 70 +++---- .../resources/load_balancers/pools/pools.py | 144 ++++---------- .../resources/user/load_balancers/pools.py | 54 +++--- src/cloudflare/types/__init__.py | 29 ++- src/cloudflare/types/accounts/__init__.py | 4 - src/cloudflare/types/accounts/member.py | 17 +- .../types/accounts/member_list_response.py | 17 +- .../types/accounts/member_update_params.py | 11 +- .../types/accounts/member_with_code.py | 17 +- src/cloudflare/types/accounts/role.py | 8 +- .../types/accounts/role_list_response.py | 21 -- src/cloudflare/types/accounts/role_param.py | 12 -- src/cloudflare/types/alerting/__init__.py | 6 +- .../types/alerting/destinations/__init__.py | 2 +- .../{alerting_pagerduty.py => pagerduty.py} | 4 +- .../destinations/pagerduty_get_response.py | 4 +- .../{alerting_policies.py => filters.py} | 106 +--------- .../types/alerting/filters_param.py | 135 +++++++++++++ src/cloudflare/types/alerting/mechanisms.py | 15 ++ .../types/alerting/mechanisms_param.py | 16 ++ src/cloudflare/types/alerting/policies.py | 107 ++++++++++ .../types/alerting/policy_create_params.py | 142 +------------- .../types/alerting/policy_update_params.py | 142 +------------- .../types/bot_fight_mode_configuration.py | 24 +++ .../types/bot_management_get_response.py | 132 +------------ .../types/bot_management_update_params.py | 24 +-- .../types/bot_management_update_response.py | 132 +------------ .../types/certificate_authorities/__init__.py | 1 + .../hostname_association_get_response.py | 3 +- .../hostname_association_item.py | 6 + .../hostname_association_update_params.py | 4 +- .../hostname_association_update_response.py | 3 +- src/cloudflare/types/challenges/__init__.py | 1 + .../challenges/challenges_widget_list_item.py | 6 + .../types/challenges/widget_create_params.py | 4 +- .../types/challenges/widget_update_params.py | 4 +- src/cloudflare/types/check_region.py | 9 + src/cloudflare/types/custom_certificate.py | 7 +- .../types/custom_certificate_create_params.py | 9 +- .../types/custom_certificate_edit_params.py | 11 +- .../types/custom_hostname_create_response.py | 157 +-------------- .../types/custom_hostname_edit_response.py | 157 +-------------- .../types/custom_hostname_get_response.py | 157 +-------------- .../types/custom_hostname_list_response.py | 157 +-------------- src/cloudflare/types/dns/__init__.py | 6 + src/cloudflare/types/dns/attack_mitigation.py | 18 ++ .../types/dns/attack_mitigation_param.py | 18 ++ src/cloudflare/types/dns/dns_firewall.py | 14 +- .../types/dns/firewall_create_params.py | 22 +-- .../types/dns/firewall_edit_params.py | 25 +-- src/cloudflare/types/dns/firewall_ips_item.py | 7 + .../types/dns/firewall_ips_item_param.py | 9 + .../types/dns/upstream_ips_items.py | 7 + .../types/dns/upstream_ips_items_param.py | 9 + .../types/email_routing/__init__.py | 19 +- src/cloudflare/types/email_routing/action.py | 15 ++ .../types/email_routing/action_item.py | 15 ++ .../types/email_routing/action_item_param.py | 15 ++ .../types/email_routing/action_param.py | 15 ++ .../email_routing/address_create_response.py | 34 ---- .../email_routing/address_delete_response.py | 34 ---- .../email_routing/address_list_response.py | 34 ---- ...get_response.py => destination_address.py} | 4 +- src/cloudflare/types/email_routing/matcher.py | 18 ++ .../types/email_routing/matcher_item.py | 18 ++ .../types/email_routing/matcher_item_param.py | 18 ++ .../types/email_routing/matcher_param.py | 18 ++ .../{rule_get_response.py => properties.py} | 28 +-- .../types/email_routing/rule_create_params.py | 29 +-- .../email_routing/rule_create_response.py | 49 ----- .../email_routing/rule_delete_response.py | 49 ----- .../types/email_routing/rule_list_response.py | 49 ----- .../types/email_routing/rule_update_params.py | 29 +-- .../email_routing/rule_update_response.py | 49 ----- .../types/email_routing/rules/__init__.py | 4 + .../types/email_routing/rules/action.py | 15 ++ .../types/email_routing/rules/action_param.py | 15 ++ .../rules/catch_all_update_params.py | 23 +-- .../rules/email_catch_all_rule.py | 16 +- .../types/email_routing/rules/matcher.py | 12 ++ .../email_routing/rules/matcher_param.py | 12 ++ .../types/email_routing_disable_response.py | 38 ---- .../types/email_routing_enable_response.py | 38 ---- ...ting_get_response.py => email_settings.py} | 4 +- src/cloudflare/types/filter_options.py | 18 ++ src/cloudflare/types/filter_options_param.py | 19 ++ src/cloudflare/types/geo_restrictions.py | 12 ++ .../types/geo_restrictions_param.py | 11 ++ src/cloudflare/types/header.py | 18 ++ src/cloudflare/types/header_param.py | 19 ++ src/cloudflare/types/host_item.py | 6 + .../load_balancers/pool_create_params.py | 162 ++-------------- .../types/load_balancers/pool_edit_params.py | 182 ++---------------- .../load_balancers/pool_update_params.py | 182 ++---------------- src/cloudflare/types/load_shedding.py | 36 ++++ src/cloudflare/types/load_shedding_param.py | 35 ++++ src/cloudflare/types/membership.py | 4 +- src/cloudflare/types/notification_filter.py | 22 +++ .../types/notification_filter_param.py | 24 +++ src/cloudflare/types/origin.py | 59 ++++++ src/cloudflare/types/origin_item.py | 59 ++++++ src/cloudflare/types/origin_item_param.py | 53 +++++ src/cloudflare/types/origin_param.py | 53 +++++ src/cloudflare/types/origin_steering.py | 26 +++ src/cloudflare/types/origin_steering_param.py | 25 +++ ...ma_ref_b92f86eb861cd3dee83c40884802fda6.py | 157 +-------------- src/cloudflare/types/ssl.py | 159 +++++++++++++++ .../types/subscription_configuration.py | 34 ++++ ...bot_fight_mode_definitely_configuration.py | 38 ++++ .../super_bot_fight_mode_likely_config.py | 41 ++++ .../types/user/invite_list_response.py | 17 +- .../types/user/load_balancers/pool.py | 157 +-------------- .../user/load_balancers/pool_create_params.py | 160 +-------------- .../user/load_balancers/pool_edit_params.py | 160 +-------------- .../user/load_balancers/pool_update_params.py | 160 +-------------- src/cloudflare/types/user/tokens/__init__.py | 3 + .../tokens/permission.py} | 8 +- .../types/user/tokens/permission_item.py | 6 + .../tokens/permission_param.py} | 6 +- tests/api_resources/accounts/test_roles.py | 14 +- tests/api_resources/alerting/test_policies.py | 26 +-- .../email_routing/test_addresses.py | 59 +++--- .../api_resources/email_routing/test_rules.py | 80 ++++---- tests/api_resources/test_email_routing.py | 42 ++-- 138 files changed, 2077 insertions(+), 3618 deletions(-) delete mode 100644 src/cloudflare/types/accounts/role_list_response.py delete mode 100644 src/cloudflare/types/accounts/role_param.py rename src/cloudflare/types/alerting/destinations/{alerting_pagerduty.py => pagerduty.py} (80%) rename src/cloudflare/types/alerting/{alerting_policies.py => filters.py} (53%) create mode 100644 src/cloudflare/types/alerting/filters_param.py create mode 100644 src/cloudflare/types/alerting/mechanisms.py create mode 100644 src/cloudflare/types/alerting/mechanisms_param.py create mode 100644 src/cloudflare/types/alerting/policies.py create mode 100644 src/cloudflare/types/bot_fight_mode_configuration.py create mode 100644 src/cloudflare/types/certificate_authorities/hostname_association_item.py create mode 100644 src/cloudflare/types/challenges/challenges_widget_list_item.py create mode 100644 src/cloudflare/types/check_region.py create mode 100644 src/cloudflare/types/dns/attack_mitigation.py create mode 100644 src/cloudflare/types/dns/attack_mitigation_param.py create mode 100644 src/cloudflare/types/dns/firewall_ips_item.py create mode 100644 src/cloudflare/types/dns/firewall_ips_item_param.py create mode 100644 src/cloudflare/types/dns/upstream_ips_items.py create mode 100644 src/cloudflare/types/dns/upstream_ips_items_param.py create mode 100644 src/cloudflare/types/email_routing/action.py create mode 100644 src/cloudflare/types/email_routing/action_item.py create mode 100644 src/cloudflare/types/email_routing/action_item_param.py create mode 100644 src/cloudflare/types/email_routing/action_param.py delete mode 100644 src/cloudflare/types/email_routing/address_create_response.py delete mode 100644 src/cloudflare/types/email_routing/address_delete_response.py delete mode 100644 src/cloudflare/types/email_routing/address_list_response.py rename src/cloudflare/types/email_routing/{address_get_response.py => destination_address.py} (92%) create mode 100644 src/cloudflare/types/email_routing/matcher.py create mode 100644 src/cloudflare/types/email_routing/matcher_item.py create mode 100644 src/cloudflare/types/email_routing/matcher_item_param.py create mode 100644 src/cloudflare/types/email_routing/matcher_param.py rename src/cloudflare/types/email_routing/{rule_get_response.py => properties.py} (57%) delete mode 100644 src/cloudflare/types/email_routing/rule_create_response.py delete mode 100644 src/cloudflare/types/email_routing/rule_delete_response.py delete mode 100644 src/cloudflare/types/email_routing/rule_list_response.py delete mode 100644 src/cloudflare/types/email_routing/rule_update_response.py create mode 100644 src/cloudflare/types/email_routing/rules/action.py create mode 100644 src/cloudflare/types/email_routing/rules/action_param.py create mode 100644 src/cloudflare/types/email_routing/rules/matcher.py create mode 100644 src/cloudflare/types/email_routing/rules/matcher_param.py delete mode 100644 src/cloudflare/types/email_routing_disable_response.py delete mode 100644 src/cloudflare/types/email_routing_enable_response.py rename src/cloudflare/types/{email_routing_get_response.py => email_settings.py} (93%) create mode 100644 src/cloudflare/types/filter_options.py create mode 100644 src/cloudflare/types/filter_options_param.py create mode 100644 src/cloudflare/types/geo_restrictions.py create mode 100644 src/cloudflare/types/geo_restrictions_param.py create mode 100644 src/cloudflare/types/header.py create mode 100644 src/cloudflare/types/header_param.py create mode 100644 src/cloudflare/types/host_item.py create mode 100644 src/cloudflare/types/load_shedding.py create mode 100644 src/cloudflare/types/load_shedding_param.py create mode 100644 src/cloudflare/types/notification_filter.py create mode 100644 src/cloudflare/types/notification_filter_param.py create mode 100644 src/cloudflare/types/origin.py create mode 100644 src/cloudflare/types/origin_item.py create mode 100644 src/cloudflare/types/origin_item_param.py create mode 100644 src/cloudflare/types/origin_param.py create mode 100644 src/cloudflare/types/origin_steering.py create mode 100644 src/cloudflare/types/origin_steering_param.py create mode 100644 src/cloudflare/types/ssl.py create mode 100644 src/cloudflare/types/subscription_configuration.py create mode 100644 src/cloudflare/types/super_bot_fight_mode_definitely_configuration.py create mode 100644 src/cloudflare/types/super_bot_fight_mode_likely_config.py rename src/cloudflare/types/{accounts/member_permission.py => user/tokens/permission.py} (82%) create mode 100644 src/cloudflare/types/user/tokens/permission_item.py rename src/cloudflare/types/{accounts/member_permission_param.py => user/tokens/permission_param.py} (80%) diff --git a/api.md b/api.md index 72ba0b0d815..2008f538585 100644 --- a/api.md +++ b/api.md @@ -52,7 +52,6 @@ Types: ```python from cloudflare.types.accounts import ( Member, - MemberPermission, MemberWithCode, MemberListResponse, MemberDeleteResponse, @@ -72,12 +71,12 @@ Methods: Types: ```python -from cloudflare.types.accounts import PermissionGrant, Role, RoleListResponse +from cloudflare.types.accounts import PermissionGrant, Role ``` Methods: -- client.accounts.roles.list(\*, account_id) -> SyncSinglePage[RoleListResponse] +- client.accounts.roles.list(\*, account_id) -> SyncSinglePage[Role] - client.accounts.roles.get(role_id, \*, account_id) -> UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a # OriginCACertificates @@ -332,7 +331,7 @@ Methods: Types: ```python -from cloudflare.types.user.tokens import PermissionGroupListResponse +from cloudflare.types.user.tokens import Permission, PermissionItem, PermissionGroupListResponse ``` Methods: @@ -1111,7 +1110,16 @@ Types: ```python from cloudflare.types import ( + CheckRegion, + FilterOptions, + Header, + HostItem, LoadBalancer, + LoadShedding, + NotificationFilter, + Origin, + OriginItem, + OriginSteering, UnnamedSchemaRef06ba14ec7860c091efc98fd9af30f382, LoadBalancerDeleteResponse, ) @@ -1489,6 +1497,7 @@ Types: ```python from cloudflare.types.certificate_authorities import ( + HostnameAssociationItem, TLSHostnameAssociation, HostnameAssociationUpdateResponse, HostnameAssociationGetResponse, @@ -1521,7 +1530,7 @@ Methods: Types: ```python -from cloudflare.types import CustomCertificate +from cloudflare.types import CustomCertificate, GeoRestrictions ``` Methods: @@ -1551,6 +1560,7 @@ Types: ```python from cloudflare.types import ( CustomHostname, + SSL, UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1, UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510, UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1, @@ -1694,8 +1704,11 @@ Types: ```python from cloudflare.types.dns import ( + AttackMitigation, DNSFirewall, + FirewallIPsItem, UnnamedSchemaRef7a0f93d9e1afc3221d2a57b7bab16955, + UpstreamIPsItems, FirewallDeleteResponse, ) ``` @@ -1741,19 +1754,14 @@ Methods: Types: ```python -from cloudflare.types import ( - EmailSettings, - EmailRoutingDisableResponse, - EmailRoutingEnableResponse, - EmailRoutingGetResponse, -) +from cloudflare.types import EmailSettings ``` Methods: -- client.email_routing.disable(zone_identifier, \*\*params) -> EmailRoutingDisableResponse -- client.email_routing.enable(zone_identifier, \*\*params) -> EmailRoutingEnableResponse -- client.email_routing.get(zone_identifier) -> EmailRoutingGetResponse +- client.email_routing.disable(zone_identifier, \*\*params) -> EmailSettings +- client.email_routing.enable(zone_identifier, \*\*params) -> EmailSettings +- client.email_routing.get(zone_identifier) -> EmailSettings ## DNS @@ -1773,29 +1781,29 @@ Types: ```python from cloudflare.types.email_routing import ( - EmailRules, - RuleCreateResponse, - RuleUpdateResponse, - RuleListResponse, - RuleDeleteResponse, - RuleGetResponse, + Action, + ActionItem, + EmailRule, + Matcher, + MatcherItem, + Properties, ) ``` Methods: -- client.email_routing.rules.create(zone_identifier, \*\*params) -> RuleCreateResponse -- client.email_routing.rules.update(rule_identifier, \*, zone_identifier, \*\*params) -> RuleUpdateResponse -- client.email_routing.rules.list(zone_identifier, \*\*params) -> SyncV4PagePaginationArray[RuleListResponse] -- client.email_routing.rules.delete(rule_identifier, \*, zone_identifier) -> RuleDeleteResponse -- client.email_routing.rules.get(rule_identifier, \*, zone_identifier) -> RuleGetResponse +- client.email_routing.rules.create(zone_identifier, \*\*params) -> Properties +- client.email_routing.rules.update(rule_identifier, \*, zone_identifier, \*\*params) -> Properties +- client.email_routing.rules.list(zone_identifier, \*\*params) -> SyncV4PagePaginationArray[Properties] +- client.email_routing.rules.delete(rule_identifier, \*, zone_identifier) -> Properties +- client.email_routing.rules.get(rule_identifier, \*, zone_identifier) -> Properties ### CatchAlls Types: ```python -from cloudflare.types.email_routing.rules import EmailCatchAllRule +from cloudflare.types.email_routing.rules import Action, EmailCatchAllRule, Matcher ``` Methods: @@ -1808,21 +1816,15 @@ Methods: Types: ```python -from cloudflare.types.email_routing import ( - EmailAddresses, - AddressCreateResponse, - AddressListResponse, - AddressDeleteResponse, - AddressGetResponse, -) +from cloudflare.types.email_routing import DestinationAddress, EmailAddresses ``` Methods: -- client.email_routing.addresses.create(account_identifier, \*\*params) -> AddressCreateResponse -- client.email_routing.addresses.list(account_identifier, \*\*params) -> SyncV4PagePaginationArray[AddressListResponse] -- client.email_routing.addresses.delete(destination_address_identifier, \*, account_identifier) -> AddressDeleteResponse -- client.email_routing.addresses.get(destination_address_identifier, \*, account_identifier) -> AddressGetResponse +- client.email_routing.addresses.create(account_identifier, \*\*params) -> DestinationAddress +- client.email_routing.addresses.list(account_identifier, \*\*params) -> SyncV4PagePaginationArray[DestinationAddress] +- client.email_routing.addresses.delete(destination_address_identifier, \*, account_identifier) -> DestinationAddress +- client.email_routing.addresses.get(destination_address_identifier, \*, account_identifier) -> DestinationAddress # Filters @@ -4483,13 +4485,13 @@ Methods: - client.alerting.destinations.eligible.get(\*, account_id) -> Optional -### Pagerduty +### PagerdutyResource Types: ```python from cloudflare.types.alerting.destinations import ( - AlertingPagerduty, + Pagerduty, PagerdutyCreateResponse, PagerdutyGetResponse, PagerdutyLinkResponse, @@ -4540,16 +4542,22 @@ Methods: Types: ```python -from cloudflare.types.alerting import AlertingPolicies, PolicyCreateResponse, PolicyUpdateResponse +from cloudflare.types.alerting import ( + Filters, + Mechanisms, + Policies, + PolicyCreateResponse, + PolicyUpdateResponse, +) ``` Methods: - client.alerting.policies.create(\*, account_id, \*\*params) -> PolicyCreateResponse - client.alerting.policies.update(policy_id, \*, account_id, \*\*params) -> PolicyUpdateResponse -- client.alerting.policies.list(\*, account_id) -> SyncSinglePage[AlertingPolicies] +- client.alerting.policies.list(\*, account_id) -> SyncSinglePage[Policies] - client.alerting.policies.delete(policy_id, \*, account_id) -> Optional -- client.alerting.policies.get(policy_id, \*, account_id) -> AlertingPolicies +- client.alerting.policies.get(policy_id, \*, account_id) -> Policies # D1 @@ -5785,7 +5793,11 @@ Methods: Types: ```python -from cloudflare.types.challenges import ChallengesWidget, ChallengesWidgetList +from cloudflare.types.challenges import ( + ChallengesWidget, + ChallengesWidgetList, + ChallengesWidgetListItem, +) ``` Methods: @@ -6997,7 +7009,14 @@ Methods: Types: ```python -from cloudflare.types import BotManagementUpdateResponse, BotManagementGetResponse +from cloudflare.types import ( + BotFightModeConfiguration, + SubscriptionConfiguration, + SuperBotFightModeDefinitelyConfiguration, + SuperBotFightModeLikelyConfig, + BotManagementUpdateResponse, + BotManagementGetResponse, +) ``` Methods: diff --git a/src/cloudflare/resources/accounts/members.py b/src/cloudflare/resources/accounts/members.py index ac001685537..3d4388ae195 100644 --- a/src/cloudflare/resources/accounts/members.py +++ b/src/cloudflare/resources/accounts/members.py @@ -28,7 +28,6 @@ ) from ...types.accounts import ( Member, - RoleParam, MemberWithCode, MemberListResponse, MemberDeleteResponse, @@ -105,7 +104,7 @@ def update( member_id: str, *, account_id: object, - roles: Iterable[RoleParam], + roles: Iterable[member_update_params.Role], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -351,7 +350,7 @@ async def update( member_id: str, *, account_id: object, - roles: Iterable[RoleParam], + roles: Iterable[member_update_params.Role], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/cloudflare/resources/accounts/roles.py b/src/cloudflare/resources/accounts/roles.py index f6b06f5ff02..eb3d45ed53a 100644 --- a/src/cloudflare/resources/accounts/roles.py +++ b/src/cloudflare/resources/accounts/roles.py @@ -22,7 +22,7 @@ make_request_options, ) from ...types.shared import UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a -from ...types.accounts import RoleListResponse +from ...types.accounts import Role __all__ = ["Roles", "AsyncRoles"] @@ -46,7 +46,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[RoleListResponse]: + ) -> SyncSinglePage[Role]: """ Get all available roles for an account. @@ -61,11 +61,11 @@ def list( """ return self._get_api_list( f"/accounts/{account_id}/roles", - page=SyncSinglePage[RoleListResponse], + page=SyncSinglePage[Role], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=RoleListResponse, + model=Role, ) def get( @@ -129,7 +129,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[RoleListResponse, AsyncSinglePage[RoleListResponse]]: + ) -> AsyncPaginator[Role, AsyncSinglePage[Role]]: """ Get all available roles for an account. @@ -144,11 +144,11 @@ def list( """ return self._get_api_list( f"/accounts/{account_id}/roles", - page=AsyncSinglePage[RoleListResponse], + page=AsyncSinglePage[Role], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=RoleListResponse, + model=Role, ) async def get( diff --git a/src/cloudflare/resources/alerting/destinations/__init__.py b/src/cloudflare/resources/alerting/destinations/__init__.py index bf0c2e4e0b8..da72878446e 100644 --- a/src/cloudflare/resources/alerting/destinations/__init__.py +++ b/src/cloudflare/resources/alerting/destinations/__init__.py @@ -17,12 +17,12 @@ AsyncWebhooksWithStreamingResponse, ) from .pagerduty import ( - Pagerduty, - AsyncPagerduty, - PagerdutyWithRawResponse, - AsyncPagerdutyWithRawResponse, - PagerdutyWithStreamingResponse, - AsyncPagerdutyWithStreamingResponse, + PagerdutyResource, + AsyncPagerdutyResource, + PagerdutyResourceWithRawResponse, + AsyncPagerdutyResourceWithRawResponse, + PagerdutyResourceWithStreamingResponse, + AsyncPagerdutyResourceWithStreamingResponse, ) from .destinations import ( Destinations, @@ -40,12 +40,12 @@ "AsyncEligibleWithRawResponse", "EligibleWithStreamingResponse", "AsyncEligibleWithStreamingResponse", - "Pagerduty", - "AsyncPagerduty", - "PagerdutyWithRawResponse", - "AsyncPagerdutyWithRawResponse", - "PagerdutyWithStreamingResponse", - "AsyncPagerdutyWithStreamingResponse", + "PagerdutyResource", + "AsyncPagerdutyResource", + "PagerdutyResourceWithRawResponse", + "AsyncPagerdutyResourceWithRawResponse", + "PagerdutyResourceWithStreamingResponse", + "AsyncPagerdutyResourceWithStreamingResponse", "Webhooks", "AsyncWebhooks", "WebhooksWithRawResponse", diff --git a/src/cloudflare/resources/alerting/destinations/destinations.py b/src/cloudflare/resources/alerting/destinations/destinations.py index 35d6a951687..57a1bac1679 100644 --- a/src/cloudflare/resources/alerting/destinations/destinations.py +++ b/src/cloudflare/resources/alerting/destinations/destinations.py @@ -19,12 +19,12 @@ AsyncWebhooksWithStreamingResponse, ) from .pagerduty import ( - Pagerduty, - AsyncPagerduty, - PagerdutyWithRawResponse, - AsyncPagerdutyWithRawResponse, - PagerdutyWithStreamingResponse, - AsyncPagerdutyWithStreamingResponse, + PagerdutyResource, + AsyncPagerdutyResource, + PagerdutyResourceWithRawResponse, + AsyncPagerdutyResourceWithRawResponse, + PagerdutyResourceWithStreamingResponse, + AsyncPagerdutyResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -38,8 +38,8 @@ def eligible(self) -> Eligible: return Eligible(self._client) @cached_property - def pagerduty(self) -> Pagerduty: - return Pagerduty(self._client) + def pagerduty(self) -> PagerdutyResource: + return PagerdutyResource(self._client) @cached_property def webhooks(self) -> Webhooks: @@ -60,8 +60,8 @@ def eligible(self) -> AsyncEligible: return AsyncEligible(self._client) @cached_property - def pagerduty(self) -> AsyncPagerduty: - return AsyncPagerduty(self._client) + def pagerduty(self) -> AsyncPagerdutyResource: + return AsyncPagerdutyResource(self._client) @cached_property def webhooks(self) -> AsyncWebhooks: @@ -85,8 +85,8 @@ def eligible(self) -> EligibleWithRawResponse: return EligibleWithRawResponse(self._destinations.eligible) @cached_property - def pagerduty(self) -> PagerdutyWithRawResponse: - return PagerdutyWithRawResponse(self._destinations.pagerduty) + def pagerduty(self) -> PagerdutyResourceWithRawResponse: + return PagerdutyResourceWithRawResponse(self._destinations.pagerduty) @cached_property def webhooks(self) -> WebhooksWithRawResponse: @@ -102,8 +102,8 @@ def eligible(self) -> AsyncEligibleWithRawResponse: return AsyncEligibleWithRawResponse(self._destinations.eligible) @cached_property - def pagerduty(self) -> AsyncPagerdutyWithRawResponse: - return AsyncPagerdutyWithRawResponse(self._destinations.pagerduty) + def pagerduty(self) -> AsyncPagerdutyResourceWithRawResponse: + return AsyncPagerdutyResourceWithRawResponse(self._destinations.pagerduty) @cached_property def webhooks(self) -> AsyncWebhooksWithRawResponse: @@ -119,8 +119,8 @@ def eligible(self) -> EligibleWithStreamingResponse: return EligibleWithStreamingResponse(self._destinations.eligible) @cached_property - def pagerduty(self) -> PagerdutyWithStreamingResponse: - return PagerdutyWithStreamingResponse(self._destinations.pagerduty) + def pagerduty(self) -> PagerdutyResourceWithStreamingResponse: + return PagerdutyResourceWithStreamingResponse(self._destinations.pagerduty) @cached_property def webhooks(self) -> WebhooksWithStreamingResponse: @@ -136,8 +136,8 @@ def eligible(self) -> AsyncEligibleWithStreamingResponse: return AsyncEligibleWithStreamingResponse(self._destinations.eligible) @cached_property - def pagerduty(self) -> AsyncPagerdutyWithStreamingResponse: - return AsyncPagerdutyWithStreamingResponse(self._destinations.pagerduty) + def pagerduty(self) -> AsyncPagerdutyResourceWithStreamingResponse: + return AsyncPagerdutyResourceWithStreamingResponse(self._destinations.pagerduty) @cached_property def webhooks(self) -> AsyncWebhooksWithStreamingResponse: diff --git a/src/cloudflare/resources/alerting/destinations/pagerduty.py b/src/cloudflare/resources/alerting/destinations/pagerduty.py index 029d578f405..f92086ae8fb 100644 --- a/src/cloudflare/resources/alerting/destinations/pagerduty.py +++ b/src/cloudflare/resources/alerting/destinations/pagerduty.py @@ -22,17 +22,17 @@ from ....types.shared import UnnamedSchemaRef67bbb1ccdd42c3e2937b9fd19f791151 from ....types.alerting.destinations import PagerdutyGetResponse, PagerdutyLinkResponse, PagerdutyCreateResponse -__all__ = ["Pagerduty", "AsyncPagerduty"] +__all__ = ["PagerdutyResource", "AsyncPagerdutyResource"] -class Pagerduty(SyncAPIResource): +class PagerdutyResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PagerdutyWithRawResponse: - return PagerdutyWithRawResponse(self) + def with_raw_response(self) -> PagerdutyResourceWithRawResponse: + return PagerdutyResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PagerdutyWithStreamingResponse: - return PagerdutyWithStreamingResponse(self) + def with_streaming_response(self) -> PagerdutyResourceWithStreamingResponse: + return PagerdutyResourceWithStreamingResponse(self) def create( self, @@ -201,14 +201,14 @@ def link( ) -class AsyncPagerduty(AsyncAPIResource): +class AsyncPagerdutyResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPagerdutyWithRawResponse: - return AsyncPagerdutyWithRawResponse(self) + def with_raw_response(self) -> AsyncPagerdutyResourceWithRawResponse: + return AsyncPagerdutyResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPagerdutyWithStreamingResponse: - return AsyncPagerdutyWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPagerdutyResourceWithStreamingResponse: + return AsyncPagerdutyResourceWithStreamingResponse(self) async def create( self, @@ -377,8 +377,8 @@ async def link( ) -class PagerdutyWithRawResponse: - def __init__(self, pagerduty: Pagerduty) -> None: +class PagerdutyResourceWithRawResponse: + def __init__(self, pagerduty: PagerdutyResource) -> None: self._pagerduty = pagerduty self.create = to_raw_response_wrapper( @@ -395,8 +395,8 @@ def __init__(self, pagerduty: Pagerduty) -> None: ) -class AsyncPagerdutyWithRawResponse: - def __init__(self, pagerduty: AsyncPagerduty) -> None: +class AsyncPagerdutyResourceWithRawResponse: + def __init__(self, pagerduty: AsyncPagerdutyResource) -> None: self._pagerduty = pagerduty self.create = async_to_raw_response_wrapper( @@ -413,8 +413,8 @@ def __init__(self, pagerduty: AsyncPagerduty) -> None: ) -class PagerdutyWithStreamingResponse: - def __init__(self, pagerduty: Pagerduty) -> None: +class PagerdutyResourceWithStreamingResponse: + def __init__(self, pagerduty: PagerdutyResource) -> None: self._pagerduty = pagerduty self.create = to_streamed_response_wrapper( @@ -431,8 +431,8 @@ def __init__(self, pagerduty: Pagerduty) -> None: ) -class AsyncPagerdutyWithStreamingResponse: - def __init__(self, pagerduty: AsyncPagerduty) -> None: +class AsyncPagerdutyResourceWithStreamingResponse: + def __init__(self, pagerduty: AsyncPagerdutyResource) -> None: self._pagerduty = pagerduty self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/alerting/policies.py b/src/cloudflare/resources/alerting/policies.py index 5f1c5891e58..7939e702bf8 100644 --- a/src/cloudflare/resources/alerting/policies.py +++ b/src/cloudflare/resources/alerting/policies.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Dict, Type, Iterable, Optional, cast +from typing import Any, Type, Optional, cast from typing_extensions import Literal import httpx @@ -28,9 +28,11 @@ ) from ...types.shared import UnnamedSchemaRef67bbb1ccdd42c3e2937b9fd19f791151 from ...types.alerting import ( - AlertingPolicies, + FiltersParam, + MechanismsParam, PolicyCreateResponse, PolicyUpdateResponse, + policies, policy_create_params, policy_update_params, ) @@ -109,10 +111,10 @@ def create( "zone_aop_custom_certificate_expiration_type", ], enabled: bool, - mechanisms: Dict[str, Iterable[policy_create_params.Mechanisms]], + mechanisms: MechanismsParam, name: str, description: str | NotGiven = NOT_GIVEN, - filters: policy_create_params.Filters | NotGiven = NOT_GIVEN, + filters: FiltersParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -241,8 +243,8 @@ def update( | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, - filters: policy_update_params.Filters | NotGiven = NOT_GIVEN, - mechanisms: Dict[str, Iterable[policy_update_params.Mechanisms]] | NotGiven = NOT_GIVEN, + filters: FiltersParam | NotGiven = NOT_GIVEN, + mechanisms: MechanismsParam | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -321,7 +323,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[AlertingPolicies]: + ) -> SyncSinglePage[policies.Policies]: """ Get a list of all Notification policies. @@ -340,11 +342,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/alerting/v3/policies", - page=SyncSinglePage[AlertingPolicies], + page=SyncSinglePage[policies.Policies], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=AlertingPolicies, + model=policies.Policies, ) def delete( @@ -407,7 +409,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AlertingPolicies: + ) -> policies.Policies: """ Get details for a single policy. @@ -437,7 +439,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[AlertingPolicies], ResultWrapper[AlertingPolicies]), + cast_to=cast(Type[policies.Policies], ResultWrapper[policies.Policies]), ) @@ -512,10 +514,10 @@ async def create( "zone_aop_custom_certificate_expiration_type", ], enabled: bool, - mechanisms: Dict[str, Iterable[policy_create_params.Mechanisms]], + mechanisms: MechanismsParam, name: str, description: str | NotGiven = NOT_GIVEN, - filters: policy_create_params.Filters | NotGiven = NOT_GIVEN, + filters: FiltersParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -644,8 +646,8 @@ async def update( | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, - filters: policy_update_params.Filters | NotGiven = NOT_GIVEN, - mechanisms: Dict[str, Iterable[policy_update_params.Mechanisms]] | NotGiven = NOT_GIVEN, + filters: FiltersParam | NotGiven = NOT_GIVEN, + mechanisms: MechanismsParam | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -724,7 +726,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AlertingPolicies, AsyncSinglePage[AlertingPolicies]]: + ) -> AsyncPaginator[policies.Policies, AsyncSinglePage[policies.Policies]]: """ Get a list of all Notification policies. @@ -743,11 +745,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/alerting/v3/policies", - page=AsyncSinglePage[AlertingPolicies], + page=AsyncSinglePage[policies.Policies], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=AlertingPolicies, + model=policies.Policies, ) async def delete( @@ -810,7 +812,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AlertingPolicies: + ) -> policies.Policies: """ Get details for a single policy. @@ -840,7 +842,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[AlertingPolicies], ResultWrapper[AlertingPolicies]), + cast_to=cast(Type[policies.Policies], ResultWrapper[policies.Policies]), ) diff --git a/src/cloudflare/resources/certificate_authorities/hostname_associations.py b/src/cloudflare/resources/certificate_authorities/hostname_associations.py index 3a57d819bf0..74eedadc7fa 100644 --- a/src/cloudflare/resources/certificate_authorities/hostname_associations.py +++ b/src/cloudflare/resources/certificate_authorities/hostname_associations.py @@ -24,6 +24,7 @@ make_request_options, ) from ...types.certificate_authorities import ( + HostnameAssociationItem, HostnameAssociationGetResponse, HostnameAssociationUpdateResponse, hostname_association_get_params, @@ -46,7 +47,7 @@ def update( self, *, zone_id: str, - hostnames: List[str] | NotGiven = NOT_GIVEN, + hostnames: List[HostnameAssociationItem] | NotGiven = NOT_GIVEN, mtls_certificate_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -156,7 +157,7 @@ async def update( self, *, zone_id: str, - hostnames: List[str] | NotGiven = NOT_GIVEN, + hostnames: List[HostnameAssociationItem] | NotGiven = NOT_GIVEN, mtls_certificate_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/cloudflare/resources/challenges/widgets.py b/src/cloudflare/resources/challenges/widgets.py index 5c9d1521e5b..6f594a7932c 100644 --- a/src/cloudflare/resources/challenges/widgets.py +++ b/src/cloudflare/resources/challenges/widgets.py @@ -29,6 +29,7 @@ from ...types.challenges import ( ChallengesWidget, ChallengesWidgetList, + ChallengesWidgetListItem, widget_list_params, widget_create_params, widget_update_params, @@ -51,7 +52,7 @@ def create( self, *, account_id: str, - domains: List[str], + domains: List[ChallengesWidgetListItem], mode: Literal["non-interactive", "invisible", "managed"], name: str, direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, @@ -147,7 +148,7 @@ def update( sitekey: str, *, account_id: str, - domains: List[str], + domains: List[ChallengesWidgetListItem], mode: Literal["non-interactive", "invisible", "managed"], name: str, bot_fight_mode: bool | NotGiven = NOT_GIVEN, @@ -435,7 +436,7 @@ async def create( self, *, account_id: str, - domains: List[str], + domains: List[ChallengesWidgetListItem], mode: Literal["non-interactive", "invisible", "managed"], name: str, direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, @@ -531,7 +532,7 @@ async def update( sitekey: str, *, account_id: str, - domains: List[str], + domains: List[ChallengesWidgetListItem], mode: Literal["non-interactive", "invisible", "managed"], name: str, bot_fight_mode: bool | NotGiven = NOT_GIVEN, diff --git a/src/cloudflare/resources/custom_certificates/custom_certificates.py b/src/cloudflare/resources/custom_certificates/custom_certificates.py index 1d943cad9f8..eff68a66667 100644 --- a/src/cloudflare/resources/custom_certificates/custom_certificates.py +++ b/src/cloudflare/resources/custom_certificates/custom_certificates.py @@ -9,6 +9,7 @@ from ...types import ( CustomCertificate, + GeoRestrictionsParam, UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1, custom_certificate_edit_params, custom_certificate_list_params, @@ -70,7 +71,7 @@ def create( certificate: str, private_key: str, bundle_method: UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 | NotGiven = NOT_GIVEN, - geo_restrictions: custom_certificate_create_params.GeoRestrictions | NotGiven = NOT_GIVEN, + geo_restrictions: GeoRestrictionsParam | NotGiven = NOT_GIVEN, policy: str | NotGiven = NOT_GIVEN, type: Literal["legacy_custom", "sni_custom"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -275,7 +276,7 @@ def edit( zone_id: str, bundle_method: UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 | NotGiven = NOT_GIVEN, certificate: str | NotGiven = NOT_GIVEN, - geo_restrictions: custom_certificate_edit_params.GeoRestrictions | NotGiven = NOT_GIVEN, + geo_restrictions: GeoRestrictionsParam | NotGiven = NOT_GIVEN, policy: str | NotGiven = NOT_GIVEN, private_key: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -436,7 +437,7 @@ async def create( certificate: str, private_key: str, bundle_method: UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 | NotGiven = NOT_GIVEN, - geo_restrictions: custom_certificate_create_params.GeoRestrictions | NotGiven = NOT_GIVEN, + geo_restrictions: GeoRestrictionsParam | NotGiven = NOT_GIVEN, policy: str | NotGiven = NOT_GIVEN, type: Literal["legacy_custom", "sni_custom"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -641,7 +642,7 @@ async def edit( zone_id: str, bundle_method: UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 | NotGiven = NOT_GIVEN, certificate: str | NotGiven = NOT_GIVEN, - geo_restrictions: custom_certificate_edit_params.GeoRestrictions | NotGiven = NOT_GIVEN, + geo_restrictions: GeoRestrictionsParam | NotGiven = NOT_GIVEN, policy: str | NotGiven = NOT_GIVEN, private_key: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/cloudflare/resources/dns/firewall/firewall.py b/src/cloudflare/resources/dns/firewall/firewall.py index 7f3c5495c36..4f61ad6f09a 100644 --- a/src/cloudflare/resources/dns/firewall/firewall.py +++ b/src/cloudflare/resources/dns/firewall/firewall.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, Union, Optional, cast +from typing import List, Type, Optional, cast import httpx @@ -30,6 +30,9 @@ from ...._wrappers import ResultWrapper from ....types.dns import ( DNSFirewall, + FirewallIPsItemParam, + AttackMitigationParam, + UpstreamIPsItemsParam, FirewallDeleteResponse, firewall_edit_params, firewall_list_params, @@ -64,8 +67,8 @@ def create( *, account_id: str, name: str, - upstream_ips: List[Union[str, str]], - attack_mitigation: Optional[firewall_create_params.AttackMitigation] | NotGiven = NOT_GIVEN, + upstream_ips: List[UpstreamIPsItemsParam], + attack_mitigation: Optional[AttackMitigationParam] | NotGiven = NOT_GIVEN, deprecate_any_requests: bool | NotGiven = NOT_GIVEN, ecs_fallback: bool | NotGiven = NOT_GIVEN, maximum_cache_ttl: float | NotGiven = NOT_GIVEN, @@ -247,13 +250,13 @@ def edit( *, account_id: str, deprecate_any_requests: bool, - dns_firewall_ips: List[Union[str, str]], + dns_firewall_ips: List[FirewallIPsItemParam], ecs_fallback: bool, maximum_cache_ttl: float, minimum_cache_ttl: float, name: str, - upstream_ips: List[Union[str, str]], - attack_mitigation: Optional[firewall_edit_params.AttackMitigation] | NotGiven = NOT_GIVEN, + upstream_ips: List[UpstreamIPsItemsParam], + attack_mitigation: Optional[AttackMitigationParam] | NotGiven = NOT_GIVEN, negative_cache_ttl: Optional[float] | NotGiven = NOT_GIVEN, ratelimit: Optional[float] | NotGiven = NOT_GIVEN, retries: float | NotGiven = NOT_GIVEN, @@ -395,8 +398,8 @@ async def create( *, account_id: str, name: str, - upstream_ips: List[Union[str, str]], - attack_mitigation: Optional[firewall_create_params.AttackMitigation] | NotGiven = NOT_GIVEN, + upstream_ips: List[UpstreamIPsItemsParam], + attack_mitigation: Optional[AttackMitigationParam] | NotGiven = NOT_GIVEN, deprecate_any_requests: bool | NotGiven = NOT_GIVEN, ecs_fallback: bool | NotGiven = NOT_GIVEN, maximum_cache_ttl: float | NotGiven = NOT_GIVEN, @@ -578,13 +581,13 @@ async def edit( *, account_id: str, deprecate_any_requests: bool, - dns_firewall_ips: List[Union[str, str]], + dns_firewall_ips: List[FirewallIPsItemParam], ecs_fallback: bool, maximum_cache_ttl: float, minimum_cache_ttl: float, name: str, - upstream_ips: List[Union[str, str]], - attack_mitigation: Optional[firewall_edit_params.AttackMitigation] | NotGiven = NOT_GIVEN, + upstream_ips: List[UpstreamIPsItemsParam], + attack_mitigation: Optional[AttackMitigationParam] | NotGiven = NOT_GIVEN, negative_cache_ttl: Optional[float] | NotGiven = NOT_GIVEN, ratelimit: Optional[float] | NotGiven = NOT_GIVEN, retries: float | NotGiven = NOT_GIVEN, diff --git a/src/cloudflare/resources/email_routing/addresses.py b/src/cloudflare/resources/email_routing/addresses.py index b810ed54eaf..20370e1b2b1 100644 --- a/src/cloudflare/resources/email_routing/addresses.py +++ b/src/cloudflare/resources/email_routing/addresses.py @@ -26,14 +26,7 @@ AsyncPaginator, make_request_options, ) -from ...types.email_routing import ( - AddressGetResponse, - AddressListResponse, - AddressCreateResponse, - AddressDeleteResponse, - address_list_params, - address_create_params, -) +from ...types.email_routing import DestinationAddress, address_list_params, address_create_params __all__ = ["Addresses", "AsyncAddresses"] @@ -58,7 +51,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressCreateResponse: + ) -> DestinationAddress: """Create a destination address to forward your emails to. Destination addresses @@ -89,7 +82,7 @@ def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[AddressCreateResponse], ResultWrapper[AddressCreateResponse]), + cast_to=cast(Type[DestinationAddress], ResultWrapper[DestinationAddress]), ) def list( @@ -106,7 +99,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[AddressListResponse]: + ) -> SyncV4PagePaginationArray[DestinationAddress]: """ Lists existing destination addresses. @@ -133,7 +126,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") return self._get_api_list( f"/accounts/{account_identifier}/email/routing/addresses", - page=SyncV4PagePaginationArray[AddressListResponse], + page=SyncV4PagePaginationArray[DestinationAddress], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -149,7 +142,7 @@ def list( address_list_params.AddressListParams, ), ), - model=AddressListResponse, + model=DestinationAddress, ) def delete( @@ -163,7 +156,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressDeleteResponse: + ) -> DestinationAddress: """ Deletes a specific destination address. @@ -195,7 +188,7 @@ def delete( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[AddressDeleteResponse], ResultWrapper[AddressDeleteResponse]), + cast_to=cast(Type[DestinationAddress], ResultWrapper[DestinationAddress]), ) def get( @@ -209,7 +202,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressGetResponse: + ) -> DestinationAddress: """ Gets information for a specific destination email already created. @@ -241,7 +234,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[AddressGetResponse], ResultWrapper[AddressGetResponse]), + cast_to=cast(Type[DestinationAddress], ResultWrapper[DestinationAddress]), ) @@ -265,7 +258,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressCreateResponse: + ) -> DestinationAddress: """Create a destination address to forward your emails to. Destination addresses @@ -296,7 +289,7 @@ async def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[AddressCreateResponse], ResultWrapper[AddressCreateResponse]), + cast_to=cast(Type[DestinationAddress], ResultWrapper[DestinationAddress]), ) def list( @@ -313,7 +306,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AddressListResponse, AsyncV4PagePaginationArray[AddressListResponse]]: + ) -> AsyncPaginator[DestinationAddress, AsyncV4PagePaginationArray[DestinationAddress]]: """ Lists existing destination addresses. @@ -340,7 +333,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") return self._get_api_list( f"/accounts/{account_identifier}/email/routing/addresses", - page=AsyncV4PagePaginationArray[AddressListResponse], + page=AsyncV4PagePaginationArray[DestinationAddress], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -356,7 +349,7 @@ def list( address_list_params.AddressListParams, ), ), - model=AddressListResponse, + model=DestinationAddress, ) async def delete( @@ -370,7 +363,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressDeleteResponse: + ) -> DestinationAddress: """ Deletes a specific destination address. @@ -402,7 +395,7 @@ async def delete( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[AddressDeleteResponse], ResultWrapper[AddressDeleteResponse]), + cast_to=cast(Type[DestinationAddress], ResultWrapper[DestinationAddress]), ) async def get( @@ -416,7 +409,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressGetResponse: + ) -> DestinationAddress: """ Gets information for a specific destination email already created. @@ -448,7 +441,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[AddressGetResponse], ResultWrapper[AddressGetResponse]), + cast_to=cast(Type[DestinationAddress], ResultWrapper[DestinationAddress]), ) diff --git a/src/cloudflare/resources/email_routing/email_routing.py b/src/cloudflare/resources/email_routing/email_routing.py index 5d5a0c48a52..7868034517a 100644 --- a/src/cloudflare/resources/email_routing/email_routing.py +++ b/src/cloudflare/resources/email_routing/email_routing.py @@ -22,13 +22,7 @@ RulesWithStreamingResponse, AsyncRulesWithStreamingResponse, ) -from ...types import ( - EmailRoutingGetResponse, - EmailRoutingEnableResponse, - EmailRoutingDisableResponse, - email_routing_enable_params, - email_routing_disable_params, -) +from ...types import EmailSettings, email_routing_enable_params, email_routing_disable_params from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, @@ -91,7 +85,7 @@ def disable( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailRoutingDisableResponse: + ) -> EmailSettings: """Disable your Email Routing zone. Also removes additional MX records previously @@ -120,7 +114,7 @@ def disable( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[EmailRoutingDisableResponse], ResultWrapper[EmailRoutingDisableResponse]), + cast_to=cast(Type[EmailSettings], ResultWrapper[EmailSettings]), ) def enable( @@ -134,7 +128,7 @@ def enable( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailRoutingEnableResponse: + ) -> EmailSettings: """Enable you Email Routing zone. Add and lock the necessary MX and SPF records. @@ -162,7 +156,7 @@ def enable( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[EmailRoutingEnableResponse], ResultWrapper[EmailRoutingEnableResponse]), + cast_to=cast(Type[EmailSettings], ResultWrapper[EmailSettings]), ) def get( @@ -175,7 +169,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailRoutingGetResponse: + ) -> EmailSettings: """ Get information about the settings for your Email Routing zone. @@ -201,7 +195,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[EmailRoutingGetResponse], ResultWrapper[EmailRoutingGetResponse]), + cast_to=cast(Type[EmailSettings], ResultWrapper[EmailSettings]), ) @@ -237,7 +231,7 @@ async def disable( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailRoutingDisableResponse: + ) -> EmailSettings: """Disable your Email Routing zone. Also removes additional MX records previously @@ -266,7 +260,7 @@ async def disable( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[EmailRoutingDisableResponse], ResultWrapper[EmailRoutingDisableResponse]), + cast_to=cast(Type[EmailSettings], ResultWrapper[EmailSettings]), ) async def enable( @@ -280,7 +274,7 @@ async def enable( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailRoutingEnableResponse: + ) -> EmailSettings: """Enable you Email Routing zone. Add and lock the necessary MX and SPF records. @@ -308,7 +302,7 @@ async def enable( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[EmailRoutingEnableResponse], ResultWrapper[EmailRoutingEnableResponse]), + cast_to=cast(Type[EmailSettings], ResultWrapper[EmailSettings]), ) async def get( @@ -321,7 +315,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailRoutingGetResponse: + ) -> EmailSettings: """ Get information about the settings for your Email Routing zone. @@ -347,7 +341,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[EmailRoutingGetResponse], ResultWrapper[EmailRoutingGetResponse]), + cast_to=cast(Type[EmailSettings], ResultWrapper[EmailSettings]), ) diff --git a/src/cloudflare/resources/email_routing/rules/catch_alls.py b/src/cloudflare/resources/email_routing/rules/catch_alls.py index be5a264dab1..368e4515c89 100644 --- a/src/cloudflare/resources/email_routing/rules/catch_alls.py +++ b/src/cloudflare/resources/email_routing/rules/catch_alls.py @@ -24,7 +24,7 @@ from ...._base_client import ( make_request_options, ) -from ....types.email_routing.rules import EmailCatchAllRule, catch_all_update_params +from ....types.email_routing.rules import ActionParam, MatcherParam, EmailCatchAllRule, catch_all_update_params __all__ = ["CatchAlls", "AsyncCatchAlls"] @@ -42,8 +42,8 @@ def update( self, zone_identifier: str, *, - actions: Iterable[catch_all_update_params.Action], - matchers: Iterable[catch_all_update_params.Matcher], + actions: Iterable[ActionParam], + matchers: Iterable[MatcherParam], enabled: Literal[True, False] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -152,8 +152,8 @@ async def update( self, zone_identifier: str, *, - actions: Iterable[catch_all_update_params.Action], - matchers: Iterable[catch_all_update_params.Matcher], + actions: Iterable[ActionParam], + matchers: Iterable[MatcherParam], enabled: Literal[True, False] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/cloudflare/resources/email_routing/rules/rules.py b/src/cloudflare/resources/email_routing/rules/rules.py index 3ebf372ee59..f6df8dfc380 100644 --- a/src/cloudflare/resources/email_routing/rules/rules.py +++ b/src/cloudflare/resources/email_routing/rules/rules.py @@ -35,11 +35,11 @@ make_request_options, ) from ....types.email_routing import ( - RuleGetResponse, - RuleListResponse, - RuleCreateResponse, - RuleDeleteResponse, - RuleUpdateResponse, + Properties, + ActionParam, + MatcherParam, + ActionItemParam, + MatcherItemParam, rule_list_params, rule_create_params, rule_update_params, @@ -65,8 +65,8 @@ def create( self, zone_identifier: str, *, - actions: Iterable[rule_create_params.Action], - matchers: Iterable[rule_create_params.Matcher], + actions: Iterable[ActionParam], + matchers: Iterable[MatcherParam], enabled: Literal[True, False] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, @@ -76,7 +76,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleCreateResponse: + ) -> Properties: """ Rules consist of a set of criteria for matching emails (such as an email being sent to a specific custom email address) plus a set of actions to take on the @@ -124,7 +124,7 @@ def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[RuleCreateResponse], ResultWrapper[RuleCreateResponse]), + cast_to=cast(Type[Properties], ResultWrapper[Properties]), ) def update( @@ -132,8 +132,8 @@ def update( rule_identifier: str, *, zone_identifier: str, - actions: Iterable[rule_update_params.Action], - matchers: Iterable[rule_update_params.Matcher], + actions: Iterable[ActionItemParam], + matchers: Iterable[MatcherItemParam], enabled: Literal[True, False] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, @@ -143,7 +143,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleUpdateResponse: + ) -> Properties: """ Update actions and matches, or enable/disable specific routing rules. @@ -193,7 +193,7 @@ def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[RuleUpdateResponse], ResultWrapper[RuleUpdateResponse]), + cast_to=cast(Type[Properties], ResultWrapper[Properties]), ) def list( @@ -209,7 +209,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[RuleListResponse]: + ) -> SyncV4PagePaginationArray[Properties]: """ Lists existing routing rules. @@ -234,7 +234,7 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return self._get_api_list( f"/zones/{zone_identifier}/email/routing/rules", - page=SyncV4PagePaginationArray[RuleListResponse], + page=SyncV4PagePaginationArray[Properties], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -249,7 +249,7 @@ def list( rule_list_params.RuleListParams, ), ), - model=RuleListResponse, + model=Properties, ) def delete( @@ -263,7 +263,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleDeleteResponse: + ) -> Properties: """ Delete a specific routing rule. @@ -293,7 +293,7 @@ def delete( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[RuleDeleteResponse], ResultWrapper[RuleDeleteResponse]), + cast_to=cast(Type[Properties], ResultWrapper[Properties]), ) def get( @@ -307,7 +307,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleGetResponse: + ) -> Properties: """ Get information for a specific routing rule already created. @@ -337,7 +337,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[RuleGetResponse], ResultWrapper[RuleGetResponse]), + cast_to=cast(Type[Properties], ResultWrapper[Properties]), ) @@ -358,8 +358,8 @@ async def create( self, zone_identifier: str, *, - actions: Iterable[rule_create_params.Action], - matchers: Iterable[rule_create_params.Matcher], + actions: Iterable[ActionParam], + matchers: Iterable[MatcherParam], enabled: Literal[True, False] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, @@ -369,7 +369,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleCreateResponse: + ) -> Properties: """ Rules consist of a set of criteria for matching emails (such as an email being sent to a specific custom email address) plus a set of actions to take on the @@ -417,7 +417,7 @@ async def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[RuleCreateResponse], ResultWrapper[RuleCreateResponse]), + cast_to=cast(Type[Properties], ResultWrapper[Properties]), ) async def update( @@ -425,8 +425,8 @@ async def update( rule_identifier: str, *, zone_identifier: str, - actions: Iterable[rule_update_params.Action], - matchers: Iterable[rule_update_params.Matcher], + actions: Iterable[ActionItemParam], + matchers: Iterable[MatcherItemParam], enabled: Literal[True, False] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, @@ -436,7 +436,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleUpdateResponse: + ) -> Properties: """ Update actions and matches, or enable/disable specific routing rules. @@ -486,7 +486,7 @@ async def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[RuleUpdateResponse], ResultWrapper[RuleUpdateResponse]), + cast_to=cast(Type[Properties], ResultWrapper[Properties]), ) def list( @@ -502,7 +502,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[RuleListResponse, AsyncV4PagePaginationArray[RuleListResponse]]: + ) -> AsyncPaginator[Properties, AsyncV4PagePaginationArray[Properties]]: """ Lists existing routing rules. @@ -527,7 +527,7 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return self._get_api_list( f"/zones/{zone_identifier}/email/routing/rules", - page=AsyncV4PagePaginationArray[RuleListResponse], + page=AsyncV4PagePaginationArray[Properties], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -542,7 +542,7 @@ def list( rule_list_params.RuleListParams, ), ), - model=RuleListResponse, + model=Properties, ) async def delete( @@ -556,7 +556,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleDeleteResponse: + ) -> Properties: """ Delete a specific routing rule. @@ -586,7 +586,7 @@ async def delete( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[RuleDeleteResponse], ResultWrapper[RuleDeleteResponse]), + cast_to=cast(Type[Properties], ResultWrapper[Properties]), ) async def get( @@ -600,7 +600,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleGetResponse: + ) -> Properties: """ Get information for a specific routing rule already created. @@ -630,7 +630,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[RuleGetResponse], ResultWrapper[RuleGetResponse]), + cast_to=cast(Type[Properties], ResultWrapper[Properties]), ) diff --git a/src/cloudflare/resources/load_balancers/pools/pools.py b/src/cloudflare/resources/load_balancers/pools/pools.py index 92026f9eb25..611e7389ba2 100644 --- a/src/cloudflare/resources/load_balancers/pools/pools.py +++ b/src/cloudflare/resources/load_balancers/pools/pools.py @@ -3,7 +3,6 @@ from __future__ import annotations from typing import List, Type, Iterable, Optional, cast -from typing_extensions import Literal import httpx @@ -15,6 +14,12 @@ HealthWithStreamingResponse, AsyncHealthWithStreamingResponse, ) +from ....types import ( + OriginItemParam, + LoadSheddingParam, + OriginSteeringParam, + NotificationFilterParam, +) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( maybe_transform, @@ -43,6 +48,7 @@ make_request_options, ) from ....types.load_balancers import ( + CheckRegion, PoolDeleteResponse, pool_edit_params, pool_list_params, @@ -77,17 +83,17 @@ def create( *, account_id: str, name: str, - origins: Iterable[pool_create_params.Origin], + origins: Iterable[OriginItemParam], description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_create_params.LoadShedding | NotGiven = NOT_GIVEN, + load_shedding: LoadSheddingParam | NotGiven = NOT_GIVEN, longitude: float | NotGiven = NOT_GIVEN, minimum_origins: int | NotGiven = NOT_GIVEN, monitor: object | NotGiven = NOT_GIVEN, notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_create_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_create_params.OriginSteering | NotGiven = NOT_GIVEN, + notification_filter: Optional[NotificationFilterParam] | NotGiven = NOT_GIVEN, + origin_steering: OriginSteeringParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -185,38 +191,18 @@ def update( *, account_id: str, name: str, - origins: Iterable[pool_update_params.Origin], - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, + origins: Iterable[OriginItemParam], + check_regions: Optional[List[CheckRegion]] | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_update_params.LoadShedding | NotGiven = NOT_GIVEN, + load_shedding: LoadSheddingParam | NotGiven = NOT_GIVEN, longitude: float | NotGiven = NOT_GIVEN, minimum_origins: int | NotGiven = NOT_GIVEN, monitor: object | NotGiven = NOT_GIVEN, notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_update_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_update_params.OriginSteering | NotGiven = NOT_GIVEN, + notification_filter: Optional[NotificationFilterParam] | NotGiven = NOT_GIVEN, + origin_steering: OriginSteeringParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -407,39 +393,19 @@ def edit( pool_id: str, *, account_id: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, + check_regions: Optional[List[CheckRegion]] | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_edit_params.LoadShedding | NotGiven = NOT_GIVEN, + load_shedding: LoadSheddingParam | NotGiven = NOT_GIVEN, longitude: float | NotGiven = NOT_GIVEN, minimum_origins: int | NotGiven = NOT_GIVEN, monitor: object | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_edit_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_edit_params.OriginSteering | NotGiven = NOT_GIVEN, - origins: Iterable[pool_edit_params.Origin] | NotGiven = NOT_GIVEN, + notification_filter: Optional[NotificationFilterParam] | NotGiven = NOT_GIVEN, + origin_steering: OriginSteeringParam | NotGiven = NOT_GIVEN, + origins: Iterable[OriginItemParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -602,17 +568,17 @@ async def create( *, account_id: str, name: str, - origins: Iterable[pool_create_params.Origin], + origins: Iterable[OriginItemParam], description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_create_params.LoadShedding | NotGiven = NOT_GIVEN, + load_shedding: LoadSheddingParam | NotGiven = NOT_GIVEN, longitude: float | NotGiven = NOT_GIVEN, minimum_origins: int | NotGiven = NOT_GIVEN, monitor: object | NotGiven = NOT_GIVEN, notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_create_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_create_params.OriginSteering | NotGiven = NOT_GIVEN, + notification_filter: Optional[NotificationFilterParam] | NotGiven = NOT_GIVEN, + origin_steering: OriginSteeringParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -710,38 +676,18 @@ async def update( *, account_id: str, name: str, - origins: Iterable[pool_update_params.Origin], - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, + origins: Iterable[OriginItemParam], + check_regions: Optional[List[CheckRegion]] | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_update_params.LoadShedding | NotGiven = NOT_GIVEN, + load_shedding: LoadSheddingParam | NotGiven = NOT_GIVEN, longitude: float | NotGiven = NOT_GIVEN, minimum_origins: int | NotGiven = NOT_GIVEN, monitor: object | NotGiven = NOT_GIVEN, notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_update_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_update_params.OriginSteering | NotGiven = NOT_GIVEN, + notification_filter: Optional[NotificationFilterParam] | NotGiven = NOT_GIVEN, + origin_steering: OriginSteeringParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -932,39 +878,19 @@ async def edit( pool_id: str, *, account_id: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, + check_regions: Optional[List[CheckRegion]] | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_edit_params.LoadShedding | NotGiven = NOT_GIVEN, + load_shedding: LoadSheddingParam | NotGiven = NOT_GIVEN, longitude: float | NotGiven = NOT_GIVEN, minimum_origins: int | NotGiven = NOT_GIVEN, monitor: object | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_edit_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_edit_params.OriginSteering | NotGiven = NOT_GIVEN, - origins: Iterable[pool_edit_params.Origin] | NotGiven = NOT_GIVEN, + notification_filter: Optional[NotificationFilterParam] | NotGiven = NOT_GIVEN, + origin_steering: OriginSteeringParam | NotGiven = NOT_GIVEN, + origins: Iterable[OriginItemParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/cloudflare/resources/user/load_balancers/pools.py b/src/cloudflare/resources/user/load_balancers/pools.py index fa7c933d28e..ac4d63bee98 100644 --- a/src/cloudflare/resources/user/load_balancers/pools.py +++ b/src/cloudflare/resources/user/load_balancers/pools.py @@ -7,6 +7,12 @@ import httpx +from ....types import ( + OriginParam, + LoadSheddingParam, + OriginSteeringParam, + NotificationFilterParam, +) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( maybe_transform, @@ -56,7 +62,7 @@ def create( self, *, name: str, - origins: Iterable[pool_create_params.Origin], + origins: Iterable[OriginParam], check_regions: Optional[ List[ Literal[ @@ -81,13 +87,13 @@ def create( description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_create_params.LoadShedding | NotGiven = NOT_GIVEN, + load_shedding: LoadSheddingParam | NotGiven = NOT_GIVEN, longitude: float | NotGiven = NOT_GIVEN, minimum_origins: int | NotGiven = NOT_GIVEN, monitor: object | NotGiven = NOT_GIVEN, notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_create_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_create_params.OriginSteering | NotGiven = NOT_GIVEN, + notification_filter: Optional[NotificationFilterParam] | NotGiven = NOT_GIVEN, + origin_steering: OriginSteeringParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -185,7 +191,7 @@ def update( pool_id: str, *, name: str, - origins: Iterable[pool_update_params.Origin], + origins: Iterable[OriginParam], check_regions: Optional[ List[ Literal[ @@ -210,13 +216,13 @@ def update( description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_update_params.LoadShedding | NotGiven = NOT_GIVEN, + load_shedding: LoadSheddingParam | NotGiven = NOT_GIVEN, longitude: float | NotGiven = NOT_GIVEN, minimum_origins: int | NotGiven = NOT_GIVEN, monitor: object | NotGiven = NOT_GIVEN, notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_update_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_update_params.OriginSteering | NotGiven = NOT_GIVEN, + notification_filter: Optional[NotificationFilterParam] | NotGiven = NOT_GIVEN, + origin_steering: OriginSteeringParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -417,15 +423,15 @@ def edit( description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_edit_params.LoadShedding | NotGiven = NOT_GIVEN, + load_shedding: LoadSheddingParam | NotGiven = NOT_GIVEN, longitude: float | NotGiven = NOT_GIVEN, minimum_origins: int | NotGiven = NOT_GIVEN, monitor: object | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_edit_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_edit_params.OriginSteering | NotGiven = NOT_GIVEN, - origins: Iterable[pool_edit_params.Origin] | NotGiven = NOT_GIVEN, + notification_filter: Optional[NotificationFilterParam] | NotGiven = NOT_GIVEN, + origin_steering: OriginSteeringParam | NotGiven = NOT_GIVEN, + origins: Iterable[OriginParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -774,7 +780,7 @@ async def create( self, *, name: str, - origins: Iterable[pool_create_params.Origin], + origins: Iterable[OriginParam], check_regions: Optional[ List[ Literal[ @@ -799,13 +805,13 @@ async def create( description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_create_params.LoadShedding | NotGiven = NOT_GIVEN, + load_shedding: LoadSheddingParam | NotGiven = NOT_GIVEN, longitude: float | NotGiven = NOT_GIVEN, minimum_origins: int | NotGiven = NOT_GIVEN, monitor: object | NotGiven = NOT_GIVEN, notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_create_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_create_params.OriginSteering | NotGiven = NOT_GIVEN, + notification_filter: Optional[NotificationFilterParam] | NotGiven = NOT_GIVEN, + origin_steering: OriginSteeringParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -903,7 +909,7 @@ async def update( pool_id: str, *, name: str, - origins: Iterable[pool_update_params.Origin], + origins: Iterable[OriginParam], check_regions: Optional[ List[ Literal[ @@ -928,13 +934,13 @@ async def update( description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_update_params.LoadShedding | NotGiven = NOT_GIVEN, + load_shedding: LoadSheddingParam | NotGiven = NOT_GIVEN, longitude: float | NotGiven = NOT_GIVEN, minimum_origins: int | NotGiven = NOT_GIVEN, monitor: object | NotGiven = NOT_GIVEN, notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_update_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_update_params.OriginSteering | NotGiven = NOT_GIVEN, + notification_filter: Optional[NotificationFilterParam] | NotGiven = NOT_GIVEN, + origin_steering: OriginSteeringParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1135,15 +1141,15 @@ async def edit( description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_edit_params.LoadShedding | NotGiven = NOT_GIVEN, + load_shedding: LoadSheddingParam | NotGiven = NOT_GIVEN, longitude: float | NotGiven = NOT_GIVEN, minimum_origins: int | NotGiven = NOT_GIVEN, monitor: object | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_edit_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_edit_params.OriginSteering | NotGiven = NOT_GIVEN, - origins: Iterable[pool_edit_params.Origin] | NotGiven = NOT_GIVEN, + notification_filter: Optional[NotificationFilterParam] | NotGiven = NOT_GIVEN, + origin_steering: OriginSteeringParam | NotGiven = NOT_GIVEN, + origins: Iterable[OriginParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py index befc92cfc81..7b121c5c722 100644 --- a/src/cloudflare/types/__init__.py +++ b/src/cloudflare/types/__init__.py @@ -3,8 +3,11 @@ from __future__ import annotations from .ips import IPs as IPs +from .ssl import SSL as SSL from .zone import Zone as Zone from .dnssec import DNSSEC as DNSSEC +from .header import Header as Header +from .origin import Origin as Origin from .shared import ( ErrorData as ErrorData, UnnamedSchemaRef025497b7e63379c31929636b5186e45c as UnnamedSchemaRef025497b7e63379c31929636b5186e45c, @@ -38,22 +41,32 @@ from .snippet import Snippet as Snippet from .log_rule import LogRule as LogRule from .calls_app import CallsApp as CallsApp +from .host_item import HostItem as HostItem from .skip_rule import SkipRule as SkipRule from .block_rule import BlockRule as BlockRule from .membership import Membership as Membership from .healthcheck import Healthcheck as Healthcheck from .jdcloud_ips import JDCloudIPs as JDCloudIPs +from .origin_item import OriginItem as OriginItem +from .check_region import CheckRegion as CheckRegion from .execute_rule import ExecuteRule as ExecuteRule +from .header_param import HeaderParam as HeaderParam +from .origin_param import OriginParam as OriginParam from .request_rule import RequestRule as RequestRule from .waiting_room import WaitingRoom as WaitingRoom from .load_balancer import LoadBalancer as LoadBalancer +from .load_shedding import LoadShedding as LoadShedding from .stream_videos import StreamVideos as StreamVideos +from .email_settings import EmailSettings as EmailSettings +from .filter_options import FilterOptions as FilterOptions from .ip_list_params import IPListParams as IPListParams from .log_rule_param import LogRuleParam as LogRuleParam from .zones_pagerule import ZonesPagerule as ZonesPagerule from .firewall_filter import FirewallFilter as FirewallFilter +from .origin_steering import OriginSteering as OriginSteering from .skip_rule_param import SkipRuleParam as SkipRuleParam from .block_rule_param import BlockRuleParam as BlockRuleParam +from .geo_restrictions import GeoRestrictions as GeoRestrictions from .ip_list_response import IPListResponse as IPListResponse from .mtls_certificate import MTLSCertificate as MTLSCertificate from .user_edit_params import UserEditParams as UserEditParams @@ -61,6 +74,7 @@ from .zone_list_params import ZoneListParams as ZoneListParams from .custom_nameserver import CustomNameserver as CustomNameserver from .observatory_trend import ObservatoryTrend as ObservatoryTrend +from .origin_item_param import OriginItemParam as OriginItemParam from .pcap_get_response import PCAPGetResponse as PCAPGetResponse from .cache_purge_params import CachePurgeParams as CachePurgeParams from .call_create_params import CallCreateParams as CallCreateParams @@ -78,6 +92,8 @@ from .zone_create_params import ZoneCreateParams as ZoneCreateParams from .account_list_params import AccountListParams as AccountListParams from .available_rate_plan import AvailableRatePlan as AvailableRatePlan +from .load_shedding_param import LoadSheddingParam as LoadSheddingParam +from .notification_filter import NotificationFilter as NotificationFilter from .page_shield_setting import PageShieldSetting as PageShieldSetting from .queue_create_params import QueueCreateParams as QueueCreateParams from .queue_delete_params import QueueDeleteParams as QueueDeleteParams @@ -88,6 +104,7 @@ from .dnssec_delete_params import DNSSECDeleteParams as DNSSECDeleteParams from .filter_create_params import FilterCreateParams as FilterCreateParams from .filter_delete_params import FilterDeleteParams as FilterDeleteParams +from .filter_options_param import FilterOptionsParam as FilterOptionsParam from .filter_update_params import FilterUpdateParams as FilterUpdateParams from .observatory_schedule import ObservatorySchedule as ObservatorySchedule from .pagerule_edit_params import PageruleEditParams as PageruleEditParams @@ -101,6 +118,7 @@ from .audit_log_list_params import AuditLogListParams as AuditLogListParams from .calls_app_with_secret import CallsAppWithSecret as CallsAppWithSecret from .origin_ca_certificate import OriginCACertificate as OriginCACertificate +from .origin_steering_param import OriginSteeringParam as OriginSteeringParam from .queue_create_response import QueueCreateResponse as QueueCreateResponse from .queue_update_response import QueueUpdateResponse as QueueUpdateResponse from .ruleset_create_params import RulesetCreateParams as RulesetCreateParams @@ -108,6 +126,7 @@ from .snippet_update_params import SnippetUpdateParams as SnippetUpdateParams from .speed_delete_response import SpeedDeleteResponse as SpeedDeleteResponse from .filter_create_response import FilterCreateResponse as FilterCreateResponse +from .geo_restrictions_param import GeoRestrictionsParam as GeoRestrictionsParam from .membership_list_params import MembershipListParams as MembershipListParams from .pagerule_create_params import PageruleCreateParams as PageruleCreateParams from .pagerule_delete_params import PageruleDeleteParams as PageruleDeleteParams @@ -136,13 +155,14 @@ from .healthcheck_update_params import HealthcheckUpdateParams as HealthcheckUpdateParams from .intel_phishing_url_submit import IntelPhishingURLSubmit as IntelPhishingURLSubmit from .load_balancer_edit_params import LoadBalancerEditParams as LoadBalancerEditParams +from .notification_filter_param import NotificationFilterParam as NotificationFilterParam from .page_shield_update_params import PageShieldUpdateParams as PageShieldUpdateParams from .speed_schedule_get_params import SpeedScheduleGetParams as SpeedScheduleGetParams from .url_scanner_scan_response import URLScannerScanResponse as URLScannerScanResponse -from .email_routing_get_response import EmailRoutingGetResponse as EmailRoutingGetResponse from .managed_header_edit_params import ManagedHeaderEditParams as ManagedHeaderEditParams from .membership_delete_response import MembershipDeleteResponse as MembershipDeleteResponse from .rate_limit_delete_response import RateLimitDeleteResponse as RateLimitDeleteResponse +from .subscription_configuration import SubscriptionConfiguration as SubscriptionConfiguration from .subscription_create_params import SubscriptionCreateParams as SubscriptionCreateParams from .subscription_delete_params import SubscriptionDeleteParams as SubscriptionDeleteParams from .subscription_list_response import SubscriptionListResponse as SubscriptionListResponse @@ -161,6 +181,7 @@ from .load_balancer_delete_params import LoadBalancerDeleteParams as LoadBalancerDeleteParams from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams from .page_shield_update_response import PageShieldUpdateResponse as PageShieldUpdateResponse +from .bot_fight_mode_configuration import BotFightModeConfiguration as BotFightModeConfiguration from .bot_management_update_params import BotManagementUpdateParams as BotManagementUpdateParams from .custom_hostname_get_response import CustomHostnameGetResponse as CustomHostnameGetResponse from .email_routing_disable_params import EmailRoutingDisableParams as EmailRoutingDisableParams @@ -175,7 +196,6 @@ from .custom_hostname_delete_params import CustomHostnameDeleteParams as CustomHostnameDeleteParams from .custom_hostname_edit_response import CustomHostnameEditResponse as CustomHostnameEditResponse from .custom_hostname_list_response import CustomHostnameListResponse as CustomHostnameListResponse -from .email_routing_enable_response import EmailRoutingEnableResponse as EmailRoutingEnableResponse from .load_balancer_delete_response import LoadBalancerDeleteResponse as LoadBalancerDeleteResponse from .warp_connector_token_response import WARPConnectorTokenResponse as WARPConnectorTokenResponse from .bot_management_update_response import BotManagementUpdateResponse as BotManagementUpdateResponse @@ -184,7 +204,6 @@ from .custom_certificate_edit_params import CustomCertificateEditParams as CustomCertificateEditParams from .custom_certificate_list_params import CustomCertificateListParams as CustomCertificateListParams from .custom_nameserver_get_response import CustomNameserverGetResponse as CustomNameserverGetResponse -from .email_routing_disable_response import EmailRoutingDisableResponse as EmailRoutingDisableResponse from .mtls_certificate_create_params import MTLSCertificateCreateParams as MTLSCertificateCreateParams from .mtls_certificate_delete_params import MTLSCertificateDeleteParams as MTLSCertificateDeleteParams from .url_normalization_get_response import URLNormalizationGetResponse as URLNormalizationGetResponse @@ -203,6 +222,7 @@ from .keyless_certificate_delete_params import KeylessCertificateDeleteParams as KeylessCertificateDeleteParams from .origin_ca_certificate_list_params import OriginCACertificateListParams as OriginCACertificateListParams from .url_normalization_update_response import URLNormalizationUpdateResponse as URLNormalizationUpdateResponse +from .super_bot_fight_mode_likely_config import SuperBotFightModeLikelyConfig as SuperBotFightModeLikelyConfig from .origin_ca_certificate_create_params import OriginCACertificateCreateParams as OriginCACertificateCreateParams from .origin_ca_certificate_delete_params import OriginCACertificateDeleteParams as OriginCACertificateDeleteParams from .origin_tls_client_auth_create_params import OriginTLSClientAuthCreateParams as OriginTLSClientAuthCreateParams @@ -214,6 +234,9 @@ from .origin_post_quantum_encryption_update_params import ( OriginPostQuantumEncryptionUpdateParams as OriginPostQuantumEncryptionUpdateParams, ) +from .super_bot_fight_mode_definitely_configuration import ( + SuperBotFightModeDefinitelyConfiguration as SuperBotFightModeDefinitelyConfiguration, +) from .unnamed_schema_ref_3b1a76a5e4a139b72ed7d93834773d39 import ( UnnamedSchemaRef3b1a76a5e4a139b72ed7d93834773d39 as UnnamedSchemaRef3b1a76a5e4a139b72ed7d93834773d39, ) diff --git a/src/cloudflare/types/accounts/__init__.py b/src/cloudflare/types/accounts/__init__.py index 5d011dbc291..9082dab5ab6 100644 --- a/src/cloudflare/types/accounts/__init__.py +++ b/src/cloudflare/types/accounts/__init__.py @@ -4,16 +4,12 @@ from .role import Role as Role from .member import Member as Member -from .role_param import RoleParam as RoleParam from .member_with_code import MemberWithCode as MemberWithCode from .permission_grant import PermissionGrant as PermissionGrant -from .member_permission import MemberPermission as MemberPermission from .member_list_params import MemberListParams as MemberListParams -from .role_list_response import RoleListResponse as RoleListResponse from .member_create_params import MemberCreateParams as MemberCreateParams from .member_delete_params import MemberDeleteParams as MemberDeleteParams from .member_list_response import MemberListResponse as MemberListResponse from .member_update_params import MemberUpdateParams as MemberUpdateParams from .member_delete_response import MemberDeleteResponse as MemberDeleteResponse from .permission_grant_param import PermissionGrantParam as PermissionGrantParam -from .member_permission_param import MemberPermissionParam as MemberPermissionParam diff --git a/src/cloudflare/types/accounts/member.py b/src/cloudflare/types/accounts/member.py index ed46dd07964..3aee13498fb 100644 --- a/src/cloudflare/types/accounts/member.py +++ b/src/cloudflare/types/accounts/member.py @@ -2,10 +2,23 @@ from typing import List, Optional -from .role import Role from ..._models import BaseModel +from ..user.tokens import Permission -__all__ = ["Member", "User"] +__all__ = ["Member", "Role", "User"] + + +class Role(BaseModel): + id: str + """Role identifier tag.""" + + description: str + """Description of role's permissions.""" + + name: str + """Role name.""" + + permissions: Permission class User(BaseModel): diff --git a/src/cloudflare/types/accounts/member_list_response.py b/src/cloudflare/types/accounts/member_list_response.py index 8df7afe8947..26182b74f97 100644 --- a/src/cloudflare/types/accounts/member_list_response.py +++ b/src/cloudflare/types/accounts/member_list_response.py @@ -3,23 +3,10 @@ from typing import List, Optional from typing_extensions import Literal +from .role import Role from ..._models import BaseModel -__all__ = ["MemberListResponse", "Role"] - - -class Role(BaseModel): - id: str - """Role identifier tag.""" - - description: str - """Description of role's permissions.""" - - name: str - """Role Name.""" - - permissions: List[str] - """Access permissions for this User.""" +__all__ = ["MemberListResponse"] class MemberListResponse(BaseModel): diff --git a/src/cloudflare/types/accounts/member_update_params.py b/src/cloudflare/types/accounts/member_update_params.py index c41c872c805..69867eb443e 100644 --- a/src/cloudflare/types/accounts/member_update_params.py +++ b/src/cloudflare/types/accounts/member_update_params.py @@ -5,13 +5,16 @@ from typing import Iterable from typing_extensions import Required, TypedDict -from .role_param import RoleParam - -__all__ = ["MemberUpdateParams"] +__all__ = ["MemberUpdateParams", "Role"] class MemberUpdateParams(TypedDict, total=False): account_id: Required[object] - roles: Required[Iterable[RoleParam]] + roles: Required[Iterable[Role]] """Roles assigned to this member.""" + + +class Role(TypedDict, total=False): + id: Required[str] + """Role identifier tag.""" diff --git a/src/cloudflare/types/accounts/member_with_code.py b/src/cloudflare/types/accounts/member_with_code.py index aa82792c67d..573cf9c8108 100644 --- a/src/cloudflare/types/accounts/member_with_code.py +++ b/src/cloudflare/types/accounts/member_with_code.py @@ -2,10 +2,23 @@ from typing import List, Optional -from .role import Role from ..._models import BaseModel +from ..user.tokens import Permission -__all__ = ["MemberWithCode", "User"] +__all__ = ["MemberWithCode", "Role", "User"] + + +class Role(BaseModel): + id: str + """Role identifier tag.""" + + description: str + """Description of role's permissions.""" + + name: str + """Role name.""" + + permissions: Permission class User(BaseModel): diff --git a/src/cloudflare/types/accounts/role.py b/src/cloudflare/types/accounts/role.py index d2b800e18cc..85afa978780 100644 --- a/src/cloudflare/types/accounts/role.py +++ b/src/cloudflare/types/accounts/role.py @@ -1,9 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - +from typing import List from ..._models import BaseModel -from .member_permission import MemberPermission __all__ = ["Role"] @@ -16,6 +15,7 @@ class Role(BaseModel): """Description of role's permissions.""" name: str - """Role name.""" + """Role Name.""" - permissions: MemberPermission + permissions: List[str] + """Access permissions for this User.""" diff --git a/src/cloudflare/types/accounts/role_list_response.py b/src/cloudflare/types/accounts/role_list_response.py deleted file mode 100644 index 864dfccca64..00000000000 --- a/src/cloudflare/types/accounts/role_list_response.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel - -__all__ = ["RoleListResponse"] - - -class RoleListResponse(BaseModel): - id: str - """Role identifier tag.""" - - description: str - """Description of role's permissions.""" - - name: str - """Role Name.""" - - permissions: List[str] - """Access permissions for this User.""" diff --git a/src/cloudflare/types/accounts/role_param.py b/src/cloudflare/types/accounts/role_param.py deleted file mode 100644 index 1ee83fe7e15..00000000000 --- a/src/cloudflare/types/accounts/role_param.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["RoleParam"] - - -class RoleParam(TypedDict, total=False): - id: Required[str] - """Role identifier tag.""" diff --git a/src/cloudflare/types/alerting/__init__.py b/src/cloudflare/types/alerting/__init__.py index e5286077d66..96634d18a8a 100644 --- a/src/cloudflare/types/alerting/__init__.py +++ b/src/cloudflare/types/alerting/__init__.py @@ -2,8 +2,12 @@ from __future__ import annotations +from .filters import Filters as Filters +from .policies import Policies as Policies +from .mechanisms import Mechanisms as Mechanisms +from .filters_param import FiltersParam as FiltersParam from .alerting_history import AlertingHistory as AlertingHistory -from .alerting_policies import AlertingPolicies as AlertingPolicies +from .mechanisms_param import MechanismsParam as MechanismsParam from .history_list_params import HistoryListParams as HistoryListParams from .policy_create_params import PolicyCreateParams as PolicyCreateParams from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams diff --git a/src/cloudflare/types/alerting/destinations/__init__.py b/src/cloudflare/types/alerting/destinations/__init__.py index 4b73d19b9a5..01c529883fd 100644 --- a/src/cloudflare/types/alerting/destinations/__init__.py +++ b/src/cloudflare/types/alerting/destinations/__init__.py @@ -2,8 +2,8 @@ from __future__ import annotations +from .pagerduty import Pagerduty as Pagerduty from .alerting_webhooks import AlertingWebhooks as AlertingWebhooks -from .alerting_pagerduty import AlertingPagerduty as AlertingPagerduty from .eligible_get_response import EligibleGetResponse as EligibleGetResponse from .webhook_create_params import WebhookCreateParams as WebhookCreateParams from .webhook_update_params import WebhookUpdateParams as WebhookUpdateParams diff --git a/src/cloudflare/types/alerting/destinations/alerting_pagerduty.py b/src/cloudflare/types/alerting/destinations/pagerduty.py similarity index 80% rename from src/cloudflare/types/alerting/destinations/alerting_pagerduty.py rename to src/cloudflare/types/alerting/destinations/pagerduty.py index bf3e2bed281..4996c44d9bc 100644 --- a/src/cloudflare/types/alerting/destinations/alerting_pagerduty.py +++ b/src/cloudflare/types/alerting/destinations/pagerduty.py @@ -4,10 +4,10 @@ from ...._models import BaseModel -__all__ = ["AlertingPagerduty"] +__all__ = ["Pagerduty"] -class AlertingPagerduty(BaseModel): +class Pagerduty(BaseModel): id: Optional[str] = None """UUID""" diff --git a/src/cloudflare/types/alerting/destinations/pagerduty_get_response.py b/src/cloudflare/types/alerting/destinations/pagerduty_get_response.py index 8069af80584..655283d7dbd 100644 --- a/src/cloudflare/types/alerting/destinations/pagerduty_get_response.py +++ b/src/cloudflare/types/alerting/destinations/pagerduty_get_response.py @@ -2,8 +2,8 @@ from typing import List -from .alerting_pagerduty import AlertingPagerduty +from .pagerduty import Pagerduty __all__ = ["PagerdutyGetResponse"] -PagerdutyGetResponse = List[AlertingPagerduty] +PagerdutyGetResponse = List[Pagerduty] diff --git a/src/cloudflare/types/alerting/alerting_policies.py b/src/cloudflare/types/alerting/filters.py similarity index 53% rename from src/cloudflare/types/alerting/alerting_policies.py rename to src/cloudflare/types/alerting/filters.py index 8c2ed617e3b..03f9104611c 100644 --- a/src/cloudflare/types/alerting/alerting_policies.py +++ b/src/cloudflare/types/alerting/filters.py @@ -1,12 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional -from datetime import datetime +from typing import List, Optional from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["AlertingPolicies", "Filters", "Mechanisms"] +__all__ = ["Filters"] class Filters(BaseModel): @@ -138,104 +137,3 @@ class Filters(BaseModel): zones: Optional[List[str]] = None """Usage depends on specific alert type""" - - -class Mechanisms(BaseModel): - id: Union[str, str, None] = None - """UUID""" - - -class AlertingPolicies(BaseModel): - id: Optional[str] = None - """The unique identifier of a notification policy""" - - alert_type: Optional[ - Literal[ - "access_custom_certificate_expiration_type", - "advanced_ddos_attack_l4_alert", - "advanced_ddos_attack_l7_alert", - "advanced_http_alert_error", - "bgp_hijack_notification", - "billing_usage_alert", - "block_notification_block_removed", - "block_notification_new_block", - "block_notification_review_rejected", - "brand_protection_alert", - "brand_protection_digest", - "clickhouse_alert_fw_anomaly", - "clickhouse_alert_fw_ent_anomaly", - "custom_ssl_certificate_event_type", - "dedicated_ssl_certificate_event_type", - "dos_attack_l4", - "dos_attack_l7", - "expiring_service_token_alert", - "failing_logpush_job_disabled_alert", - "fbm_auto_advertisement", - "fbm_dosd_attack", - "fbm_volumetric_attack", - "health_check_status_notification", - "hostname_aop_custom_certificate_expiration_type", - "http_alert_edge_error", - "http_alert_origin_error", - "incident_alert", - "load_balancing_health_alert", - "load_balancing_pool_enablement_alert", - "logo_match_alert", - "magic_tunnel_health_check_event", - "maintenance_event_notification", - "mtls_certificate_store_certificate_expiration_type", - "pages_event_alert", - "radar_notification", - "real_origin_monitoring", - "scriptmonitor_alert_new_code_change_detections", - "scriptmonitor_alert_new_hosts", - "scriptmonitor_alert_new_malicious_hosts", - "scriptmonitor_alert_new_malicious_scripts", - "scriptmonitor_alert_new_malicious_url", - "scriptmonitor_alert_new_max_length_resource_url", - "scriptmonitor_alert_new_resources", - "secondary_dns_all_primaries_failing", - "secondary_dns_primaries_failing", - "secondary_dns_zone_successfully_updated", - "secondary_dns_zone_validation_warning", - "sentinel_alert", - "stream_live_notifications", - "traffic_anomalies_alert", - "tunnel_health_event", - "tunnel_update_event", - "universal_ssl_event_type", - "web_analytics_metrics_update", - "zone_aop_custom_certificate_expiration_type", - ] - ] = None - """Refers to which event will trigger a Notification dispatch. - - You can use the endpoint to get available alert types which then will give you a - list of possible values. - """ - - created: Optional[datetime] = None - - description: Optional[str] = None - """Optional description for the Notification policy.""" - - enabled: Optional[bool] = None - """Whether or not the Notification policy is enabled.""" - - filters: Optional[Filters] = None - """ - Optional filters that allow you to be alerted only on a subset of events for - that alert type based on some criteria. This is only available for select alert - types. See alert type documentation for more details. - """ - - mechanisms: Optional[Dict[str, List[Mechanisms]]] = None - """List of IDs that will be used when dispatching a notification. - - IDs for email type will be the email address. - """ - - modified: Optional[datetime] = None - - name: Optional[str] = None - """Name of the policy.""" diff --git a/src/cloudflare/types/alerting/filters_param.py b/src/cloudflare/types/alerting/filters_param.py new file mode 100644 index 00000000000..8fa29b2146d --- /dev/null +++ b/src/cloudflare/types/alerting/filters_param.py @@ -0,0 +1,135 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal, TypedDict + +__all__ = ["FiltersParam"] + + +class FiltersParam(TypedDict, total=False): + actions: List[str] + """Usage depends on specific alert type""" + + affected_asns: List[str] + """Used for configuring radar_notification""" + + affected_components: List[str] + """Used for configuring incident_alert. + + A list of identifiers for each component to monitor. + """ + + affected_locations: List[str] + """Used for configuring radar_notification""" + + airport_code: List[str] + """Used for configuring maintenance_event_notification""" + + alert_trigger_preferences: List[str] + """Usage depends on specific alert type""" + + alert_trigger_preferences_value: List[Literal["99.0", "98.0", "97.0"]] + """Used for configuring magic_tunnel_health_check_event""" + + enabled: List[str] + """Used for configuring load_balancing_pool_enablement_alert""" + + environment: List[str] + """Used for configuring pages_event_alert""" + + event: List[str] + """Used for configuring pages_event_alert""" + + event_source: List[str] + """Used for configuring load_balancing_health_alert""" + + event_type: List[str] + """Usage depends on specific alert type""" + + group_by: List[str] + """Usage depends on specific alert type""" + + health_check_id: List[str] + """Used for configuring health_check_status_notification""" + + incident_impact: List[ + Literal["INCIDENT_IMPACT_NONE", "INCIDENT_IMPACT_MINOR", "INCIDENT_IMPACT_MAJOR", "INCIDENT_IMPACT_CRITICAL"] + ] + """Used for configuring incident_alert""" + + input_id: List[str] + """Used for configuring stream_live_notifications""" + + limit: List[str] + """Used for configuring billing_usage_alert""" + + logo_tag: List[str] + """Used for configuring logo_match_alert""" + + megabits_per_second: List[str] + """Used for configuring advanced_ddos_attack_l4_alert""" + + new_health: List[str] + """Used for configuring load_balancing_health_alert""" + + new_status: List[str] + """Used for configuring tunnel_health_event""" + + packets_per_second: List[str] + """Used for configuring advanced_ddos_attack_l4_alert""" + + pool_id: List[str] + """Usage depends on specific alert type""" + + product: List[str] + """Used for configuring billing_usage_alert""" + + project_id: List[str] + """Used for configuring pages_event_alert""" + + protocol: List[str] + """Used for configuring advanced_ddos_attack_l4_alert""" + + query_tag: List[str] + """Usage depends on specific alert type""" + + requests_per_second: List[str] + """Used for configuring advanced_ddos_attack_l7_alert""" + + selectors: List[str] + """Usage depends on specific alert type""" + + services: List[str] + """Used for configuring clickhouse_alert_fw_ent_anomaly""" + + slo: List[str] + """Usage depends on specific alert type""" + + status: List[str] + """Used for configuring health_check_status_notification""" + + target_hostname: List[str] + """Used for configuring advanced_ddos_attack_l7_alert""" + + target_ip: List[str] + """Used for configuring advanced_ddos_attack_l4_alert""" + + target_zone_name: List[str] + """Used for configuring advanced_ddos_attack_l7_alert""" + + traffic_exclusions: List[Literal["security_events"]] + """Used for configuring traffic_anomalies_alert""" + + tunnel_id: List[str] + """Used for configuring tunnel_health_event""" + + tunnel_name: List[str] + """Used for configuring magic_tunnel_health_check_event""" + + where: List[str] + """Usage depends on specific alert type""" + + zones: List[str] + """Usage depends on specific alert type""" diff --git a/src/cloudflare/types/alerting/mechanisms.py b/src/cloudflare/types/alerting/mechanisms.py new file mode 100644 index 00000000000..b1f8a37d232 --- /dev/null +++ b/src/cloudflare/types/alerting/mechanisms.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Union + +from ..._models import BaseModel + +__all__ = ["Mechanisms", "MechanismsItem"] + + +class MechanismsItem(BaseModel): + id: Union[str, str, None] = None + """UUID""" + + +Mechanisms = Dict[str, List[MechanismsItem]] diff --git a/src/cloudflare/types/alerting/mechanisms_param.py b/src/cloudflare/types/alerting/mechanisms_param.py new file mode 100644 index 00000000000..2fbf9784513 --- /dev/null +++ b/src/cloudflare/types/alerting/mechanisms_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union, Iterable +from typing_extensions import TypedDict + +__all__ = ["MechanismsParam", "MechanismsParamItem"] + + +class MechanismsParamItem(TypedDict, total=False): + id: Union[str, str] + """UUID""" + + +MechanismsParam = Dict[str, Iterable[MechanismsParamItem]] diff --git a/src/cloudflare/types/alerting/policies.py b/src/cloudflare/types/alerting/policies.py new file mode 100644 index 00000000000..9c1d7e611ba --- /dev/null +++ b/src/cloudflare/types/alerting/policies.py @@ -0,0 +1,107 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from .filters import Filters +from ..._models import BaseModel +from .mechanisms import Mechanisms + +__all__ = ["Policies"] + + +class Policies(BaseModel): + id: Optional[str] = None + """The unique identifier of a notification policy""" + + alert_type: Optional[ + Literal[ + "access_custom_certificate_expiration_type", + "advanced_ddos_attack_l4_alert", + "advanced_ddos_attack_l7_alert", + "advanced_http_alert_error", + "bgp_hijack_notification", + "billing_usage_alert", + "block_notification_block_removed", + "block_notification_new_block", + "block_notification_review_rejected", + "brand_protection_alert", + "brand_protection_digest", + "clickhouse_alert_fw_anomaly", + "clickhouse_alert_fw_ent_anomaly", + "custom_ssl_certificate_event_type", + "dedicated_ssl_certificate_event_type", + "dos_attack_l4", + "dos_attack_l7", + "expiring_service_token_alert", + "failing_logpush_job_disabled_alert", + "fbm_auto_advertisement", + "fbm_dosd_attack", + "fbm_volumetric_attack", + "health_check_status_notification", + "hostname_aop_custom_certificate_expiration_type", + "http_alert_edge_error", + "http_alert_origin_error", + "incident_alert", + "load_balancing_health_alert", + "load_balancing_pool_enablement_alert", + "logo_match_alert", + "magic_tunnel_health_check_event", + "maintenance_event_notification", + "mtls_certificate_store_certificate_expiration_type", + "pages_event_alert", + "radar_notification", + "real_origin_monitoring", + "scriptmonitor_alert_new_code_change_detections", + "scriptmonitor_alert_new_hosts", + "scriptmonitor_alert_new_malicious_hosts", + "scriptmonitor_alert_new_malicious_scripts", + "scriptmonitor_alert_new_malicious_url", + "scriptmonitor_alert_new_max_length_resource_url", + "scriptmonitor_alert_new_resources", + "secondary_dns_all_primaries_failing", + "secondary_dns_primaries_failing", + "secondary_dns_zone_successfully_updated", + "secondary_dns_zone_validation_warning", + "sentinel_alert", + "stream_live_notifications", + "traffic_anomalies_alert", + "tunnel_health_event", + "tunnel_update_event", + "universal_ssl_event_type", + "web_analytics_metrics_update", + "zone_aop_custom_certificate_expiration_type", + ] + ] = None + """Refers to which event will trigger a Notification dispatch. + + You can use the endpoint to get available alert types which then will give you a + list of possible values. + """ + + created: Optional[datetime] = None + + description: Optional[str] = None + """Optional description for the Notification policy.""" + + enabled: Optional[bool] = None + """Whether or not the Notification policy is enabled.""" + + filters: Optional[Filters] = None + """ + Optional filters that allow you to be alerted only on a subset of events for + that alert type based on some criteria. This is only available for select alert + types. See alert type documentation for more details. + """ + + mechanisms: Optional[Mechanisms] = None + """List of IDs that will be used when dispatching a notification. + + IDs for email type will be the email address. + """ + + modified: Optional[datetime] = None + + name: Optional[str] = None + """Name of the policy.""" diff --git a/src/cloudflare/types/alerting/policy_create_params.py b/src/cloudflare/types/alerting/policy_create_params.py index 375514ca5ed..4427f7d5c9a 100644 --- a/src/cloudflare/types/alerting/policy_create_params.py +++ b/src/cloudflare/types/alerting/policy_create_params.py @@ -2,10 +2,12 @@ from __future__ import annotations -from typing import Dict, List, Union, Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["PolicyCreateParams", "Mechanisms", "Filters"] +from .filters_param import FiltersParam +from .mechanisms_param import MechanismsParam + +__all__ = ["PolicyCreateParams"] class PolicyCreateParams(TypedDict, total=False): @@ -80,7 +82,7 @@ class PolicyCreateParams(TypedDict, total=False): enabled: Required[bool] """Whether or not the Notification policy is enabled.""" - mechanisms: Required[Dict[str, Iterable[Mechanisms]]] + mechanisms: Required[MechanismsParam] """List of IDs that will be used when dispatching a notification. IDs for email type will be the email address. @@ -92,141 +94,9 @@ class PolicyCreateParams(TypedDict, total=False): description: str """Optional description for the Notification policy.""" - filters: Filters + filters: FiltersParam """ Optional filters that allow you to be alerted only on a subset of events for that alert type based on some criteria. This is only available for select alert types. See alert type documentation for more details. """ - - -class Mechanisms(TypedDict, total=False): - id: Union[str, str] - """UUID""" - - -class Filters(TypedDict, total=False): - actions: List[str] - """Usage depends on specific alert type""" - - affected_asns: List[str] - """Used for configuring radar_notification""" - - affected_components: List[str] - """Used for configuring incident_alert. - - A list of identifiers for each component to monitor. - """ - - affected_locations: List[str] - """Used for configuring radar_notification""" - - airport_code: List[str] - """Used for configuring maintenance_event_notification""" - - alert_trigger_preferences: List[str] - """Usage depends on specific alert type""" - - alert_trigger_preferences_value: List[Literal["99.0", "98.0", "97.0"]] - """Used for configuring magic_tunnel_health_check_event""" - - enabled: List[str] - """Used for configuring load_balancing_pool_enablement_alert""" - - environment: List[str] - """Used for configuring pages_event_alert""" - - event: List[str] - """Used for configuring pages_event_alert""" - - event_source: List[str] - """Used for configuring load_balancing_health_alert""" - - event_type: List[str] - """Usage depends on specific alert type""" - - group_by: List[str] - """Usage depends on specific alert type""" - - health_check_id: List[str] - """Used for configuring health_check_status_notification""" - - incident_impact: List[ - Literal["INCIDENT_IMPACT_NONE", "INCIDENT_IMPACT_MINOR", "INCIDENT_IMPACT_MAJOR", "INCIDENT_IMPACT_CRITICAL"] - ] - """Used for configuring incident_alert""" - - input_id: List[str] - """Used for configuring stream_live_notifications""" - - limit: List[str] - """Used for configuring billing_usage_alert""" - - logo_tag: List[str] - """Used for configuring logo_match_alert""" - - megabits_per_second: List[str] - """Used for configuring advanced_ddos_attack_l4_alert""" - - new_health: List[str] - """Used for configuring load_balancing_health_alert""" - - new_status: List[str] - """Used for configuring tunnel_health_event""" - - packets_per_second: List[str] - """Used for configuring advanced_ddos_attack_l4_alert""" - - pool_id: List[str] - """Usage depends on specific alert type""" - - product: List[str] - """Used for configuring billing_usage_alert""" - - project_id: List[str] - """Used for configuring pages_event_alert""" - - protocol: List[str] - """Used for configuring advanced_ddos_attack_l4_alert""" - - query_tag: List[str] - """Usage depends on specific alert type""" - - requests_per_second: List[str] - """Used for configuring advanced_ddos_attack_l7_alert""" - - selectors: List[str] - """Usage depends on specific alert type""" - - services: List[str] - """Used for configuring clickhouse_alert_fw_ent_anomaly""" - - slo: List[str] - """Usage depends on specific alert type""" - - status: List[str] - """Used for configuring health_check_status_notification""" - - target_hostname: List[str] - """Used for configuring advanced_ddos_attack_l7_alert""" - - target_ip: List[str] - """Used for configuring advanced_ddos_attack_l4_alert""" - - target_zone_name: List[str] - """Used for configuring advanced_ddos_attack_l7_alert""" - - traffic_exclusions: List[Literal["security_events"]] - """Used for configuring traffic_anomalies_alert""" - - tunnel_id: List[str] - """Used for configuring tunnel_health_event""" - - tunnel_name: List[str] - """Used for configuring magic_tunnel_health_check_event""" - - where: List[str] - """Usage depends on specific alert type""" - - zones: List[str] - """Usage depends on specific alert type""" diff --git a/src/cloudflare/types/alerting/policy_update_params.py b/src/cloudflare/types/alerting/policy_update_params.py index 13e1d774ea4..0aff9faf028 100644 --- a/src/cloudflare/types/alerting/policy_update_params.py +++ b/src/cloudflare/types/alerting/policy_update_params.py @@ -2,10 +2,12 @@ from __future__ import annotations -from typing import Dict, List, Union, Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["PolicyUpdateParams", "Filters", "Mechanisms"] +from .filters_param import FiltersParam +from .mechanisms_param import MechanismsParam + +__all__ = ["PolicyUpdateParams"] class PolicyUpdateParams(TypedDict, total=False): @@ -81,14 +83,14 @@ class PolicyUpdateParams(TypedDict, total=False): enabled: bool """Whether or not the Notification policy is enabled.""" - filters: Filters + filters: FiltersParam """ Optional filters that allow you to be alerted only on a subset of events for that alert type based on some criteria. This is only available for select alert types. See alert type documentation for more details. """ - mechanisms: Dict[str, Iterable[Mechanisms]] + mechanisms: MechanismsParam """List of IDs that will be used when dispatching a notification. IDs for email type will be the email address. @@ -96,135 +98,3 @@ class PolicyUpdateParams(TypedDict, total=False): name: str """Name of the policy.""" - - -class Filters(TypedDict, total=False): - actions: List[str] - """Usage depends on specific alert type""" - - affected_asns: List[str] - """Used for configuring radar_notification""" - - affected_components: List[str] - """Used for configuring incident_alert. - - A list of identifiers for each component to monitor. - """ - - affected_locations: List[str] - """Used for configuring radar_notification""" - - airport_code: List[str] - """Used for configuring maintenance_event_notification""" - - alert_trigger_preferences: List[str] - """Usage depends on specific alert type""" - - alert_trigger_preferences_value: List[Literal["99.0", "98.0", "97.0"]] - """Used for configuring magic_tunnel_health_check_event""" - - enabled: List[str] - """Used for configuring load_balancing_pool_enablement_alert""" - - environment: List[str] - """Used for configuring pages_event_alert""" - - event: List[str] - """Used for configuring pages_event_alert""" - - event_source: List[str] - """Used for configuring load_balancing_health_alert""" - - event_type: List[str] - """Usage depends on specific alert type""" - - group_by: List[str] - """Usage depends on specific alert type""" - - health_check_id: List[str] - """Used for configuring health_check_status_notification""" - - incident_impact: List[ - Literal["INCIDENT_IMPACT_NONE", "INCIDENT_IMPACT_MINOR", "INCIDENT_IMPACT_MAJOR", "INCIDENT_IMPACT_CRITICAL"] - ] - """Used for configuring incident_alert""" - - input_id: List[str] - """Used for configuring stream_live_notifications""" - - limit: List[str] - """Used for configuring billing_usage_alert""" - - logo_tag: List[str] - """Used for configuring logo_match_alert""" - - megabits_per_second: List[str] - """Used for configuring advanced_ddos_attack_l4_alert""" - - new_health: List[str] - """Used for configuring load_balancing_health_alert""" - - new_status: List[str] - """Used for configuring tunnel_health_event""" - - packets_per_second: List[str] - """Used for configuring advanced_ddos_attack_l4_alert""" - - pool_id: List[str] - """Usage depends on specific alert type""" - - product: List[str] - """Used for configuring billing_usage_alert""" - - project_id: List[str] - """Used for configuring pages_event_alert""" - - protocol: List[str] - """Used for configuring advanced_ddos_attack_l4_alert""" - - query_tag: List[str] - """Usage depends on specific alert type""" - - requests_per_second: List[str] - """Used for configuring advanced_ddos_attack_l7_alert""" - - selectors: List[str] - """Usage depends on specific alert type""" - - services: List[str] - """Used for configuring clickhouse_alert_fw_ent_anomaly""" - - slo: List[str] - """Usage depends on specific alert type""" - - status: List[str] - """Used for configuring health_check_status_notification""" - - target_hostname: List[str] - """Used for configuring advanced_ddos_attack_l7_alert""" - - target_ip: List[str] - """Used for configuring advanced_ddos_attack_l4_alert""" - - target_zone_name: List[str] - """Used for configuring advanced_ddos_attack_l7_alert""" - - traffic_exclusions: List[Literal["security_events"]] - """Used for configuring traffic_anomalies_alert""" - - tunnel_id: List[str] - """Used for configuring tunnel_health_event""" - - tunnel_name: List[str] - """Used for configuring magic_tunnel_health_check_event""" - - where: List[str] - """Usage depends on specific alert type""" - - zones: List[str] - """Usage depends on specific alert type""" - - -class Mechanisms(TypedDict, total=False): - id: Union[str, str] - """UUID""" diff --git a/src/cloudflare/types/bot_fight_mode_configuration.py b/src/cloudflare/types/bot_fight_mode_configuration.py new file mode 100644 index 00000000000..e7b51148237 --- /dev/null +++ b/src/cloudflare/types/bot_fight_mode_configuration.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .._models import BaseModel + +__all__ = ["BotFightModeConfiguration"] + + +class BotFightModeConfiguration(BaseModel): + enable_js: Optional[bool] = None + """Use lightweight, invisible JavaScript detections to improve Bot Management. + + [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + """ + + fight_mode: Optional[bool] = None + """Whether to enable Bot Fight Mode.""" + + using_latest_model: Optional[bool] = None + """ + A read-only field that indicates whether the zone currently is running the + latest ML model. + """ diff --git a/src/cloudflare/types/bot_management_get_response.py b/src/cloudflare/types/bot_management_get_response.py index 2e45674d755..986e592ad15 100644 --- a/src/cloudflare/types/bot_management_get_response.py +++ b/src/cloudflare/types/bot_management_get_response.py @@ -1,129 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional -from typing_extensions import Literal +from typing import Union -from .._models import BaseModel - -__all__ = [ - "BotManagementGetResponse", - "BotManagementBotFightModeConfig", - "BotManagementSbfmDefinitelyConfig", - "BotManagementSbfmLikelyConfig", - "BotManagementBmSubscriptionConfig", -] - - -class BotManagementBotFightModeConfig(BaseModel): - enable_js: Optional[bool] = None - """Use lightweight, invisible JavaScript detections to improve Bot Management. - - [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). - """ - - fight_mode: Optional[bool] = None - """Whether to enable Bot Fight Mode.""" - - using_latest_model: Optional[bool] = None - """ - A read-only field that indicates whether the zone currently is running the - latest ML model. - """ - - -class BotManagementSbfmDefinitelyConfig(BaseModel): - enable_js: Optional[bool] = None - """Use lightweight, invisible JavaScript detections to improve Bot Management. - - [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). - """ - - optimize_wordpress: Optional[bool] = None - """Whether to optimize Super Bot Fight Mode protections for Wordpress.""" - - sbfm_definitely_automated: Optional[Literal["allow", "block", "managed_challenge"]] = None - """Super Bot Fight Mode (SBFM) action to take on definitely automated requests.""" - - sbfm_static_resource_protection: Optional[bool] = None - """ - Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if - static resources on your application need bot protection. Note: Static resource - protection can also result in legitimate traffic being blocked. - """ - - sbfm_verified_bots: Optional[Literal["allow", "block"]] = None - """Super Bot Fight Mode (SBFM) action to take on verified bots requests.""" - - using_latest_model: Optional[bool] = None - """ - A read-only field that indicates whether the zone currently is running the - latest ML model. - """ - - -class BotManagementSbfmLikelyConfig(BaseModel): - enable_js: Optional[bool] = None - """Use lightweight, invisible JavaScript detections to improve Bot Management. - - [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). - """ - - optimize_wordpress: Optional[bool] = None - """Whether to optimize Super Bot Fight Mode protections for Wordpress.""" - - sbfm_definitely_automated: Optional[Literal["allow", "block", "managed_challenge"]] = None - """Super Bot Fight Mode (SBFM) action to take on definitely automated requests.""" - - sbfm_likely_automated: Optional[Literal["allow", "block", "managed_challenge"]] = None - """Super Bot Fight Mode (SBFM) action to take on likely automated requests.""" - - sbfm_static_resource_protection: Optional[bool] = None - """ - Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if - static resources on your application need bot protection. Note: Static resource - protection can also result in legitimate traffic being blocked. - """ - - sbfm_verified_bots: Optional[Literal["allow", "block"]] = None - """Super Bot Fight Mode (SBFM) action to take on verified bots requests.""" - - using_latest_model: Optional[bool] = None - """ - A read-only field that indicates whether the zone currently is running the - latest ML model. - """ - - -class BotManagementBmSubscriptionConfig(BaseModel): - auto_update_model: Optional[bool] = None - """ - Automatically update to the newest bot detection models created by Cloudflare as - they are released. - [Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes) - """ - - enable_js: Optional[bool] = None - """Use lightweight, invisible JavaScript detections to improve Bot Management. - - [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). - """ - - suppress_session_score: Optional[bool] = None - """ - Whether to disable tracking the highest bot score for a session in the Bot - Management cookie. - """ - - using_latest_model: Optional[bool] = None - """ - A read-only field that indicates whether the zone currently is running the - latest ML model. - """ +from .subscription_configuration import SubscriptionConfiguration +from .bot_fight_mode_configuration import BotFightModeConfiguration +from .super_bot_fight_mode_likely_config import SuperBotFightModeLikelyConfig +from .super_bot_fight_mode_definitely_configuration import SuperBotFightModeDefinitelyConfiguration +__all__ = ["BotManagementGetResponse"] BotManagementGetResponse = Union[ - BotManagementBotFightModeConfig, - BotManagementSbfmDefinitelyConfig, - BotManagementSbfmLikelyConfig, - BotManagementBmSubscriptionConfig, + BotFightModeConfiguration, + SuperBotFightModeDefinitelyConfiguration, + SuperBotFightModeLikelyConfig, + SubscriptionConfiguration, ] diff --git a/src/cloudflare/types/bot_management_update_params.py b/src/cloudflare/types/bot_management_update_params.py index 107db4627ef..c919147a1f6 100644 --- a/src/cloudflare/types/bot_management_update_params.py +++ b/src/cloudflare/types/bot_management_update_params.py @@ -7,14 +7,14 @@ __all__ = [ "BotManagementUpdateParams", - "BotManagementBotFightModeConfig", - "BotManagementSbfmDefinitelyConfig", - "BotManagementSbfmLikelyConfig", - "BotManagementBmSubscriptionConfig", + "BotFightModeConfiguration", + "SuperBotFightModeDefinitelyConfiguration", + "SuperBotFightModeLikelyConfig", + "SubscriptionConfiguration", ] -class BotManagementBotFightModeConfig(TypedDict, total=False): +class BotFightModeConfiguration(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -28,7 +28,7 @@ class BotManagementBotFightModeConfig(TypedDict, total=False): """Whether to enable Bot Fight Mode.""" -class BotManagementSbfmDefinitelyConfig(TypedDict, total=False): +class SuperBotFightModeDefinitelyConfiguration(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -55,7 +55,7 @@ class BotManagementSbfmDefinitelyConfig(TypedDict, total=False): """Super Bot Fight Mode (SBFM) action to take on verified bots requests.""" -class BotManagementSbfmLikelyConfig(TypedDict, total=False): +class SuperBotFightModeLikelyConfig(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -85,7 +85,7 @@ class BotManagementSbfmLikelyConfig(TypedDict, total=False): """Super Bot Fight Mode (SBFM) action to take on verified bots requests.""" -class BotManagementBmSubscriptionConfig(TypedDict, total=False): +class SubscriptionConfiguration(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -110,8 +110,8 @@ class BotManagementBmSubscriptionConfig(TypedDict, total=False): BotManagementUpdateParams = Union[ - BotManagementBotFightModeConfig, - BotManagementSbfmDefinitelyConfig, - BotManagementSbfmLikelyConfig, - BotManagementBmSubscriptionConfig, + BotFightModeConfiguration, + SuperBotFightModeDefinitelyConfiguration, + SuperBotFightModeLikelyConfig, + SubscriptionConfiguration, ] diff --git a/src/cloudflare/types/bot_management_update_response.py b/src/cloudflare/types/bot_management_update_response.py index 239f1f5583c..fe91c9e3a53 100644 --- a/src/cloudflare/types/bot_management_update_response.py +++ b/src/cloudflare/types/bot_management_update_response.py @@ -1,129 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional -from typing_extensions import Literal +from typing import Union -from .._models import BaseModel - -__all__ = [ - "BotManagementUpdateResponse", - "BotManagementBotFightModeConfig", - "BotManagementSbfmDefinitelyConfig", - "BotManagementSbfmLikelyConfig", - "BotManagementBmSubscriptionConfig", -] - - -class BotManagementBotFightModeConfig(BaseModel): - enable_js: Optional[bool] = None - """Use lightweight, invisible JavaScript detections to improve Bot Management. - - [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). - """ - - fight_mode: Optional[bool] = None - """Whether to enable Bot Fight Mode.""" - - using_latest_model: Optional[bool] = None - """ - A read-only field that indicates whether the zone currently is running the - latest ML model. - """ - - -class BotManagementSbfmDefinitelyConfig(BaseModel): - enable_js: Optional[bool] = None - """Use lightweight, invisible JavaScript detections to improve Bot Management. - - [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). - """ - - optimize_wordpress: Optional[bool] = None - """Whether to optimize Super Bot Fight Mode protections for Wordpress.""" - - sbfm_definitely_automated: Optional[Literal["allow", "block", "managed_challenge"]] = None - """Super Bot Fight Mode (SBFM) action to take on definitely automated requests.""" - - sbfm_static_resource_protection: Optional[bool] = None - """ - Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if - static resources on your application need bot protection. Note: Static resource - protection can also result in legitimate traffic being blocked. - """ - - sbfm_verified_bots: Optional[Literal["allow", "block"]] = None - """Super Bot Fight Mode (SBFM) action to take on verified bots requests.""" - - using_latest_model: Optional[bool] = None - """ - A read-only field that indicates whether the zone currently is running the - latest ML model. - """ - - -class BotManagementSbfmLikelyConfig(BaseModel): - enable_js: Optional[bool] = None - """Use lightweight, invisible JavaScript detections to improve Bot Management. - - [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). - """ - - optimize_wordpress: Optional[bool] = None - """Whether to optimize Super Bot Fight Mode protections for Wordpress.""" - - sbfm_definitely_automated: Optional[Literal["allow", "block", "managed_challenge"]] = None - """Super Bot Fight Mode (SBFM) action to take on definitely automated requests.""" - - sbfm_likely_automated: Optional[Literal["allow", "block", "managed_challenge"]] = None - """Super Bot Fight Mode (SBFM) action to take on likely automated requests.""" - - sbfm_static_resource_protection: Optional[bool] = None - """ - Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if - static resources on your application need bot protection. Note: Static resource - protection can also result in legitimate traffic being blocked. - """ - - sbfm_verified_bots: Optional[Literal["allow", "block"]] = None - """Super Bot Fight Mode (SBFM) action to take on verified bots requests.""" - - using_latest_model: Optional[bool] = None - """ - A read-only field that indicates whether the zone currently is running the - latest ML model. - """ - - -class BotManagementBmSubscriptionConfig(BaseModel): - auto_update_model: Optional[bool] = None - """ - Automatically update to the newest bot detection models created by Cloudflare as - they are released. - [Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes) - """ - - enable_js: Optional[bool] = None - """Use lightweight, invisible JavaScript detections to improve Bot Management. - - [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). - """ - - suppress_session_score: Optional[bool] = None - """ - Whether to disable tracking the highest bot score for a session in the Bot - Management cookie. - """ - - using_latest_model: Optional[bool] = None - """ - A read-only field that indicates whether the zone currently is running the - latest ML model. - """ +from .subscription_configuration import SubscriptionConfiguration +from .bot_fight_mode_configuration import BotFightModeConfiguration +from .super_bot_fight_mode_likely_config import SuperBotFightModeLikelyConfig +from .super_bot_fight_mode_definitely_configuration import SuperBotFightModeDefinitelyConfiguration +__all__ = ["BotManagementUpdateResponse"] BotManagementUpdateResponse = Union[ - BotManagementBotFightModeConfig, - BotManagementSbfmDefinitelyConfig, - BotManagementSbfmLikelyConfig, - BotManagementBmSubscriptionConfig, + BotFightModeConfiguration, + SuperBotFightModeDefinitelyConfiguration, + SuperBotFightModeLikelyConfig, + SubscriptionConfiguration, ] diff --git a/src/cloudflare/types/certificate_authorities/__init__.py b/src/cloudflare/types/certificate_authorities/__init__.py index 8136d1b91d4..7efe48f1557 100644 --- a/src/cloudflare/types/certificate_authorities/__init__.py +++ b/src/cloudflare/types/certificate_authorities/__init__.py @@ -2,6 +2,7 @@ from __future__ import annotations +from .hostname_association_item import HostnameAssociationItem as HostnameAssociationItem from .hostname_association_get_params import HostnameAssociationGetParams as HostnameAssociationGetParams from .hostname_association_get_response import HostnameAssociationGetResponse as HostnameAssociationGetResponse from .hostname_association_update_params import HostnameAssociationUpdateParams as HostnameAssociationUpdateParams diff --git a/src/cloudflare/types/certificate_authorities/hostname_association_get_response.py b/src/cloudflare/types/certificate_authorities/hostname_association_get_response.py index 6eeccbfc43c..f966e735f09 100644 --- a/src/cloudflare/types/certificate_authorities/hostname_association_get_response.py +++ b/src/cloudflare/types/certificate_authorities/hostname_association_get_response.py @@ -3,9 +3,10 @@ from typing import List, Optional from ..._models import BaseModel +from .hostname_association_item import HostnameAssociationItem __all__ = ["HostnameAssociationGetResponse"] class HostnameAssociationGetResponse(BaseModel): - hostnames: Optional[List[str]] = None + hostnames: Optional[List[HostnameAssociationItem]] = None diff --git a/src/cloudflare/types/certificate_authorities/hostname_association_item.py b/src/cloudflare/types/certificate_authorities/hostname_association_item.py new file mode 100644 index 00000000000..ef20010b249 --- /dev/null +++ b/src/cloudflare/types/certificate_authorities/hostname_association_item.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["HostnameAssociationItem"] + +HostnameAssociationItem = str diff --git a/src/cloudflare/types/certificate_authorities/hostname_association_update_params.py b/src/cloudflare/types/certificate_authorities/hostname_association_update_params.py index 7912fa39b88..38b31a37d29 100644 --- a/src/cloudflare/types/certificate_authorities/hostname_association_update_params.py +++ b/src/cloudflare/types/certificate_authorities/hostname_association_update_params.py @@ -5,6 +5,8 @@ from typing import List from typing_extensions import Required, TypedDict +from .hostname_association_item import HostnameAssociationItem + __all__ = ["HostnameAssociationUpdateParams"] @@ -12,7 +14,7 @@ class HostnameAssociationUpdateParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - hostnames: List[str] + hostnames: List[HostnameAssociationItem] mtls_certificate_id: str """ diff --git a/src/cloudflare/types/certificate_authorities/hostname_association_update_response.py b/src/cloudflare/types/certificate_authorities/hostname_association_update_response.py index 8d4318ab148..d030b1d419e 100644 --- a/src/cloudflare/types/certificate_authorities/hostname_association_update_response.py +++ b/src/cloudflare/types/certificate_authorities/hostname_association_update_response.py @@ -3,9 +3,10 @@ from typing import List, Optional from ..._models import BaseModel +from .hostname_association_item import HostnameAssociationItem __all__ = ["HostnameAssociationUpdateResponse"] class HostnameAssociationUpdateResponse(BaseModel): - hostnames: Optional[List[str]] = None + hostnames: Optional[List[HostnameAssociationItem]] = None diff --git a/src/cloudflare/types/challenges/__init__.py b/src/cloudflare/types/challenges/__init__.py index 21538f16a7a..22e66506673 100644 --- a/src/cloudflare/types/challenges/__init__.py +++ b/src/cloudflare/types/challenges/__init__.py @@ -7,4 +7,5 @@ from .widget_create_params import WidgetCreateParams as WidgetCreateParams from .widget_update_params import WidgetUpdateParams as WidgetUpdateParams from .challenges_widget_list import ChallengesWidgetList as ChallengesWidgetList +from .challenges_widget_list_item import ChallengesWidgetListItem as ChallengesWidgetListItem from .widget_rotate_secret_params import WidgetRotateSecretParams as WidgetRotateSecretParams diff --git a/src/cloudflare/types/challenges/challenges_widget_list_item.py b/src/cloudflare/types/challenges/challenges_widget_list_item.py new file mode 100644 index 00000000000..fcc5472ccc8 --- /dev/null +++ b/src/cloudflare/types/challenges/challenges_widget_list_item.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["ChallengesWidgetListItem"] + +ChallengesWidgetListItem = str diff --git a/src/cloudflare/types/challenges/widget_create_params.py b/src/cloudflare/types/challenges/widget_create_params.py index c12b864c2f9..e82e70921d5 100644 --- a/src/cloudflare/types/challenges/widget_create_params.py +++ b/src/cloudflare/types/challenges/widget_create_params.py @@ -5,6 +5,8 @@ from typing import List from typing_extensions import Literal, Required, TypedDict +from .challenges_widget_list_item import ChallengesWidgetListItem + __all__ = ["WidgetCreateParams"] @@ -12,7 +14,7 @@ class WidgetCreateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - domains: Required[List[str]] + domains: Required[List[ChallengesWidgetListItem]] mode: Required[Literal["non-interactive", "invisible", "managed"]] """Widget Mode""" diff --git a/src/cloudflare/types/challenges/widget_update_params.py b/src/cloudflare/types/challenges/widget_update_params.py index c3b9786d726..5912619cb23 100644 --- a/src/cloudflare/types/challenges/widget_update_params.py +++ b/src/cloudflare/types/challenges/widget_update_params.py @@ -5,6 +5,8 @@ from typing import List from typing_extensions import Literal, Required, TypedDict +from .challenges_widget_list_item import ChallengesWidgetListItem + __all__ = ["WidgetUpdateParams"] @@ -12,7 +14,7 @@ class WidgetUpdateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - domains: Required[List[str]] + domains: Required[List[ChallengesWidgetListItem]] mode: Required[Literal["non-interactive", "invisible", "managed"]] """Widget Mode""" diff --git a/src/cloudflare/types/check_region.py b/src/cloudflare/types/check_region.py new file mode 100644 index 00000000000..195c879900e --- /dev/null +++ b/src/cloudflare/types/check_region.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["CheckRegion"] + +CheckRegion = Literal[ + "WNAM", "ENAM", "WEU", "EEU", "NSAM", "SSAM", "OC", "ME", "NAF", "SAF", "SAS", "SEAS", "NEAS", "ALL_REGIONS" +] diff --git a/src/cloudflare/types/custom_certificate.py b/src/cloudflare/types/custom_certificate.py index 5f3858dbbf3..18476cff9f3 100644 --- a/src/cloudflare/types/custom_certificate.py +++ b/src/cloudflare/types/custom_certificate.py @@ -5,14 +5,11 @@ from typing_extensions import Literal from .._models import BaseModel +from .geo_restrictions import GeoRestrictions from .keyless_certificate_hostname import KeylessCertificateHostname from .unnamed_schema_ref_16aca57bde2963201c7e6e895436c1c1 import UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 -__all__ = ["CustomCertificate", "GeoRestrictions"] - - -class GeoRestrictions(BaseModel): - label: Optional[Literal["us", "eu", "highest_security"]] = None +__all__ = ["CustomCertificate"] class CustomCertificate(BaseModel): diff --git a/src/cloudflare/types/custom_certificate_create_params.py b/src/cloudflare/types/custom_certificate_create_params.py index 2abf4aea085..eb91110f357 100644 --- a/src/cloudflare/types/custom_certificate_create_params.py +++ b/src/cloudflare/types/custom_certificate_create_params.py @@ -4,9 +4,10 @@ from typing_extensions import Literal, Required, TypedDict +from .geo_restrictions_param import GeoRestrictionsParam from .unnamed_schema_ref_16aca57bde2963201c7e6e895436c1c1 import UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 -__all__ = ["CustomCertificateCreateParams", "GeoRestrictions"] +__all__ = ["CustomCertificateCreateParams"] class CustomCertificateCreateParams(TypedDict, total=False): @@ -27,7 +28,7 @@ class CustomCertificateCreateParams(TypedDict, total=False): chain, but does not otherwise modify it. """ - geo_restrictions: GeoRestrictions + geo_restrictions: GeoRestrictionsParam """ Specify the region where your private key can be held locally for optimal TLS performance. HTTPS connections to any excluded data center will still be fully @@ -56,7 +57,3 @@ class CustomCertificateCreateParams(TypedDict, total=False): The type 'legacy_custom' enables support for legacy clients which do not include SNI in the TLS handshake. """ - - -class GeoRestrictions(TypedDict, total=False): - label: Literal["us", "eu", "highest_security"] diff --git a/src/cloudflare/types/custom_certificate_edit_params.py b/src/cloudflare/types/custom_certificate_edit_params.py index b4d3168cd42..246e6fe60ed 100644 --- a/src/cloudflare/types/custom_certificate_edit_params.py +++ b/src/cloudflare/types/custom_certificate_edit_params.py @@ -2,11 +2,12 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict +from .geo_restrictions_param import GeoRestrictionsParam from .unnamed_schema_ref_16aca57bde2963201c7e6e895436c1c1 import UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 -__all__ = ["CustomCertificateEditParams", "GeoRestrictions"] +__all__ = ["CustomCertificateEditParams"] class CustomCertificateEditParams(TypedDict, total=False): @@ -24,7 +25,7 @@ class CustomCertificateEditParams(TypedDict, total=False): certificate: str """The zone's SSL certificate or certificate and the intermediate(s).""" - geo_restrictions: GeoRestrictions + geo_restrictions: GeoRestrictionsParam """ Specify the region where your private key can be held locally for optimal TLS performance. HTTPS connections to any excluded data center will still be fully @@ -50,7 +51,3 @@ class CustomCertificateEditParams(TypedDict, total=False): private_key: str """The zone's private key.""" - - -class GeoRestrictions(TypedDict, total=False): - label: Literal["us", "eu", "highest_security"] diff --git a/src/cloudflare/types/custom_hostname_create_response.py b/src/cloudflare/types/custom_hostname_create_response.py index a603b2eb091..5cfc2e42a29 100644 --- a/src/cloudflare/types/custom_hostname_create_response.py +++ b/src/cloudflare/types/custom_hostname_create_response.py @@ -1,162 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal -from .._models import BaseModel -from .unnamed_schema_ref_9a9935a9a770967bb604ae41a81e42e1 import UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1 -from .unnamed_schema_ref_16aca57bde2963201c7e6e895436c1c1 import UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 -from .unnamed_schema_ref_78adb375f06c6d462dd92b99e2ecf510 import UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510 - -__all__ = ["CustomHostnameCreateResponse", "SSL", "SSLSettings", "SSLValidationError", "SSLValidationRecord"] - - -class SSLSettings(BaseModel): - ciphers: Optional[List[str]] = None - """An allowlist of ciphers for TLS termination. - - These ciphers must be in the BoringSSL format. - """ - - early_hints: Optional[Literal["on", "off"]] = None - """Whether or not Early Hints is enabled.""" - - http2: Optional[Literal["on", "off"]] = None - """Whether or not HTTP2 is enabled.""" - - min_tls_version: Optional[Literal["1.0", "1.1", "1.2", "1.3"]] = None - """The minimum TLS version supported.""" - - tls_1_3: Optional[Literal["on", "off"]] = None - """Whether or not TLS 1.3 is enabled.""" - - -class SSLValidationError(BaseModel): - message: Optional[str] = None - """A domain validation error.""" - - -class SSLValidationRecord(BaseModel): - emails: Optional[List[object]] = None - """ - The set of email addresses that the certificate authority (CA) will use to - complete domain validation. - """ - - http_body: Optional[str] = None - """ - The content that the certificate authority (CA) will expect to find at the - http_url during the domain validation. - """ - - http_url: Optional[str] = None - """The url that will be checked during domain validation.""" - - txt_name: Optional[str] = None - """ - The hostname that the certificate authority (CA) will check for a TXT record - during domain validation . - """ - - txt_value: Optional[str] = None - """ - The TXT record that the certificate authority (CA) will check during domain - validation. - """ - - -class SSL(BaseModel): - id: Optional[str] = None - """Custom hostname SSL identifier tag.""" - bundle_method: Optional[UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1] = None - """ - A ubiquitous bundle has the highest probability of being verified everywhere, - even by clients using outdated or unusual trust stores. An optimal bundle uses - the shortest chain and newest intermediates. And the force bundle verifies the - chain, but does not otherwise modify it. - """ - - certificate_authority: Optional[Literal["digicert", "google", "lets_encrypt"]] = None - """The Certificate Authority that will issue the certificate""" - - custom_certificate: Optional[str] = None - """If a custom uploaded certificate is used.""" - - custom_csr_id: Optional[str] = None - """The identifier for the Custom CSR that was used.""" - - custom_key: Optional[str] = None - """The key for a custom uploaded certificate.""" - - expires_on: Optional[datetime] = None - """The time the custom certificate expires on.""" - - hosts: Optional[List[object]] = None - """A list of Hostnames on a custom uploaded certificate.""" - - issuer: Optional[str] = None - """The issuer on a custom uploaded certificate.""" - - method: Optional[UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510] = None - """Domain control validation (DCV) method used for this hostname.""" - - serial_number: Optional[str] = None - """The serial number on a custom uploaded certificate.""" - - settings: Optional[SSLSettings] = None - """SSL specific settings.""" - - signature: Optional[str] = None - """The signature on a custom uploaded certificate.""" - - status: Optional[ - Literal[ - "initializing", - "pending_validation", - "deleted", - "pending_issuance", - "pending_deployment", - "pending_deletion", - "pending_expiration", - "expired", - "active", - "initializing_timed_out", - "validation_timed_out", - "issuance_timed_out", - "deployment_timed_out", - "deletion_timed_out", - "pending_cleanup", - "staging_deployment", - "staging_active", - "deactivating", - "inactive", - "backup_issued", - "holding_deployment", - ] - ] = None - """Status of the hostname's SSL certificates.""" - - type: Optional[UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1] = None - """Level of validation to be used for this hostname. - - Domain validation (dv) must be used. - """ - - uploaded_on: Optional[datetime] = None - """The time the custom certificate was uploaded.""" - - validation_errors: Optional[List[SSLValidationError]] = None - """ - Domain validation errors that have been received by the certificate authority - (CA). - """ - - validation_records: Optional[List[SSLValidationRecord]] = None +from .ssl import SSL +from .._models import BaseModel - wildcard: Optional[bool] = None - """Indicates whether the certificate covers a wildcard.""" +__all__ = ["CustomHostnameCreateResponse"] class CustomHostnameCreateResponse(BaseModel): diff --git a/src/cloudflare/types/custom_hostname_edit_response.py b/src/cloudflare/types/custom_hostname_edit_response.py index b496ab08e54..345ce00cada 100644 --- a/src/cloudflare/types/custom_hostname_edit_response.py +++ b/src/cloudflare/types/custom_hostname_edit_response.py @@ -1,162 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal -from .._models import BaseModel -from .unnamed_schema_ref_9a9935a9a770967bb604ae41a81e42e1 import UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1 -from .unnamed_schema_ref_16aca57bde2963201c7e6e895436c1c1 import UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 -from .unnamed_schema_ref_78adb375f06c6d462dd92b99e2ecf510 import UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510 - -__all__ = ["CustomHostnameEditResponse", "SSL", "SSLSettings", "SSLValidationError", "SSLValidationRecord"] - - -class SSLSettings(BaseModel): - ciphers: Optional[List[str]] = None - """An allowlist of ciphers for TLS termination. - - These ciphers must be in the BoringSSL format. - """ - - early_hints: Optional[Literal["on", "off"]] = None - """Whether or not Early Hints is enabled.""" - - http2: Optional[Literal["on", "off"]] = None - """Whether or not HTTP2 is enabled.""" - - min_tls_version: Optional[Literal["1.0", "1.1", "1.2", "1.3"]] = None - """The minimum TLS version supported.""" - - tls_1_3: Optional[Literal["on", "off"]] = None - """Whether or not TLS 1.3 is enabled.""" - - -class SSLValidationError(BaseModel): - message: Optional[str] = None - """A domain validation error.""" - - -class SSLValidationRecord(BaseModel): - emails: Optional[List[object]] = None - """ - The set of email addresses that the certificate authority (CA) will use to - complete domain validation. - """ - - http_body: Optional[str] = None - """ - The content that the certificate authority (CA) will expect to find at the - http_url during the domain validation. - """ - - http_url: Optional[str] = None - """The url that will be checked during domain validation.""" - - txt_name: Optional[str] = None - """ - The hostname that the certificate authority (CA) will check for a TXT record - during domain validation . - """ - - txt_value: Optional[str] = None - """ - The TXT record that the certificate authority (CA) will check during domain - validation. - """ - - -class SSL(BaseModel): - id: Optional[str] = None - """Custom hostname SSL identifier tag.""" - bundle_method: Optional[UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1] = None - """ - A ubiquitous bundle has the highest probability of being verified everywhere, - even by clients using outdated or unusual trust stores. An optimal bundle uses - the shortest chain and newest intermediates. And the force bundle verifies the - chain, but does not otherwise modify it. - """ - - certificate_authority: Optional[Literal["digicert", "google", "lets_encrypt"]] = None - """The Certificate Authority that will issue the certificate""" - - custom_certificate: Optional[str] = None - """If a custom uploaded certificate is used.""" - - custom_csr_id: Optional[str] = None - """The identifier for the Custom CSR that was used.""" - - custom_key: Optional[str] = None - """The key for a custom uploaded certificate.""" - - expires_on: Optional[datetime] = None - """The time the custom certificate expires on.""" - - hosts: Optional[List[object]] = None - """A list of Hostnames on a custom uploaded certificate.""" - - issuer: Optional[str] = None - """The issuer on a custom uploaded certificate.""" - - method: Optional[UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510] = None - """Domain control validation (DCV) method used for this hostname.""" - - serial_number: Optional[str] = None - """The serial number on a custom uploaded certificate.""" - - settings: Optional[SSLSettings] = None - """SSL specific settings.""" - - signature: Optional[str] = None - """The signature on a custom uploaded certificate.""" - - status: Optional[ - Literal[ - "initializing", - "pending_validation", - "deleted", - "pending_issuance", - "pending_deployment", - "pending_deletion", - "pending_expiration", - "expired", - "active", - "initializing_timed_out", - "validation_timed_out", - "issuance_timed_out", - "deployment_timed_out", - "deletion_timed_out", - "pending_cleanup", - "staging_deployment", - "staging_active", - "deactivating", - "inactive", - "backup_issued", - "holding_deployment", - ] - ] = None - """Status of the hostname's SSL certificates.""" - - type: Optional[UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1] = None - """Level of validation to be used for this hostname. - - Domain validation (dv) must be used. - """ - - uploaded_on: Optional[datetime] = None - """The time the custom certificate was uploaded.""" - - validation_errors: Optional[List[SSLValidationError]] = None - """ - Domain validation errors that have been received by the certificate authority - (CA). - """ - - validation_records: Optional[List[SSLValidationRecord]] = None +from .ssl import SSL +from .._models import BaseModel - wildcard: Optional[bool] = None - """Indicates whether the certificate covers a wildcard.""" +__all__ = ["CustomHostnameEditResponse"] class CustomHostnameEditResponse(BaseModel): diff --git a/src/cloudflare/types/custom_hostname_get_response.py b/src/cloudflare/types/custom_hostname_get_response.py index 49a33c4e221..b3fdc712778 100644 --- a/src/cloudflare/types/custom_hostname_get_response.py +++ b/src/cloudflare/types/custom_hostname_get_response.py @@ -1,162 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal -from .._models import BaseModel -from .unnamed_schema_ref_9a9935a9a770967bb604ae41a81e42e1 import UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1 -from .unnamed_schema_ref_16aca57bde2963201c7e6e895436c1c1 import UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 -from .unnamed_schema_ref_78adb375f06c6d462dd92b99e2ecf510 import UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510 - -__all__ = ["CustomHostnameGetResponse", "SSL", "SSLSettings", "SSLValidationError", "SSLValidationRecord"] - - -class SSLSettings(BaseModel): - ciphers: Optional[List[str]] = None - """An allowlist of ciphers for TLS termination. - - These ciphers must be in the BoringSSL format. - """ - - early_hints: Optional[Literal["on", "off"]] = None - """Whether or not Early Hints is enabled.""" - - http2: Optional[Literal["on", "off"]] = None - """Whether or not HTTP2 is enabled.""" - - min_tls_version: Optional[Literal["1.0", "1.1", "1.2", "1.3"]] = None - """The minimum TLS version supported.""" - - tls_1_3: Optional[Literal["on", "off"]] = None - """Whether or not TLS 1.3 is enabled.""" - - -class SSLValidationError(BaseModel): - message: Optional[str] = None - """A domain validation error.""" - - -class SSLValidationRecord(BaseModel): - emails: Optional[List[object]] = None - """ - The set of email addresses that the certificate authority (CA) will use to - complete domain validation. - """ - - http_body: Optional[str] = None - """ - The content that the certificate authority (CA) will expect to find at the - http_url during the domain validation. - """ - - http_url: Optional[str] = None - """The url that will be checked during domain validation.""" - - txt_name: Optional[str] = None - """ - The hostname that the certificate authority (CA) will check for a TXT record - during domain validation . - """ - - txt_value: Optional[str] = None - """ - The TXT record that the certificate authority (CA) will check during domain - validation. - """ - - -class SSL(BaseModel): - id: Optional[str] = None - """Custom hostname SSL identifier tag.""" - bundle_method: Optional[UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1] = None - """ - A ubiquitous bundle has the highest probability of being verified everywhere, - even by clients using outdated or unusual trust stores. An optimal bundle uses - the shortest chain and newest intermediates. And the force bundle verifies the - chain, but does not otherwise modify it. - """ - - certificate_authority: Optional[Literal["digicert", "google", "lets_encrypt"]] = None - """The Certificate Authority that will issue the certificate""" - - custom_certificate: Optional[str] = None - """If a custom uploaded certificate is used.""" - - custom_csr_id: Optional[str] = None - """The identifier for the Custom CSR that was used.""" - - custom_key: Optional[str] = None - """The key for a custom uploaded certificate.""" - - expires_on: Optional[datetime] = None - """The time the custom certificate expires on.""" - - hosts: Optional[List[object]] = None - """A list of Hostnames on a custom uploaded certificate.""" - - issuer: Optional[str] = None - """The issuer on a custom uploaded certificate.""" - - method: Optional[UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510] = None - """Domain control validation (DCV) method used for this hostname.""" - - serial_number: Optional[str] = None - """The serial number on a custom uploaded certificate.""" - - settings: Optional[SSLSettings] = None - """SSL specific settings.""" - - signature: Optional[str] = None - """The signature on a custom uploaded certificate.""" - - status: Optional[ - Literal[ - "initializing", - "pending_validation", - "deleted", - "pending_issuance", - "pending_deployment", - "pending_deletion", - "pending_expiration", - "expired", - "active", - "initializing_timed_out", - "validation_timed_out", - "issuance_timed_out", - "deployment_timed_out", - "deletion_timed_out", - "pending_cleanup", - "staging_deployment", - "staging_active", - "deactivating", - "inactive", - "backup_issued", - "holding_deployment", - ] - ] = None - """Status of the hostname's SSL certificates.""" - - type: Optional[UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1] = None - """Level of validation to be used for this hostname. - - Domain validation (dv) must be used. - """ - - uploaded_on: Optional[datetime] = None - """The time the custom certificate was uploaded.""" - - validation_errors: Optional[List[SSLValidationError]] = None - """ - Domain validation errors that have been received by the certificate authority - (CA). - """ - - validation_records: Optional[List[SSLValidationRecord]] = None +from .ssl import SSL +from .._models import BaseModel - wildcard: Optional[bool] = None - """Indicates whether the certificate covers a wildcard.""" +__all__ = ["CustomHostnameGetResponse"] class CustomHostnameGetResponse(BaseModel): diff --git a/src/cloudflare/types/custom_hostname_list_response.py b/src/cloudflare/types/custom_hostname_list_response.py index 83eaba97332..8b443e4f0c3 100644 --- a/src/cloudflare/types/custom_hostname_list_response.py +++ b/src/cloudflare/types/custom_hostname_list_response.py @@ -1,162 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal -from .._models import BaseModel -from .unnamed_schema_ref_9a9935a9a770967bb604ae41a81e42e1 import UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1 -from .unnamed_schema_ref_16aca57bde2963201c7e6e895436c1c1 import UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 -from .unnamed_schema_ref_78adb375f06c6d462dd92b99e2ecf510 import UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510 - -__all__ = ["CustomHostnameListResponse", "SSL", "SSLSettings", "SSLValidationError", "SSLValidationRecord"] - - -class SSLSettings(BaseModel): - ciphers: Optional[List[str]] = None - """An allowlist of ciphers for TLS termination. - - These ciphers must be in the BoringSSL format. - """ - - early_hints: Optional[Literal["on", "off"]] = None - """Whether or not Early Hints is enabled.""" - - http2: Optional[Literal["on", "off"]] = None - """Whether or not HTTP2 is enabled.""" - - min_tls_version: Optional[Literal["1.0", "1.1", "1.2", "1.3"]] = None - """The minimum TLS version supported.""" - - tls_1_3: Optional[Literal["on", "off"]] = None - """Whether or not TLS 1.3 is enabled.""" - - -class SSLValidationError(BaseModel): - message: Optional[str] = None - """A domain validation error.""" - - -class SSLValidationRecord(BaseModel): - emails: Optional[List[object]] = None - """ - The set of email addresses that the certificate authority (CA) will use to - complete domain validation. - """ - - http_body: Optional[str] = None - """ - The content that the certificate authority (CA) will expect to find at the - http_url during the domain validation. - """ - - http_url: Optional[str] = None - """The url that will be checked during domain validation.""" - - txt_name: Optional[str] = None - """ - The hostname that the certificate authority (CA) will check for a TXT record - during domain validation . - """ - - txt_value: Optional[str] = None - """ - The TXT record that the certificate authority (CA) will check during domain - validation. - """ - - -class SSL(BaseModel): - id: Optional[str] = None - """Custom hostname SSL identifier tag.""" - bundle_method: Optional[UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1] = None - """ - A ubiquitous bundle has the highest probability of being verified everywhere, - even by clients using outdated or unusual trust stores. An optimal bundle uses - the shortest chain and newest intermediates. And the force bundle verifies the - chain, but does not otherwise modify it. - """ - - certificate_authority: Optional[Literal["digicert", "google", "lets_encrypt"]] = None - """The Certificate Authority that will issue the certificate""" - - custom_certificate: Optional[str] = None - """If a custom uploaded certificate is used.""" - - custom_csr_id: Optional[str] = None - """The identifier for the Custom CSR that was used.""" - - custom_key: Optional[str] = None - """The key for a custom uploaded certificate.""" - - expires_on: Optional[datetime] = None - """The time the custom certificate expires on.""" - - hosts: Optional[List[object]] = None - """A list of Hostnames on a custom uploaded certificate.""" - - issuer: Optional[str] = None - """The issuer on a custom uploaded certificate.""" - - method: Optional[UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510] = None - """Domain control validation (DCV) method used for this hostname.""" - - serial_number: Optional[str] = None - """The serial number on a custom uploaded certificate.""" - - settings: Optional[SSLSettings] = None - """SSL specific settings.""" - - signature: Optional[str] = None - """The signature on a custom uploaded certificate.""" - - status: Optional[ - Literal[ - "initializing", - "pending_validation", - "deleted", - "pending_issuance", - "pending_deployment", - "pending_deletion", - "pending_expiration", - "expired", - "active", - "initializing_timed_out", - "validation_timed_out", - "issuance_timed_out", - "deployment_timed_out", - "deletion_timed_out", - "pending_cleanup", - "staging_deployment", - "staging_active", - "deactivating", - "inactive", - "backup_issued", - "holding_deployment", - ] - ] = None - """Status of the hostname's SSL certificates.""" - - type: Optional[UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1] = None - """Level of validation to be used for this hostname. - - Domain validation (dv) must be used. - """ - - uploaded_on: Optional[datetime] = None - """The time the custom certificate was uploaded.""" - - validation_errors: Optional[List[SSLValidationError]] = None - """ - Domain validation errors that have been received by the certificate authority - (CA). - """ - - validation_records: Optional[List[SSLValidationRecord]] = None +from .ssl import SSL +from .._models import BaseModel - wildcard: Optional[bool] = None - """Indicates whether the certificate covers a wildcard.""" +__all__ = ["CustomHostnameListResponse"] class CustomHostnameListResponse(BaseModel): diff --git a/src/cloudflare/types/dns/__init__.py b/src/cloudflare/types/dns/__init__.py index 034fe473382..8caa3149394 100644 --- a/src/cloudflare/types/dns/__init__.py +++ b/src/cloudflare/types/dns/__init__.py @@ -27,9 +27,12 @@ from .dnskey_record import DNSKEYRecord as DNSKEYRecord from .smimea_record import SMIMEARecord as SMIMEARecord from .record_tags_item import RecordTagsItem as RecordTagsItem +from .attack_mitigation import AttackMitigation as AttackMitigation +from .firewall_ips_item import FirewallIPsItem as FirewallIPsItem from .record_edit_params import RecordEditParams as RecordEditParams from .record_list_params import RecordListParams as RecordListParams from .record_scan_params import RecordScanParams as RecordScanParams +from .upstream_ips_items import UpstreamIPsItems as UpstreamIPsItems from .firewall_edit_params import FirewallEditParams as FirewallEditParams from .firewall_list_params import FirewallListParams as FirewallListParams from .record_create_params import RecordCreateParams as RecordCreateParams @@ -42,7 +45,10 @@ from .record_delete_response import RecordDeleteResponse as RecordDeleteResponse from .record_export_response import RecordExportResponse as RecordExportResponse from .record_import_response import RecordImportResponse as RecordImportResponse +from .attack_mitigation_param import AttackMitigationParam as AttackMitigationParam +from .firewall_ips_item_param import FirewallIPsItemParam as FirewallIPsItemParam from .firewall_delete_response import FirewallDeleteResponse as FirewallDeleteResponse +from .upstream_ips_items_param import UpstreamIPsItemsParam as UpstreamIPsItemsParam from .unnamed_schema_ref_2f895e023ae55b55d2f5925449b819cd import ( UnnamedSchemaRef2f895e023ae55b55d2f5925449b819cd as UnnamedSchemaRef2f895e023ae55b55d2f5925449b819cd, ) diff --git a/src/cloudflare/types/dns/attack_mitigation.py b/src/cloudflare/types/dns/attack_mitigation.py new file mode 100644 index 00000000000..cfbe6224fc6 --- /dev/null +++ b/src/cloudflare/types/dns/attack_mitigation.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["AttackMitigation"] + + +class AttackMitigation(BaseModel): + enabled: Optional[bool] = None + """ + When enabled, random-prefix attacks are automatically mitigated and the upstream + DNS servers protected. + """ + + only_when_upstream_unhealthy: Optional[bool] = None + """Only mitigate attacks when upstream servers seem unhealthy.""" diff --git a/src/cloudflare/types/dns/attack_mitigation_param.py b/src/cloudflare/types/dns/attack_mitigation_param.py new file mode 100644 index 00000000000..66a854ef67e --- /dev/null +++ b/src/cloudflare/types/dns/attack_mitigation_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["AttackMitigationParam"] + + +class AttackMitigationParam(TypedDict, total=False): + enabled: bool + """ + When enabled, random-prefix attacks are automatically mitigated and the upstream + DNS servers protected. + """ + + only_when_upstream_unhealthy: bool + """Only mitigate attacks when upstream servers seem unhealthy.""" diff --git a/src/cloudflare/types/dns/dns_firewall.py b/src/cloudflare/types/dns/dns_firewall.py index 6b01c523358..0980990ab55 100644 --- a/src/cloudflare/types/dns/dns_firewall.py +++ b/src/cloudflare/types/dns/dns_firewall.py @@ -4,19 +4,9 @@ from datetime import datetime from ..._models import BaseModel +from .attack_mitigation import AttackMitigation -__all__ = ["DNSFirewall", "AttackMitigation"] - - -class AttackMitigation(BaseModel): - enabled: Optional[bool] = None - """ - When enabled, random-prefix attacks are automatically mitigated and the upstream - DNS servers protected. - """ - - only_when_upstream_unhealthy: Optional[bool] = None - """Only mitigate attacks when upstream servers seem unhealthy.""" +__all__ = ["DNSFirewall"] class DNSFirewall(BaseModel): diff --git a/src/cloudflare/types/dns/firewall_create_params.py b/src/cloudflare/types/dns/firewall_create_params.py index 7562374f23c..59e6d9b1be5 100644 --- a/src/cloudflare/types/dns/firewall_create_params.py +++ b/src/cloudflare/types/dns/firewall_create_params.py @@ -2,10 +2,13 @@ from __future__ import annotations -from typing import List, Union, Optional +from typing import List, Optional from typing_extensions import Required, TypedDict -__all__ = ["FirewallCreateParams", "AttackMitigation"] +from .attack_mitigation_param import AttackMitigationParam +from .upstream_ips_items_param import UpstreamIPsItemsParam + +__all__ = ["FirewallCreateParams"] class FirewallCreateParams(TypedDict, total=False): @@ -15,9 +18,9 @@ class FirewallCreateParams(TypedDict, total=False): name: Required[str] """DNS Firewall Cluster Name.""" - upstream_ips: Required[List[Union[str, str]]] + upstream_ips: Required[List[UpstreamIPsItemsParam]] - attack_mitigation: Optional[AttackMitigation] + attack_mitigation: Optional[AttackMitigationParam] """Attack mitigation settings.""" deprecate_any_requests: bool @@ -46,14 +49,3 @@ class FirewallCreateParams(TypedDict, total=False): Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt). """ - - -class AttackMitigation(TypedDict, total=False): - enabled: bool - """ - When enabled, random-prefix attacks are automatically mitigated and the upstream - DNS servers protected. - """ - - only_when_upstream_unhealthy: bool - """Only mitigate attacks when upstream servers seem unhealthy.""" diff --git a/src/cloudflare/types/dns/firewall_edit_params.py b/src/cloudflare/types/dns/firewall_edit_params.py index b3e117eb015..96c262c2d36 100644 --- a/src/cloudflare/types/dns/firewall_edit_params.py +++ b/src/cloudflare/types/dns/firewall_edit_params.py @@ -2,10 +2,14 @@ from __future__ import annotations -from typing import List, Union, Optional +from typing import List, Optional from typing_extensions import Required, TypedDict -__all__ = ["FirewallEditParams", "AttackMitigation"] +from .attack_mitigation_param import AttackMitigationParam +from .firewall_ips_item_param import FirewallIPsItemParam +from .upstream_ips_items_param import UpstreamIPsItemsParam + +__all__ = ["FirewallEditParams"] class FirewallEditParams(TypedDict, total=False): @@ -15,7 +19,7 @@ class FirewallEditParams(TypedDict, total=False): deprecate_any_requests: Required[bool] """Deprecate the response to ANY requests.""" - dns_firewall_ips: Required[List[Union[str, str]]] + dns_firewall_ips: Required[List[FirewallIPsItemParam]] ecs_fallback: Required[bool] """Forward client IP (resolver) subnet if no EDNS Client Subnet is sent.""" @@ -29,9 +33,9 @@ class FirewallEditParams(TypedDict, total=False): name: Required[str] """DNS Firewall Cluster Name.""" - upstream_ips: Required[List[Union[str, str]]] + upstream_ips: Required[List[UpstreamIPsItemsParam]] - attack_mitigation: Optional[AttackMitigation] + attack_mitigation: Optional[AttackMitigationParam] """Attack mitigation settings.""" negative_cache_ttl: Optional[float] @@ -48,14 +52,3 @@ class FirewallEditParams(TypedDict, total=False): Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt). """ - - -class AttackMitigation(TypedDict, total=False): - enabled: bool - """ - When enabled, random-prefix attacks are automatically mitigated and the upstream - DNS servers protected. - """ - - only_when_upstream_unhealthy: bool - """Only mitigate attacks when upstream servers seem unhealthy.""" diff --git a/src/cloudflare/types/dns/firewall_ips_item.py b/src/cloudflare/types/dns/firewall_ips_item.py new file mode 100644 index 00000000000..8032b8895bc --- /dev/null +++ b/src/cloudflare/types/dns/firewall_ips_item.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union + +__all__ = ["FirewallIPsItem"] + +FirewallIPsItem = Union[str, str] diff --git a/src/cloudflare/types/dns/firewall_ips_item_param.py b/src/cloudflare/types/dns/firewall_ips_item_param.py new file mode 100644 index 00000000000..25d44595bd1 --- /dev/null +++ b/src/cloudflare/types/dns/firewall_ips_item_param.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union + +__all__ = ["FirewallIPsItemParam"] + +FirewallIPsItemParam = Union[str, str] diff --git a/src/cloudflare/types/dns/upstream_ips_items.py b/src/cloudflare/types/dns/upstream_ips_items.py new file mode 100644 index 00000000000..1d040baa70b --- /dev/null +++ b/src/cloudflare/types/dns/upstream_ips_items.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union + +__all__ = ["UpstreamIPsItems"] + +UpstreamIPsItems = Union[str, str] diff --git a/src/cloudflare/types/dns/upstream_ips_items_param.py b/src/cloudflare/types/dns/upstream_ips_items_param.py new file mode 100644 index 00000000000..8a77e03f4a9 --- /dev/null +++ b/src/cloudflare/types/dns/upstream_ips_items_param.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union + +__all__ = ["UpstreamIPsItemsParam"] + +UpstreamIPsItemsParam = Union[str, str] diff --git a/src/cloudflare/types/email_routing/__init__.py b/src/cloudflare/types/email_routing/__init__.py index fc53ea2ebb0..5042fc0194c 100644 --- a/src/cloudflare/types/email_routing/__init__.py +++ b/src/cloudflare/types/email_routing/__init__.py @@ -2,19 +2,20 @@ from __future__ import annotations +from .action import Action as Action +from .matcher import Matcher as Matcher +from .properties import Properties as Properties +from .action_item import ActionItem as ActionItem +from .action_param import ActionParam as ActionParam +from .matcher_item import MatcherItem as MatcherItem +from .matcher_param import MatcherParam as MatcherParam from .dns_get_response import DNSGetResponse as DNSGetResponse from .email_dns_record import EmailDNSRecord as EmailDNSRecord from .rule_list_params import RuleListParams as RuleListParams -from .rule_get_response import RuleGetResponse as RuleGetResponse +from .action_item_param import ActionItemParam as ActionItemParam +from .matcher_item_param import MatcherItemParam as MatcherItemParam from .rule_create_params import RuleCreateParams as RuleCreateParams -from .rule_list_response import RuleListResponse as RuleListResponse from .rule_update_params import RuleUpdateParams as RuleUpdateParams from .address_list_params import AddressListParams as AddressListParams -from .address_get_response import AddressGetResponse as AddressGetResponse -from .rule_create_response import RuleCreateResponse as RuleCreateResponse -from .rule_delete_response import RuleDeleteResponse as RuleDeleteResponse -from .rule_update_response import RuleUpdateResponse as RuleUpdateResponse +from .destination_address import DestinationAddress as DestinationAddress from .address_create_params import AddressCreateParams as AddressCreateParams -from .address_list_response import AddressListResponse as AddressListResponse -from .address_create_response import AddressCreateResponse as AddressCreateResponse -from .address_delete_response import AddressDeleteResponse as AddressDeleteResponse diff --git a/src/cloudflare/types/email_routing/action.py b/src/cloudflare/types/email_routing/action.py new file mode 100644 index 00000000000..b27c3f1a41b --- /dev/null +++ b/src/cloudflare/types/email_routing/action.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Action"] + + +class Action(BaseModel): + type: Literal["drop", "forward", "worker"] + """Type of supported action.""" + + value: List[str] diff --git a/src/cloudflare/types/email_routing/action_item.py b/src/cloudflare/types/email_routing/action_item.py new file mode 100644 index 00000000000..056c53bfaeb --- /dev/null +++ b/src/cloudflare/types/email_routing/action_item.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["ActionItem"] + + +class ActionItem(BaseModel): + type: Literal["drop", "forward", "worker"] + """Type of supported action.""" + + value: List[str] diff --git a/src/cloudflare/types/email_routing/action_item_param.py b/src/cloudflare/types/email_routing/action_item_param.py new file mode 100644 index 00000000000..009a6cb82d7 --- /dev/null +++ b/src/cloudflare/types/email_routing/action_item_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ActionItemParam"] + + +class ActionItemParam(TypedDict, total=False): + type: Required[Literal["drop", "forward", "worker"]] + """Type of supported action.""" + + value: Required[List[str]] diff --git a/src/cloudflare/types/email_routing/action_param.py b/src/cloudflare/types/email_routing/action_param.py new file mode 100644 index 00000000000..20411ce329e --- /dev/null +++ b/src/cloudflare/types/email_routing/action_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ActionParam"] + + +class ActionParam(TypedDict, total=False): + type: Required[Literal["drop", "forward", "worker"]] + """Type of supported action.""" + + value: Required[List[str]] diff --git a/src/cloudflare/types/email_routing/address_create_response.py b/src/cloudflare/types/email_routing/address_create_response.py deleted file mode 100644 index 075fe7f744d..00000000000 --- a/src/cloudflare/types/email_routing/address_create_response.py +++ /dev/null @@ -1,34 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from ..._models import BaseModel - -__all__ = ["AddressCreateResponse"] - - -class AddressCreateResponse(BaseModel): - id: Optional[str] = None - """Destination address identifier.""" - - created: Optional[datetime] = None - """The date and time the destination address has been created.""" - - email: Optional[str] = None - """The contact email address of the user.""" - - modified: Optional[datetime] = None - """The date and time the destination address was last modified.""" - - tag: Optional[str] = None - """Destination address tag. - - (Deprecated, replaced by destination address identifier) - """ - - verified: Optional[datetime] = None - """The date and time the destination address has been verified. - - Null means not verified yet. - """ diff --git a/src/cloudflare/types/email_routing/address_delete_response.py b/src/cloudflare/types/email_routing/address_delete_response.py deleted file mode 100644 index a1d5c68e46f..00000000000 --- a/src/cloudflare/types/email_routing/address_delete_response.py +++ /dev/null @@ -1,34 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from ..._models import BaseModel - -__all__ = ["AddressDeleteResponse"] - - -class AddressDeleteResponse(BaseModel): - id: Optional[str] = None - """Destination address identifier.""" - - created: Optional[datetime] = None - """The date and time the destination address has been created.""" - - email: Optional[str] = None - """The contact email address of the user.""" - - modified: Optional[datetime] = None - """The date and time the destination address was last modified.""" - - tag: Optional[str] = None - """Destination address tag. - - (Deprecated, replaced by destination address identifier) - """ - - verified: Optional[datetime] = None - """The date and time the destination address has been verified. - - Null means not verified yet. - """ diff --git a/src/cloudflare/types/email_routing/address_list_response.py b/src/cloudflare/types/email_routing/address_list_response.py deleted file mode 100644 index fe8f867b4c2..00000000000 --- a/src/cloudflare/types/email_routing/address_list_response.py +++ /dev/null @@ -1,34 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from ..._models import BaseModel - -__all__ = ["AddressListResponse"] - - -class AddressListResponse(BaseModel): - id: Optional[str] = None - """Destination address identifier.""" - - created: Optional[datetime] = None - """The date and time the destination address has been created.""" - - email: Optional[str] = None - """The contact email address of the user.""" - - modified: Optional[datetime] = None - """The date and time the destination address was last modified.""" - - tag: Optional[str] = None - """Destination address tag. - - (Deprecated, replaced by destination address identifier) - """ - - verified: Optional[datetime] = None - """The date and time the destination address has been verified. - - Null means not verified yet. - """ diff --git a/src/cloudflare/types/email_routing/address_get_response.py b/src/cloudflare/types/email_routing/destination_address.py similarity index 92% rename from src/cloudflare/types/email_routing/address_get_response.py rename to src/cloudflare/types/email_routing/destination_address.py index 1accf84a580..2c4b7ecebcc 100644 --- a/src/cloudflare/types/email_routing/address_get_response.py +++ b/src/cloudflare/types/email_routing/destination_address.py @@ -5,10 +5,10 @@ from ..._models import BaseModel -__all__ = ["AddressGetResponse"] +__all__ = ["DestinationAddress"] -class AddressGetResponse(BaseModel): +class DestinationAddress(BaseModel): id: Optional[str] = None """Destination address identifier.""" diff --git a/src/cloudflare/types/email_routing/matcher.py b/src/cloudflare/types/email_routing/matcher.py new file mode 100644 index 00000000000..d63819b6a3c --- /dev/null +++ b/src/cloudflare/types/email_routing/matcher.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Matcher"] + + +class Matcher(BaseModel): + field: Literal["to"] + """Field for type matcher.""" + + type: Literal["literal"] + """Type of matcher.""" + + value: str + """Value for matcher.""" diff --git a/src/cloudflare/types/email_routing/matcher_item.py b/src/cloudflare/types/email_routing/matcher_item.py new file mode 100644 index 00000000000..8e573ed7f84 --- /dev/null +++ b/src/cloudflare/types/email_routing/matcher_item.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["MatcherItem"] + + +class MatcherItem(BaseModel): + field: Literal["to"] + """Field for type matcher.""" + + type: Literal["literal"] + """Type of matcher.""" + + value: str + """Value for matcher.""" diff --git a/src/cloudflare/types/email_routing/matcher_item_param.py b/src/cloudflare/types/email_routing/matcher_item_param.py new file mode 100644 index 00000000000..acf20477a4b --- /dev/null +++ b/src/cloudflare/types/email_routing/matcher_item_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["MatcherItemParam"] + + +class MatcherItemParam(TypedDict, total=False): + field: Required[Literal["to"]] + """Field for type matcher.""" + + type: Required[Literal["literal"]] + """Type of matcher.""" + + value: Required[str] + """Value for matcher.""" diff --git a/src/cloudflare/types/email_routing/matcher_param.py b/src/cloudflare/types/email_routing/matcher_param.py new file mode 100644 index 00000000000..cae8d7e45dd --- /dev/null +++ b/src/cloudflare/types/email_routing/matcher_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["MatcherParam"] + + +class MatcherParam(TypedDict, total=False): + field: Required[Literal["to"]] + """Field for type matcher.""" + + type: Required[Literal["literal"]] + """Type of matcher.""" + + value: Required[str] + """Value for matcher.""" diff --git a/src/cloudflare/types/email_routing/rule_get_response.py b/src/cloudflare/types/email_routing/properties.py similarity index 57% rename from src/cloudflare/types/email_routing/rule_get_response.py rename to src/cloudflare/types/email_routing/properties.py index fc0333c3094..852c9051b10 100644 --- a/src/cloudflare/types/email_routing/rule_get_response.py +++ b/src/cloudflare/types/email_routing/properties.py @@ -4,39 +4,23 @@ from typing_extensions import Literal from ..._models import BaseModel +from .action_item import ActionItem +from .matcher_item import MatcherItem -__all__ = ["RuleGetResponse", "Action", "Matcher"] +__all__ = ["Properties"] -class Action(BaseModel): - type: Literal["drop", "forward", "worker"] - """Type of supported action.""" - - value: List[str] - - -class Matcher(BaseModel): - field: Literal["to"] - """Field for type matcher.""" - - type: Literal["literal"] - """Type of matcher.""" - - value: str - """Value for matcher.""" - - -class RuleGetResponse(BaseModel): +class Properties(BaseModel): id: Optional[str] = None """Routing rule identifier.""" - actions: Optional[List[Action]] = None + actions: Optional[List[ActionItem]] = None """List actions patterns.""" enabled: Optional[Literal[True, False]] = None """Routing rule status.""" - matchers: Optional[List[Matcher]] = None + matchers: Optional[List[MatcherItem]] = None """Matching patterns to forward to your actions.""" name: Optional[str] = None diff --git a/src/cloudflare/types/email_routing/rule_create_params.py b/src/cloudflare/types/email_routing/rule_create_params.py index 923ca342fe2..2dca15de5ec 100644 --- a/src/cloudflare/types/email_routing/rule_create_params.py +++ b/src/cloudflare/types/email_routing/rule_create_params.py @@ -2,17 +2,20 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["RuleCreateParams", "Action", "Matcher"] +from .action_param import ActionParam +from .matcher_param import MatcherParam + +__all__ = ["RuleCreateParams"] class RuleCreateParams(TypedDict, total=False): - actions: Required[Iterable[Action]] + actions: Required[Iterable[ActionParam]] """List actions patterns.""" - matchers: Required[Iterable[Matcher]] + matchers: Required[Iterable[MatcherParam]] """Matching patterns to forward to your actions.""" enabled: Literal[True, False] @@ -23,21 +26,3 @@ class RuleCreateParams(TypedDict, total=False): priority: float """Priority of the routing rule.""" - - -class Action(TypedDict, total=False): - type: Required[Literal["drop", "forward", "worker"]] - """Type of supported action.""" - - value: Required[List[str]] - - -class Matcher(TypedDict, total=False): - field: Required[Literal["to"]] - """Field for type matcher.""" - - type: Required[Literal["literal"]] - """Type of matcher.""" - - value: Required[str] - """Value for matcher.""" diff --git a/src/cloudflare/types/email_routing/rule_create_response.py b/src/cloudflare/types/email_routing/rule_create_response.py deleted file mode 100644 index 2fe7e7eb776..00000000000 --- a/src/cloudflare/types/email_routing/rule_create_response.py +++ /dev/null @@ -1,49 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["RuleCreateResponse", "Action", "Matcher"] - - -class Action(BaseModel): - type: Literal["drop", "forward", "worker"] - """Type of supported action.""" - - value: List[str] - - -class Matcher(BaseModel): - field: Literal["to"] - """Field for type matcher.""" - - type: Literal["literal"] - """Type of matcher.""" - - value: str - """Value for matcher.""" - - -class RuleCreateResponse(BaseModel): - id: Optional[str] = None - """Routing rule identifier.""" - - actions: Optional[List[Action]] = None - """List actions patterns.""" - - enabled: Optional[Literal[True, False]] = None - """Routing rule status.""" - - matchers: Optional[List[Matcher]] = None - """Matching patterns to forward to your actions.""" - - name: Optional[str] = None - """Routing rule name.""" - - priority: Optional[float] = None - """Priority of the routing rule.""" - - tag: Optional[str] = None - """Routing rule tag. (Deprecated, replaced by routing rule identifier)""" diff --git a/src/cloudflare/types/email_routing/rule_delete_response.py b/src/cloudflare/types/email_routing/rule_delete_response.py deleted file mode 100644 index e0e35a7443c..00000000000 --- a/src/cloudflare/types/email_routing/rule_delete_response.py +++ /dev/null @@ -1,49 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["RuleDeleteResponse", "Action", "Matcher"] - - -class Action(BaseModel): - type: Literal["drop", "forward", "worker"] - """Type of supported action.""" - - value: List[str] - - -class Matcher(BaseModel): - field: Literal["to"] - """Field for type matcher.""" - - type: Literal["literal"] - """Type of matcher.""" - - value: str - """Value for matcher.""" - - -class RuleDeleteResponse(BaseModel): - id: Optional[str] = None - """Routing rule identifier.""" - - actions: Optional[List[Action]] = None - """List actions patterns.""" - - enabled: Optional[Literal[True, False]] = None - """Routing rule status.""" - - matchers: Optional[List[Matcher]] = None - """Matching patterns to forward to your actions.""" - - name: Optional[str] = None - """Routing rule name.""" - - priority: Optional[float] = None - """Priority of the routing rule.""" - - tag: Optional[str] = None - """Routing rule tag. (Deprecated, replaced by routing rule identifier)""" diff --git a/src/cloudflare/types/email_routing/rule_list_response.py b/src/cloudflare/types/email_routing/rule_list_response.py deleted file mode 100644 index fabb9650223..00000000000 --- a/src/cloudflare/types/email_routing/rule_list_response.py +++ /dev/null @@ -1,49 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["RuleListResponse", "Action", "Matcher"] - - -class Action(BaseModel): - type: Literal["drop", "forward", "worker"] - """Type of supported action.""" - - value: List[str] - - -class Matcher(BaseModel): - field: Literal["to"] - """Field for type matcher.""" - - type: Literal["literal"] - """Type of matcher.""" - - value: str - """Value for matcher.""" - - -class RuleListResponse(BaseModel): - id: Optional[str] = None - """Routing rule identifier.""" - - actions: Optional[List[Action]] = None - """List actions patterns.""" - - enabled: Optional[Literal[True, False]] = None - """Routing rule status.""" - - matchers: Optional[List[Matcher]] = None - """Matching patterns to forward to your actions.""" - - name: Optional[str] = None - """Routing rule name.""" - - priority: Optional[float] = None - """Priority of the routing rule.""" - - tag: Optional[str] = None - """Routing rule tag. (Deprecated, replaced by routing rule identifier)""" diff --git a/src/cloudflare/types/email_routing/rule_update_params.py b/src/cloudflare/types/email_routing/rule_update_params.py index 97d9e200490..080583ff5d7 100644 --- a/src/cloudflare/types/email_routing/rule_update_params.py +++ b/src/cloudflare/types/email_routing/rule_update_params.py @@ -2,20 +2,23 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["RuleUpdateParams", "Action", "Matcher"] +from .action_item_param import ActionItemParam +from .matcher_item_param import MatcherItemParam + +__all__ = ["RuleUpdateParams"] class RuleUpdateParams(TypedDict, total=False): zone_identifier: Required[str] """Identifier""" - actions: Required[Iterable[Action]] + actions: Required[Iterable[ActionItemParam]] """List actions patterns.""" - matchers: Required[Iterable[Matcher]] + matchers: Required[Iterable[MatcherItemParam]] """Matching patterns to forward to your actions.""" enabled: Literal[True, False] @@ -26,21 +29,3 @@ class RuleUpdateParams(TypedDict, total=False): priority: float """Priority of the routing rule.""" - - -class Action(TypedDict, total=False): - type: Required[Literal["drop", "forward", "worker"]] - """Type of supported action.""" - - value: Required[List[str]] - - -class Matcher(TypedDict, total=False): - field: Required[Literal["to"]] - """Field for type matcher.""" - - type: Required[Literal["literal"]] - """Type of matcher.""" - - value: Required[str] - """Value for matcher.""" diff --git a/src/cloudflare/types/email_routing/rule_update_response.py b/src/cloudflare/types/email_routing/rule_update_response.py deleted file mode 100644 index e7124176eaf..00000000000 --- a/src/cloudflare/types/email_routing/rule_update_response.py +++ /dev/null @@ -1,49 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["RuleUpdateResponse", "Action", "Matcher"] - - -class Action(BaseModel): - type: Literal["drop", "forward", "worker"] - """Type of supported action.""" - - value: List[str] - - -class Matcher(BaseModel): - field: Literal["to"] - """Field for type matcher.""" - - type: Literal["literal"] - """Type of matcher.""" - - value: str - """Value for matcher.""" - - -class RuleUpdateResponse(BaseModel): - id: Optional[str] = None - """Routing rule identifier.""" - - actions: Optional[List[Action]] = None - """List actions patterns.""" - - enabled: Optional[Literal[True, False]] = None - """Routing rule status.""" - - matchers: Optional[List[Matcher]] = None - """Matching patterns to forward to your actions.""" - - name: Optional[str] = None - """Routing rule name.""" - - priority: Optional[float] = None - """Priority of the routing rule.""" - - tag: Optional[str] = None - """Routing rule tag. (Deprecated, replaced by routing rule identifier)""" diff --git a/src/cloudflare/types/email_routing/rules/__init__.py b/src/cloudflare/types/email_routing/rules/__init__.py index 660e7d26c5f..26568d50a94 100644 --- a/src/cloudflare/types/email_routing/rules/__init__.py +++ b/src/cloudflare/types/email_routing/rules/__init__.py @@ -2,5 +2,9 @@ from __future__ import annotations +from .action import Action as Action +from .matcher import Matcher as Matcher +from .action_param import ActionParam as ActionParam +from .matcher_param import MatcherParam as MatcherParam from .email_catch_all_rule import EmailCatchAllRule as EmailCatchAllRule from .catch_all_update_params import CatchAllUpdateParams as CatchAllUpdateParams diff --git a/src/cloudflare/types/email_routing/rules/action.py b/src/cloudflare/types/email_routing/rules/action.py new file mode 100644 index 00000000000..7a4a7763452 --- /dev/null +++ b/src/cloudflare/types/email_routing/rules/action.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["Action"] + + +class Action(BaseModel): + type: Literal["drop", "forward", "worker"] + """Type of action for catch-all rule.""" + + value: Optional[List[str]] = None diff --git a/src/cloudflare/types/email_routing/rules/action_param.py b/src/cloudflare/types/email_routing/rules/action_param.py new file mode 100644 index 00000000000..f999e1ead64 --- /dev/null +++ b/src/cloudflare/types/email_routing/rules/action_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ActionParam"] + + +class ActionParam(TypedDict, total=False): + type: Required[Literal["drop", "forward", "worker"]] + """Type of action for catch-all rule.""" + + value: List[str] diff --git a/src/cloudflare/types/email_routing/rules/catch_all_update_params.py b/src/cloudflare/types/email_routing/rules/catch_all_update_params.py index 1dd7d8c9616..b6c43d46a87 100644 --- a/src/cloudflare/types/email_routing/rules/catch_all_update_params.py +++ b/src/cloudflare/types/email_routing/rules/catch_all_update_params.py @@ -2,17 +2,20 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["CatchAllUpdateParams", "Action", "Matcher"] +from .action_param import ActionParam +from .matcher_param import MatcherParam + +__all__ = ["CatchAllUpdateParams"] class CatchAllUpdateParams(TypedDict, total=False): - actions: Required[Iterable[Action]] + actions: Required[Iterable[ActionParam]] """List actions for the catch-all routing rule.""" - matchers: Required[Iterable[Matcher]] + matchers: Required[Iterable[MatcherParam]] """List of matchers for the catch-all routing rule.""" enabled: Literal[True, False] @@ -20,15 +23,3 @@ class CatchAllUpdateParams(TypedDict, total=False): name: str """Routing rule name.""" - - -class Action(TypedDict, total=False): - type: Required[Literal["drop", "forward", "worker"]] - """Type of action for catch-all rule.""" - - value: List[str] - - -class Matcher(TypedDict, total=False): - type: Required[Literal["all"]] - """Type of matcher. Default is 'all'.""" diff --git a/src/cloudflare/types/email_routing/rules/email_catch_all_rule.py b/src/cloudflare/types/email_routing/rules/email_catch_all_rule.py index ac226e6b084..0bc34c7ecca 100644 --- a/src/cloudflare/types/email_routing/rules/email_catch_all_rule.py +++ b/src/cloudflare/types/email_routing/rules/email_catch_all_rule.py @@ -3,21 +3,11 @@ from typing import List, Optional from typing_extensions import Literal +from .action import Action +from .matcher import Matcher from ...._models import BaseModel -__all__ = ["EmailCatchAllRule", "Action", "Matcher"] - - -class Action(BaseModel): - type: Literal["drop", "forward", "worker"] - """Type of action for catch-all rule.""" - - value: Optional[List[str]] = None - - -class Matcher(BaseModel): - type: Literal["all"] - """Type of matcher. Default is 'all'.""" +__all__ = ["EmailCatchAllRule"] class EmailCatchAllRule(BaseModel): diff --git a/src/cloudflare/types/email_routing/rules/matcher.py b/src/cloudflare/types/email_routing/rules/matcher.py new file mode 100644 index 00000000000..272463c5133 --- /dev/null +++ b/src/cloudflare/types/email_routing/rules/matcher.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["Matcher"] + + +class Matcher(BaseModel): + type: Literal["all"] + """Type of matcher. Default is 'all'.""" diff --git a/src/cloudflare/types/email_routing/rules/matcher_param.py b/src/cloudflare/types/email_routing/rules/matcher_param.py new file mode 100644 index 00000000000..1cadb071f75 --- /dev/null +++ b/src/cloudflare/types/email_routing/rules/matcher_param.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["MatcherParam"] + + +class MatcherParam(TypedDict, total=False): + type: Required[Literal["all"]] + """Type of matcher. Default is 'all'.""" diff --git a/src/cloudflare/types/email_routing_disable_response.py b/src/cloudflare/types/email_routing_disable_response.py deleted file mode 100644 index e1a79c469ae..00000000000 --- a/src/cloudflare/types/email_routing_disable_response.py +++ /dev/null @@ -1,38 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["EmailRoutingDisableResponse"] - - -class EmailRoutingDisableResponse(BaseModel): - id: Optional[str] = None - """Email Routing settings identifier.""" - - created: Optional[datetime] = None - """The date and time the settings have been created.""" - - enabled: Optional[Literal[True, False]] = None - """State of the zone settings for Email Routing.""" - - modified: Optional[datetime] = None - """The date and time the settings have been modified.""" - - name: Optional[str] = None - """Domain of your zone.""" - - skip_wizard: Optional[Literal[True, False]] = None - """Flag to check if the user skipped the configuration wizard.""" - - status: Optional[Literal["ready", "unconfigured", "misconfigured", "misconfigured/locked", "unlocked"]] = None - """Show the state of your account, and the type or configuration error.""" - - tag: Optional[str] = None - """Email Routing settings tag. - - (Deprecated, replaced by Email Routing settings identifier) - """ diff --git a/src/cloudflare/types/email_routing_enable_response.py b/src/cloudflare/types/email_routing_enable_response.py deleted file mode 100644 index 26769d760c9..00000000000 --- a/src/cloudflare/types/email_routing_enable_response.py +++ /dev/null @@ -1,38 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["EmailRoutingEnableResponse"] - - -class EmailRoutingEnableResponse(BaseModel): - id: Optional[str] = None - """Email Routing settings identifier.""" - - created: Optional[datetime] = None - """The date and time the settings have been created.""" - - enabled: Optional[Literal[True, False]] = None - """State of the zone settings for Email Routing.""" - - modified: Optional[datetime] = None - """The date and time the settings have been modified.""" - - name: Optional[str] = None - """Domain of your zone.""" - - skip_wizard: Optional[Literal[True, False]] = None - """Flag to check if the user skipped the configuration wizard.""" - - status: Optional[Literal["ready", "unconfigured", "misconfigured", "misconfigured/locked", "unlocked"]] = None - """Show the state of your account, and the type or configuration error.""" - - tag: Optional[str] = None - """Email Routing settings tag. - - (Deprecated, replaced by Email Routing settings identifier) - """ diff --git a/src/cloudflare/types/email_routing_get_response.py b/src/cloudflare/types/email_settings.py similarity index 93% rename from src/cloudflare/types/email_routing_get_response.py rename to src/cloudflare/types/email_settings.py index 8475a143605..496f13c71e2 100644 --- a/src/cloudflare/types/email_routing_get_response.py +++ b/src/cloudflare/types/email_settings.py @@ -6,10 +6,10 @@ from .._models import BaseModel -__all__ = ["EmailRoutingGetResponse"] +__all__ = ["EmailSettings"] -class EmailRoutingGetResponse(BaseModel): +class EmailSettings(BaseModel): id: Optional[str] = None """Email Routing settings identifier.""" diff --git a/src/cloudflare/types/filter_options.py b/src/cloudflare/types/filter_options.py new file mode 100644 index 00000000000..3f2573708ba --- /dev/null +++ b/src/cloudflare/types/filter_options.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .._models import BaseModel + +__all__ = ["FilterOptions"] + + +class FilterOptions(BaseModel): + disable: Optional[bool] = None + """If set true, disable notifications for this type of resource (pool or origin).""" + + healthy: Optional[bool] = None + """If present, send notifications only for this health status (e.g. + + false for only DOWN events). Use null to reset (all events). + """ diff --git a/src/cloudflare/types/filter_options_param.py b/src/cloudflare/types/filter_options_param.py new file mode 100644 index 00000000000..5fa6ff70390 --- /dev/null +++ b/src/cloudflare/types/filter_options_param.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +__all__ = ["FilterOptionsParam"] + + +class FilterOptionsParam(TypedDict, total=False): + disable: bool + """If set true, disable notifications for this type of resource (pool or origin).""" + + healthy: Optional[bool] + """If present, send notifications only for this health status (e.g. + + false for only DOWN events). Use null to reset (all events). + """ diff --git a/src/cloudflare/types/geo_restrictions.py b/src/cloudflare/types/geo_restrictions.py new file mode 100644 index 00000000000..95d43ffc898 --- /dev/null +++ b/src/cloudflare/types/geo_restrictions.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["GeoRestrictions"] + + +class GeoRestrictions(BaseModel): + label: Optional[Literal["us", "eu", "highest_security"]] = None diff --git a/src/cloudflare/types/geo_restrictions_param.py b/src/cloudflare/types/geo_restrictions_param.py new file mode 100644 index 00000000000..18590e2f34d --- /dev/null +++ b/src/cloudflare/types/geo_restrictions_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["GeoRestrictionsParam"] + + +class GeoRestrictionsParam(TypedDict, total=False): + label: Literal["us", "eu", "highest_security"] diff --git a/src/cloudflare/types/header.py b/src/cloudflare/types/header.py new file mode 100644 index 00000000000..fa9e47fe388 --- /dev/null +++ b/src/cloudflare/types/header.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .host_item import HostItem + +__all__ = ["Header"] + + +class Header(BaseModel): + host: Optional[List[HostItem]] = FieldInfo(alias="Host", default=None) + """The 'Host' header allows to override the hostname set in the HTTP request. + + Current support is 1 'Host' header override per origin. + """ diff --git a/src/cloudflare/types/header_param.py b/src/cloudflare/types/header_param.py new file mode 100644 index 00000000000..b8dcca61a5a --- /dev/null +++ b/src/cloudflare/types/header_param.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Annotated, TypedDict + +from .._utils import PropertyInfo +from .host_item import HostItem + +__all__ = ["HeaderParam"] + + +class HeaderParam(TypedDict, total=False): + host: Annotated[List[HostItem], PropertyInfo(alias="Host")] + """The 'Host' header allows to override the hostname set in the HTTP request. + + Current support is 1 'Host' header override per origin. + """ diff --git a/src/cloudflare/types/host_item.py b/src/cloudflare/types/host_item.py new file mode 100644 index 00000000000..c6a0a188002 --- /dev/null +++ b/src/cloudflare/types/host_item.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["HostItem"] + +HostItem = str diff --git a/src/cloudflare/types/load_balancers/pool_create_params.py b/src/cloudflare/types/load_balancers/pool_create_params.py index d2237f3da2e..845e853eb58 100644 --- a/src/cloudflare/types/load_balancers/pool_create_params.py +++ b/src/cloudflare/types/load_balancers/pool_create_params.py @@ -2,21 +2,15 @@ from __future__ import annotations -from typing import List, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing import Iterable, Optional +from typing_extensions import Required, TypedDict -from ..._utils import PropertyInfo +from ..origin_item_param import OriginItemParam +from ..load_shedding_param import LoadSheddingParam +from ..origin_steering_param import OriginSteeringParam +from ..notification_filter_param import NotificationFilterParam -__all__ = [ - "PoolCreateParams", - "Origin", - "OriginHeader", - "LoadShedding", - "NotificationFilter", - "NotificationFilterOrigin", - "NotificationFilterPool", - "OriginSteering", -] +__all__ = ["PoolCreateParams"] class PoolCreateParams(TypedDict, total=False): @@ -29,7 +23,7 @@ class PoolCreateParams(TypedDict, total=False): Only alphanumeric characters, hyphens, and underscores are allowed. """ - origins: Required[Iterable[Origin]] + origins: Required[Iterable[OriginItemParam]] """The list of origins within this pool. Traffic directed at this pool is balanced across all currently healthy origins, @@ -53,7 +47,7 @@ class PoolCreateParams(TypedDict, total=False): decimal degrees. If this is set, longitude must also be set. """ - load_shedding: LoadShedding + load_shedding: LoadSheddingParam """Configures load shedding policies and percentages for the pool.""" longitude: float @@ -84,149 +78,15 @@ class PoolCreateParams(TypedDict, total=False): mailing list. Multiple emails can be supplied as a comma delimited list. """ - notification_filter: Optional[NotificationFilter] + notification_filter: Optional[NotificationFilterParam] """Filter pool and origin health notifications by resource type or health status. Use null to reset. """ - origin_steering: OriginSteering + origin_steering: OriginSteeringParam """Configures origin steering for the pool. Controls how origins are selected for new sessions and traffic without session affinity. """ - - -class OriginHeader(TypedDict, total=False): - host: Annotated[List[str], PropertyInfo(alias="Host")] - """The 'Host' header allows to override the hostname set in the HTTP request. - - Current support is 1 'Host' header override per origin. - """ - - -class Origin(TypedDict, total=False): - address: str - """ - The IP address (IPv4 or IPv6) of the origin, or its publicly addressable - hostname. Hostnames entered here should resolve directly to the origin, and not - be a hostname proxied by Cloudflare. To set an internal/reserved address, - virtual_network_id must also be set. - """ - - enabled: bool - """Whether to enable (the default) this origin within the pool. - - Disabled origins will not receive traffic and are excluded from health checks. - The origin will only be disabled for the current pool. - """ - - header: OriginHeader - """The request header is used to pass additional information with an HTTP request. - - Currently supported header is 'Host'. - """ - - name: str - """A human-identifiable name for the origin.""" - - virtual_network_id: str - """The virtual network subnet ID the origin belongs in. - - Virtual network must also belong to the account. - """ - - weight: float - """The weight of this origin relative to other origins in the pool. - - Based on the configured weight the total traffic is distributed among origins - within the pool. - - - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the - origin's outstanding requests. - - `origin_steering.policy="least_connections"`: Use weight to scale the origin's - open connections. - """ - - -class LoadShedding(TypedDict, total=False): - default_percent: float - """The percent of traffic to shed from the pool, according to the default policy. - - Applies to new sessions and traffic without session affinity. - """ - - default_policy: Literal["random", "hash"] - """The default policy to use when load shedding. - - A random policy randomly sheds a given percent of requests. A hash policy - computes a hash over the CF-Connecting-IP address and sheds all requests - originating from a percent of IPs. - """ - - session_percent: float - """ - The percent of existing sessions to shed from the pool, according to the session - policy. - """ - - session_policy: Literal["hash"] - """ - Only the hash policy is supported for existing sessions (to avoid exponential - decay). - """ - - -class NotificationFilterOrigin(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilterPool(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilter(TypedDict, total=False): - origin: Optional[NotificationFilterOrigin] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - pool: Optional[NotificationFilterPool] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - -class OriginSteering(TypedDict, total=False): - policy: Literal["random", "hash", "least_outstanding_requests", "least_connections"] - """The type of origin steering policy to use. - - - `"random"`: Select an origin randomly. - - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP - address. - - `"least_outstanding_requests"`: Select an origin by taking into consideration - origin weights, as well as each origin's number of outstanding requests. - Origins with more pending requests are weighted proportionately less relative - to others. - - `"least_connections"`: Select an origin by taking into consideration origin - weights, as well as each origin's number of open connections. Origins with - more open connections are weighted proportionately less relative to others. - Supported for HTTP/1 and HTTP/2 connections. - """ diff --git a/src/cloudflare/types/load_balancers/pool_edit_params.py b/src/cloudflare/types/load_balancers/pool_edit_params.py index a3ea2be6131..6aa91f2955b 100644 --- a/src/cloudflare/types/load_balancers/pool_edit_params.py +++ b/src/cloudflare/types/load_balancers/pool_edit_params.py @@ -3,46 +3,22 @@ from __future__ import annotations from typing import List, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing_extensions import Required, TypedDict -from ..._utils import PropertyInfo +from .check_region import CheckRegion +from ..origin_item_param import OriginItemParam +from ..load_shedding_param import LoadSheddingParam +from ..origin_steering_param import OriginSteeringParam +from ..notification_filter_param import NotificationFilterParam -__all__ = [ - "PoolEditParams", - "LoadShedding", - "NotificationFilter", - "NotificationFilterOrigin", - "NotificationFilterPool", - "OriginSteering", - "Origin", - "OriginHeader", -] +__all__ = ["PoolEditParams"] class PoolEditParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] + check_regions: Optional[List[CheckRegion]] """A list of regions from which to run health checks. Null means every Cloudflare data center. @@ -65,7 +41,7 @@ class PoolEditParams(TypedDict, total=False): decimal degrees. If this is set, longitude must also be set. """ - load_shedding: LoadShedding + load_shedding: LoadSheddingParam """Configures load shedding policies and percentages for the pool.""" longitude: float @@ -102,156 +78,22 @@ class PoolEditParams(TypedDict, total=False): mailing list. Multiple emails can be supplied as a comma delimited list. """ - notification_filter: Optional[NotificationFilter] + notification_filter: Optional[NotificationFilterParam] """Filter pool and origin health notifications by resource type or health status. Use null to reset. """ - origin_steering: OriginSteering + origin_steering: OriginSteeringParam """Configures origin steering for the pool. Controls how origins are selected for new sessions and traffic without session affinity. """ - origins: Iterable[Origin] + origins: Iterable[OriginItemParam] """The list of origins within this pool. Traffic directed at this pool is balanced across all currently healthy origins, provided the pool itself is healthy. """ - - -class LoadShedding(TypedDict, total=False): - default_percent: float - """The percent of traffic to shed from the pool, according to the default policy. - - Applies to new sessions and traffic without session affinity. - """ - - default_policy: Literal["random", "hash"] - """The default policy to use when load shedding. - - A random policy randomly sheds a given percent of requests. A hash policy - computes a hash over the CF-Connecting-IP address and sheds all requests - originating from a percent of IPs. - """ - - session_percent: float - """ - The percent of existing sessions to shed from the pool, according to the session - policy. - """ - - session_policy: Literal["hash"] - """ - Only the hash policy is supported for existing sessions (to avoid exponential - decay). - """ - - -class NotificationFilterOrigin(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilterPool(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilter(TypedDict, total=False): - origin: Optional[NotificationFilterOrigin] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - pool: Optional[NotificationFilterPool] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - -class OriginSteering(TypedDict, total=False): - policy: Literal["random", "hash", "least_outstanding_requests", "least_connections"] - """The type of origin steering policy to use. - - - `"random"`: Select an origin randomly. - - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP - address. - - `"least_outstanding_requests"`: Select an origin by taking into consideration - origin weights, as well as each origin's number of outstanding requests. - Origins with more pending requests are weighted proportionately less relative - to others. - - `"least_connections"`: Select an origin by taking into consideration origin - weights, as well as each origin's number of open connections. Origins with - more open connections are weighted proportionately less relative to others. - Supported for HTTP/1 and HTTP/2 connections. - """ - - -class OriginHeader(TypedDict, total=False): - host: Annotated[List[str], PropertyInfo(alias="Host")] - """The 'Host' header allows to override the hostname set in the HTTP request. - - Current support is 1 'Host' header override per origin. - """ - - -class Origin(TypedDict, total=False): - address: str - """ - The IP address (IPv4 or IPv6) of the origin, or its publicly addressable - hostname. Hostnames entered here should resolve directly to the origin, and not - be a hostname proxied by Cloudflare. To set an internal/reserved address, - virtual_network_id must also be set. - """ - - enabled: bool - """Whether to enable (the default) this origin within the pool. - - Disabled origins will not receive traffic and are excluded from health checks. - The origin will only be disabled for the current pool. - """ - - header: OriginHeader - """The request header is used to pass additional information with an HTTP request. - - Currently supported header is 'Host'. - """ - - name: str - """A human-identifiable name for the origin.""" - - virtual_network_id: str - """The virtual network subnet ID the origin belongs in. - - Virtual network must also belong to the account. - """ - - weight: float - """The weight of this origin relative to other origins in the pool. - - Based on the configured weight the total traffic is distributed among origins - within the pool. - - - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the - origin's outstanding requests. - - `origin_steering.policy="least_connections"`: Use weight to scale the origin's - open connections. - """ diff --git a/src/cloudflare/types/load_balancers/pool_update_params.py b/src/cloudflare/types/load_balancers/pool_update_params.py index 585c2d2d175..d03d8aa4615 100644 --- a/src/cloudflare/types/load_balancers/pool_update_params.py +++ b/src/cloudflare/types/load_balancers/pool_update_params.py @@ -3,20 +3,15 @@ from __future__ import annotations from typing import List, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing_extensions import Required, TypedDict -from ..._utils import PropertyInfo +from .check_region import CheckRegion +from ..origin_item_param import OriginItemParam +from ..load_shedding_param import LoadSheddingParam +from ..origin_steering_param import OriginSteeringParam +from ..notification_filter_param import NotificationFilterParam -__all__ = [ - "PoolUpdateParams", - "Origin", - "OriginHeader", - "LoadShedding", - "NotificationFilter", - "NotificationFilterOrigin", - "NotificationFilterPool", - "OriginSteering", -] +__all__ = ["PoolUpdateParams"] class PoolUpdateParams(TypedDict, total=False): @@ -29,33 +24,14 @@ class PoolUpdateParams(TypedDict, total=False): Only alphanumeric characters, hyphens, and underscores are allowed. """ - origins: Required[Iterable[Origin]] + origins: Required[Iterable[OriginItemParam]] """The list of origins within this pool. Traffic directed at this pool is balanced across all currently healthy origins, provided the pool itself is healthy. """ - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] + check_regions: Optional[List[CheckRegion]] """A list of regions from which to run health checks. Null means every Cloudflare data center. @@ -78,7 +54,7 @@ class PoolUpdateParams(TypedDict, total=False): decimal degrees. If this is set, longitude must also be set. """ - load_shedding: LoadShedding + load_shedding: LoadSheddingParam """Configures load shedding policies and percentages for the pool.""" longitude: float @@ -109,149 +85,15 @@ class PoolUpdateParams(TypedDict, total=False): mailing list. Multiple emails can be supplied as a comma delimited list. """ - notification_filter: Optional[NotificationFilter] + notification_filter: Optional[NotificationFilterParam] """Filter pool and origin health notifications by resource type or health status. Use null to reset. """ - origin_steering: OriginSteering + origin_steering: OriginSteeringParam """Configures origin steering for the pool. Controls how origins are selected for new sessions and traffic without session affinity. """ - - -class OriginHeader(TypedDict, total=False): - host: Annotated[List[str], PropertyInfo(alias="Host")] - """The 'Host' header allows to override the hostname set in the HTTP request. - - Current support is 1 'Host' header override per origin. - """ - - -class Origin(TypedDict, total=False): - address: str - """ - The IP address (IPv4 or IPv6) of the origin, or its publicly addressable - hostname. Hostnames entered here should resolve directly to the origin, and not - be a hostname proxied by Cloudflare. To set an internal/reserved address, - virtual_network_id must also be set. - """ - - enabled: bool - """Whether to enable (the default) this origin within the pool. - - Disabled origins will not receive traffic and are excluded from health checks. - The origin will only be disabled for the current pool. - """ - - header: OriginHeader - """The request header is used to pass additional information with an HTTP request. - - Currently supported header is 'Host'. - """ - - name: str - """A human-identifiable name for the origin.""" - - virtual_network_id: str - """The virtual network subnet ID the origin belongs in. - - Virtual network must also belong to the account. - """ - - weight: float - """The weight of this origin relative to other origins in the pool. - - Based on the configured weight the total traffic is distributed among origins - within the pool. - - - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the - origin's outstanding requests. - - `origin_steering.policy="least_connections"`: Use weight to scale the origin's - open connections. - """ - - -class LoadShedding(TypedDict, total=False): - default_percent: float - """The percent of traffic to shed from the pool, according to the default policy. - - Applies to new sessions and traffic without session affinity. - """ - - default_policy: Literal["random", "hash"] - """The default policy to use when load shedding. - - A random policy randomly sheds a given percent of requests. A hash policy - computes a hash over the CF-Connecting-IP address and sheds all requests - originating from a percent of IPs. - """ - - session_percent: float - """ - The percent of existing sessions to shed from the pool, according to the session - policy. - """ - - session_policy: Literal["hash"] - """ - Only the hash policy is supported for existing sessions (to avoid exponential - decay). - """ - - -class NotificationFilterOrigin(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilterPool(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilter(TypedDict, total=False): - origin: Optional[NotificationFilterOrigin] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - pool: Optional[NotificationFilterPool] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - -class OriginSteering(TypedDict, total=False): - policy: Literal["random", "hash", "least_outstanding_requests", "least_connections"] - """The type of origin steering policy to use. - - - `"random"`: Select an origin randomly. - - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP - address. - - `"least_outstanding_requests"`: Select an origin by taking into consideration - origin weights, as well as each origin's number of outstanding requests. - Origins with more pending requests are weighted proportionately less relative - to others. - - `"least_connections"`: Select an origin by taking into consideration origin - weights, as well as each origin's number of open connections. Origins with - more open connections are weighted proportionately less relative to others. - Supported for HTTP/1 and HTTP/2 connections. - """ diff --git a/src/cloudflare/types/load_shedding.py b/src/cloudflare/types/load_shedding.py new file mode 100644 index 00000000000..85c4ad63952 --- /dev/null +++ b/src/cloudflare/types/load_shedding.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["LoadShedding"] + + +class LoadShedding(BaseModel): + default_percent: Optional[float] = None + """The percent of traffic to shed from the pool, according to the default policy. + + Applies to new sessions and traffic without session affinity. + """ + + default_policy: Optional[Literal["random", "hash"]] = None + """The default policy to use when load shedding. + + A random policy randomly sheds a given percent of requests. A hash policy + computes a hash over the CF-Connecting-IP address and sheds all requests + originating from a percent of IPs. + """ + + session_percent: Optional[float] = None + """ + The percent of existing sessions to shed from the pool, according to the session + policy. + """ + + session_policy: Optional[Literal["hash"]] = None + """ + Only the hash policy is supported for existing sessions (to avoid exponential + decay). + """ diff --git a/src/cloudflare/types/load_shedding_param.py b/src/cloudflare/types/load_shedding_param.py new file mode 100644 index 00000000000..96a271c86a7 --- /dev/null +++ b/src/cloudflare/types/load_shedding_param.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["LoadSheddingParam"] + + +class LoadSheddingParam(TypedDict, total=False): + default_percent: float + """The percent of traffic to shed from the pool, according to the default policy. + + Applies to new sessions and traffic without session affinity. + """ + + default_policy: Literal["random", "hash"] + """The default policy to use when load shedding. + + A random policy randomly sheds a given percent of requests. A hash policy + computes a hash over the CF-Connecting-IP address and sheds all requests + originating from a percent of IPs. + """ + + session_percent: float + """ + The percent of existing sessions to shed from the pool, according to the session + policy. + """ + + session_policy: Literal["hash"] + """ + Only the hash policy is supported for existing sessions (to avoid exponential + decay). + """ diff --git a/src/cloudflare/types/membership.py b/src/cloudflare/types/membership.py index 02f080b8959..186b8bf6bbe 100644 --- a/src/cloudflare/types/membership.py +++ b/src/cloudflare/types/membership.py @@ -5,7 +5,7 @@ from .account import Account from .._models import BaseModel -from .accounts import MemberPermission +from .user.tokens import Permission __all__ = ["Membership"] @@ -26,7 +26,7 @@ class Membership(BaseModel): code: Optional[str] = None """The unique activation code for the account membership.""" - permissions: Optional[MemberPermission] = None + permissions: Optional[Permission] = None """All access permissions for the user at the account.""" roles: Optional[List[str]] = None diff --git a/src/cloudflare/types/notification_filter.py b/src/cloudflare/types/notification_filter.py new file mode 100644 index 00000000000..563164efb33 --- /dev/null +++ b/src/cloudflare/types/notification_filter.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .._models import BaseModel +from .filter_options import FilterOptions + +__all__ = ["NotificationFilter"] + + +class NotificationFilter(BaseModel): + origin: Optional[FilterOptions] = None + """Filter options for a particular resource type (pool or origin). + + Use null to reset. + """ + + pool: Optional[FilterOptions] = None + """Filter options for a particular resource type (pool or origin). + + Use null to reset. + """ diff --git a/src/cloudflare/types/notification_filter_param.py b/src/cloudflare/types/notification_filter_param.py new file mode 100644 index 00000000000..ac4daaabaf3 --- /dev/null +++ b/src/cloudflare/types/notification_filter_param.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +from .filter_options_param import FilterOptionsParam + +__all__ = ["NotificationFilterParam"] + + +class NotificationFilterParam(TypedDict, total=False): + origin: Optional[FilterOptionsParam] + """Filter options for a particular resource type (pool or origin). + + Use null to reset. + """ + + pool: Optional[FilterOptionsParam] + """Filter options for a particular resource type (pool or origin). + + Use null to reset. + """ diff --git a/src/cloudflare/types/origin.py b/src/cloudflare/types/origin.py new file mode 100644 index 00000000000..f49147e0081 --- /dev/null +++ b/src/cloudflare/types/origin.py @@ -0,0 +1,59 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from .header import Header +from .._models import BaseModel + +__all__ = ["Origin"] + + +class Origin(BaseModel): + address: Optional[str] = None + """ + The IP address (IPv4 or IPv6) of the origin, or its publicly addressable + hostname. Hostnames entered here should resolve directly to the origin, and not + be a hostname proxied by Cloudflare. To set an internal/reserved address, + virtual_network_id must also be set. + """ + + disabled_at: Optional[datetime] = None + """This field shows up only if the origin is disabled. + + This field is set with the time the origin was disabled. + """ + + enabled: Optional[bool] = None + """Whether to enable (the default) this origin within the pool. + + Disabled origins will not receive traffic and are excluded from health checks. + The origin will only be disabled for the current pool. + """ + + header: Optional[Header] = None + """The request header is used to pass additional information with an HTTP request. + + Currently supported header is 'Host'. + """ + + name: Optional[str] = None + """A human-identifiable name for the origin.""" + + virtual_network_id: Optional[str] = None + """The virtual network subnet ID the origin belongs in. + + Virtual network must also belong to the account. + """ + + weight: Optional[float] = None + """The weight of this origin relative to other origins in the pool. + + Based on the configured weight the total traffic is distributed among origins + within the pool. + + - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the + origin's outstanding requests. + - `origin_steering.policy="least_connections"`: Use weight to scale the origin's + open connections. + """ diff --git a/src/cloudflare/types/origin_item.py b/src/cloudflare/types/origin_item.py new file mode 100644 index 00000000000..c93fc2ad04a --- /dev/null +++ b/src/cloudflare/types/origin_item.py @@ -0,0 +1,59 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from .header import Header +from .._models import BaseModel + +__all__ = ["OriginItem"] + + +class OriginItem(BaseModel): + address: Optional[str] = None + """ + The IP address (IPv4 or IPv6) of the origin, or its publicly addressable + hostname. Hostnames entered here should resolve directly to the origin, and not + be a hostname proxied by Cloudflare. To set an internal/reserved address, + virtual_network_id must also be set. + """ + + disabled_at: Optional[datetime] = None + """This field shows up only if the origin is disabled. + + This field is set with the time the origin was disabled. + """ + + enabled: Optional[bool] = None + """Whether to enable (the default) this origin within the pool. + + Disabled origins will not receive traffic and are excluded from health checks. + The origin will only be disabled for the current pool. + """ + + header: Optional[Header] = None + """The request header is used to pass additional information with an HTTP request. + + Currently supported header is 'Host'. + """ + + name: Optional[str] = None + """A human-identifiable name for the origin.""" + + virtual_network_id: Optional[str] = None + """The virtual network subnet ID the origin belongs in. + + Virtual network must also belong to the account. + """ + + weight: Optional[float] = None + """The weight of this origin relative to other origins in the pool. + + Based on the configured weight the total traffic is distributed among origins + within the pool. + + - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the + origin's outstanding requests. + - `origin_steering.policy="least_connections"`: Use weight to scale the origin's + open connections. + """ diff --git a/src/cloudflare/types/origin_item_param.py b/src/cloudflare/types/origin_item_param.py new file mode 100644 index 00000000000..cda4d44dadd --- /dev/null +++ b/src/cloudflare/types/origin_item_param.py @@ -0,0 +1,53 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from .header_param import HeaderParam + +__all__ = ["OriginItemParam"] + + +class OriginItemParam(TypedDict, total=False): + address: str + """ + The IP address (IPv4 or IPv6) of the origin, or its publicly addressable + hostname. Hostnames entered here should resolve directly to the origin, and not + be a hostname proxied by Cloudflare. To set an internal/reserved address, + virtual_network_id must also be set. + """ + + enabled: bool + """Whether to enable (the default) this origin within the pool. + + Disabled origins will not receive traffic and are excluded from health checks. + The origin will only be disabled for the current pool. + """ + + header: HeaderParam + """The request header is used to pass additional information with an HTTP request. + + Currently supported header is 'Host'. + """ + + name: str + """A human-identifiable name for the origin.""" + + virtual_network_id: str + """The virtual network subnet ID the origin belongs in. + + Virtual network must also belong to the account. + """ + + weight: float + """The weight of this origin relative to other origins in the pool. + + Based on the configured weight the total traffic is distributed among origins + within the pool. + + - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the + origin's outstanding requests. + - `origin_steering.policy="least_connections"`: Use weight to scale the origin's + open connections. + """ diff --git a/src/cloudflare/types/origin_param.py b/src/cloudflare/types/origin_param.py new file mode 100644 index 00000000000..0b35856a9b5 --- /dev/null +++ b/src/cloudflare/types/origin_param.py @@ -0,0 +1,53 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from .header_param import HeaderParam + +__all__ = ["OriginParam"] + + +class OriginParam(TypedDict, total=False): + address: str + """ + The IP address (IPv4 or IPv6) of the origin, or its publicly addressable + hostname. Hostnames entered here should resolve directly to the origin, and not + be a hostname proxied by Cloudflare. To set an internal/reserved address, + virtual_network_id must also be set. + """ + + enabled: bool + """Whether to enable (the default) this origin within the pool. + + Disabled origins will not receive traffic and are excluded from health checks. + The origin will only be disabled for the current pool. + """ + + header: HeaderParam + """The request header is used to pass additional information with an HTTP request. + + Currently supported header is 'Host'. + """ + + name: str + """A human-identifiable name for the origin.""" + + virtual_network_id: str + """The virtual network subnet ID the origin belongs in. + + Virtual network must also belong to the account. + """ + + weight: float + """The weight of this origin relative to other origins in the pool. + + Based on the configured weight the total traffic is distributed among origins + within the pool. + + - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the + origin's outstanding requests. + - `origin_steering.policy="least_connections"`: Use weight to scale the origin's + open connections. + """ diff --git a/src/cloudflare/types/origin_steering.py b/src/cloudflare/types/origin_steering.py new file mode 100644 index 00000000000..a0511a636bc --- /dev/null +++ b/src/cloudflare/types/origin_steering.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["OriginSteering"] + + +class OriginSteering(BaseModel): + policy: Optional[Literal["random", "hash", "least_outstanding_requests", "least_connections"]] = None + """The type of origin steering policy to use. + + - `"random"`: Select an origin randomly. + - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP + address. + - `"least_outstanding_requests"`: Select an origin by taking into consideration + origin weights, as well as each origin's number of outstanding requests. + Origins with more pending requests are weighted proportionately less relative + to others. + - `"least_connections"`: Select an origin by taking into consideration origin + weights, as well as each origin's number of open connections. Origins with + more open connections are weighted proportionately less relative to others. + Supported for HTTP/1 and HTTP/2 connections. + """ diff --git a/src/cloudflare/types/origin_steering_param.py b/src/cloudflare/types/origin_steering_param.py new file mode 100644 index 00000000000..82bfee85f69 --- /dev/null +++ b/src/cloudflare/types/origin_steering_param.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["OriginSteeringParam"] + + +class OriginSteeringParam(TypedDict, total=False): + policy: Literal["random", "hash", "least_outstanding_requests", "least_connections"] + """The type of origin steering policy to use. + + - `"random"`: Select an origin randomly. + - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP + address. + - `"least_outstanding_requests"`: Select an origin by taking into consideration + origin weights, as well as each origin's number of outstanding requests. + Origins with more pending requests are weighted proportionately less relative + to others. + - `"least_connections"`: Select an origin by taking into consideration origin + weights, as well as each origin's number of open connections. Origins with + more open connections are weighted proportionately less relative to others. + Supported for HTTP/1 and HTTP/2 connections. + """ diff --git a/src/cloudflare/types/shared/unnamed_schema_ref_b92f86eb861cd3dee83c40884802fda6.py b/src/cloudflare/types/shared/unnamed_schema_ref_b92f86eb861cd3dee83c40884802fda6.py index 70b6c9f4439..98679a1842e 100644 --- a/src/cloudflare/types/shared/unnamed_schema_ref_b92f86eb861cd3dee83c40884802fda6.py +++ b/src/cloudflare/types/shared/unnamed_schema_ref_b92f86eb861cd3dee83c40884802fda6.py @@ -4,160 +4,13 @@ from datetime import datetime from typing_extensions import Literal -from pydantic import Field as FieldInfo - +from ..origin import Origin from ..._models import BaseModel +from ..load_shedding import LoadShedding +from ..origin_steering import OriginSteering +from ..notification_filter import NotificationFilter -__all__ = [ - "UnnamedSchemaRefB92f86eb861cd3dee83c40884802fda6", - "LoadShedding", - "NotificationFilter", - "NotificationFilterOrigin", - "NotificationFilterPool", - "OriginSteering", - "Origin", - "OriginHeader", -] - - -class LoadShedding(BaseModel): - default_percent: Optional[float] = None - """The percent of traffic to shed from the pool, according to the default policy. - - Applies to new sessions and traffic without session affinity. - """ - - default_policy: Optional[Literal["random", "hash"]] = None - """The default policy to use when load shedding. - - A random policy randomly sheds a given percent of requests. A hash policy - computes a hash over the CF-Connecting-IP address and sheds all requests - originating from a percent of IPs. - """ - - session_percent: Optional[float] = None - """ - The percent of existing sessions to shed from the pool, according to the session - policy. - """ - - session_policy: Optional[Literal["hash"]] = None - """ - Only the hash policy is supported for existing sessions (to avoid exponential - decay). - """ - - -class NotificationFilterOrigin(BaseModel): - disable: Optional[bool] = None - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] = None - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilterPool(BaseModel): - disable: Optional[bool] = None - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] = None - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilter(BaseModel): - origin: Optional[NotificationFilterOrigin] = None - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - pool: Optional[NotificationFilterPool] = None - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - -class OriginSteering(BaseModel): - policy: Optional[Literal["random", "hash", "least_outstanding_requests", "least_connections"]] = None - """The type of origin steering policy to use. - - - `"random"`: Select an origin randomly. - - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP - address. - - `"least_outstanding_requests"`: Select an origin by taking into consideration - origin weights, as well as each origin's number of outstanding requests. - Origins with more pending requests are weighted proportionately less relative - to others. - - `"least_connections"`: Select an origin by taking into consideration origin - weights, as well as each origin's number of open connections. Origins with - more open connections are weighted proportionately less relative to others. - Supported for HTTP/1 and HTTP/2 connections. - """ - - -class OriginHeader(BaseModel): - host: Optional[List[str]] = FieldInfo(alias="Host", default=None) - """The 'Host' header allows to override the hostname set in the HTTP request. - - Current support is 1 'Host' header override per origin. - """ - - -class Origin(BaseModel): - address: Optional[str] = None - """ - The IP address (IPv4 or IPv6) of the origin, or its publicly addressable - hostname. Hostnames entered here should resolve directly to the origin, and not - be a hostname proxied by Cloudflare. To set an internal/reserved address, - virtual_network_id must also be set. - """ - - disabled_at: Optional[datetime] = None - """This field shows up only if the origin is disabled. - - This field is set with the time the origin was disabled. - """ - - enabled: Optional[bool] = None - """Whether to enable (the default) this origin within the pool. - - Disabled origins will not receive traffic and are excluded from health checks. - The origin will only be disabled for the current pool. - """ - - header: Optional[OriginHeader] = None - """The request header is used to pass additional information with an HTTP request. - - Currently supported header is 'Host'. - """ - - name: Optional[str] = None - """A human-identifiable name for the origin.""" - - virtual_network_id: Optional[str] = None - """The virtual network subnet ID the origin belongs in. - - Virtual network must also belong to the account. - """ - - weight: Optional[float] = None - """The weight of this origin relative to other origins in the pool. - - Based on the configured weight the total traffic is distributed among origins - within the pool. - - - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the - origin's outstanding requests. - - `origin_steering.policy="least_connections"`: Use weight to scale the origin's - open connections. - """ +__all__ = ["UnnamedSchemaRefB92f86eb861cd3dee83c40884802fda6"] class UnnamedSchemaRefB92f86eb861cd3dee83c40884802fda6(BaseModel): diff --git a/src/cloudflare/types/ssl.py b/src/cloudflare/types/ssl.py new file mode 100644 index 00000000000..952e7708259 --- /dev/null +++ b/src/cloudflare/types/ssl.py @@ -0,0 +1,159 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel +from .unnamed_schema_ref_9a9935a9a770967bb604ae41a81e42e1 import UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1 +from .unnamed_schema_ref_16aca57bde2963201c7e6e895436c1c1 import UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 +from .unnamed_schema_ref_78adb375f06c6d462dd92b99e2ecf510 import UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510 + +__all__ = ["SSL", "Settings", "ValidationError", "ValidationRecord"] + + +class Settings(BaseModel): + ciphers: Optional[List[str]] = None + """An allowlist of ciphers for TLS termination. + + These ciphers must be in the BoringSSL format. + """ + + early_hints: Optional[Literal["on", "off"]] = None + """Whether or not Early Hints is enabled.""" + + http2: Optional[Literal["on", "off"]] = None + """Whether or not HTTP2 is enabled.""" + + min_tls_version: Optional[Literal["1.0", "1.1", "1.2", "1.3"]] = None + """The minimum TLS version supported.""" + + tls_1_3: Optional[Literal["on", "off"]] = None + """Whether or not TLS 1.3 is enabled.""" + + +class ValidationError(BaseModel): + message: Optional[str] = None + """A domain validation error.""" + + +class ValidationRecord(BaseModel): + emails: Optional[List[object]] = None + """ + The set of email addresses that the certificate authority (CA) will use to + complete domain validation. + """ + + http_body: Optional[str] = None + """ + The content that the certificate authority (CA) will expect to find at the + http_url during the domain validation. + """ + + http_url: Optional[str] = None + """The url that will be checked during domain validation.""" + + txt_name: Optional[str] = None + """ + The hostname that the certificate authority (CA) will check for a TXT record + during domain validation . + """ + + txt_value: Optional[str] = None + """ + The TXT record that the certificate authority (CA) will check during domain + validation. + """ + + +class SSL(BaseModel): + id: Optional[str] = None + """Custom hostname SSL identifier tag.""" + + bundle_method: Optional[UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1] = None + """ + A ubiquitous bundle has the highest probability of being verified everywhere, + even by clients using outdated or unusual trust stores. An optimal bundle uses + the shortest chain and newest intermediates. And the force bundle verifies the + chain, but does not otherwise modify it. + """ + + certificate_authority: Optional[Literal["digicert", "google", "lets_encrypt"]] = None + """The Certificate Authority that will issue the certificate""" + + custom_certificate: Optional[str] = None + """If a custom uploaded certificate is used.""" + + custom_csr_id: Optional[str] = None + """The identifier for the Custom CSR that was used.""" + + custom_key: Optional[str] = None + """The key for a custom uploaded certificate.""" + + expires_on: Optional[datetime] = None + """The time the custom certificate expires on.""" + + hosts: Optional[List[object]] = None + """A list of Hostnames on a custom uploaded certificate.""" + + issuer: Optional[str] = None + """The issuer on a custom uploaded certificate.""" + + method: Optional[UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510] = None + """Domain control validation (DCV) method used for this hostname.""" + + serial_number: Optional[str] = None + """The serial number on a custom uploaded certificate.""" + + settings: Optional[Settings] = None + """SSL specific settings.""" + + signature: Optional[str] = None + """The signature on a custom uploaded certificate.""" + + status: Optional[ + Literal[ + "initializing", + "pending_validation", + "deleted", + "pending_issuance", + "pending_deployment", + "pending_deletion", + "pending_expiration", + "expired", + "active", + "initializing_timed_out", + "validation_timed_out", + "issuance_timed_out", + "deployment_timed_out", + "deletion_timed_out", + "pending_cleanup", + "staging_deployment", + "staging_active", + "deactivating", + "inactive", + "backup_issued", + "holding_deployment", + ] + ] = None + """Status of the hostname's SSL certificates.""" + + type: Optional[UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1] = None + """Level of validation to be used for this hostname. + + Domain validation (dv) must be used. + """ + + uploaded_on: Optional[datetime] = None + """The time the custom certificate was uploaded.""" + + validation_errors: Optional[List[ValidationError]] = None + """ + Domain validation errors that have been received by the certificate authority + (CA). + """ + + validation_records: Optional[List[ValidationRecord]] = None + + wildcard: Optional[bool] = None + """Indicates whether the certificate covers a wildcard.""" diff --git a/src/cloudflare/types/subscription_configuration.py b/src/cloudflare/types/subscription_configuration.py new file mode 100644 index 00000000000..19c7a95cbdf --- /dev/null +++ b/src/cloudflare/types/subscription_configuration.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .._models import BaseModel + +__all__ = ["SubscriptionConfiguration"] + + +class SubscriptionConfiguration(BaseModel): + auto_update_model: Optional[bool] = None + """ + Automatically update to the newest bot detection models created by Cloudflare as + they are released. + [Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes) + """ + + enable_js: Optional[bool] = None + """Use lightweight, invisible JavaScript detections to improve Bot Management. + + [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + """ + + suppress_session_score: Optional[bool] = None + """ + Whether to disable tracking the highest bot score for a session in the Bot + Management cookie. + """ + + using_latest_model: Optional[bool] = None + """ + A read-only field that indicates whether the zone currently is running the + latest ML model. + """ diff --git a/src/cloudflare/types/super_bot_fight_mode_definitely_configuration.py b/src/cloudflare/types/super_bot_fight_mode_definitely_configuration.py new file mode 100644 index 00000000000..f03373fffa8 --- /dev/null +++ b/src/cloudflare/types/super_bot_fight_mode_definitely_configuration.py @@ -0,0 +1,38 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["SuperBotFightModeDefinitelyConfiguration"] + + +class SuperBotFightModeDefinitelyConfiguration(BaseModel): + enable_js: Optional[bool] = None + """Use lightweight, invisible JavaScript detections to improve Bot Management. + + [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + """ + + optimize_wordpress: Optional[bool] = None + """Whether to optimize Super Bot Fight Mode protections for Wordpress.""" + + sbfm_definitely_automated: Optional[Literal["allow", "block", "managed_challenge"]] = None + """Super Bot Fight Mode (SBFM) action to take on definitely automated requests.""" + + sbfm_static_resource_protection: Optional[bool] = None + """ + Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if + static resources on your application need bot protection. Note: Static resource + protection can also result in legitimate traffic being blocked. + """ + + sbfm_verified_bots: Optional[Literal["allow", "block"]] = None + """Super Bot Fight Mode (SBFM) action to take on verified bots requests.""" + + using_latest_model: Optional[bool] = None + """ + A read-only field that indicates whether the zone currently is running the + latest ML model. + """ diff --git a/src/cloudflare/types/super_bot_fight_mode_likely_config.py b/src/cloudflare/types/super_bot_fight_mode_likely_config.py new file mode 100644 index 00000000000..f7e8954ac5b --- /dev/null +++ b/src/cloudflare/types/super_bot_fight_mode_likely_config.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["SuperBotFightModeLikelyConfig"] + + +class SuperBotFightModeLikelyConfig(BaseModel): + enable_js: Optional[bool] = None + """Use lightweight, invisible JavaScript detections to improve Bot Management. + + [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + """ + + optimize_wordpress: Optional[bool] = None + """Whether to optimize Super Bot Fight Mode protections for Wordpress.""" + + sbfm_definitely_automated: Optional[Literal["allow", "block", "managed_challenge"]] = None + """Super Bot Fight Mode (SBFM) action to take on definitely automated requests.""" + + sbfm_likely_automated: Optional[Literal["allow", "block", "managed_challenge"]] = None + """Super Bot Fight Mode (SBFM) action to take on likely automated requests.""" + + sbfm_static_resource_protection: Optional[bool] = None + """ + Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if + static resources on your application need bot protection. Note: Static resource + protection can also result in legitimate traffic being blocked. + """ + + sbfm_verified_bots: Optional[Literal["allow", "block"]] = None + """Super Bot Fight Mode (SBFM) action to take on verified bots requests.""" + + using_latest_model: Optional[bool] = None + """ + A read-only field that indicates whether the zone currently is running the + latest ML model. + """ diff --git a/src/cloudflare/types/user/invite_list_response.py b/src/cloudflare/types/user/invite_list_response.py index 1c7fae63a42..4552dab6bdb 100644 --- a/src/cloudflare/types/user/invite_list_response.py +++ b/src/cloudflare/types/user/invite_list_response.py @@ -5,22 +5,9 @@ from typing_extensions import Literal from ..._models import BaseModel +from ..accounts import Role -__all__ = ["InviteListResponse", "Role"] - - -class Role(BaseModel): - id: str - """Role identifier tag.""" - - description: str - """Description of role's permissions.""" - - name: str - """Role Name.""" - - permissions: List[str] - """Access permissions for this User.""" +__all__ = ["InviteListResponse"] class InviteListResponse(BaseModel): diff --git a/src/cloudflare/types/user/load_balancers/pool.py b/src/cloudflare/types/user/load_balancers/pool.py index 2380e7714ec..c255acf23dd 100644 --- a/src/cloudflare/types/user/load_balancers/pool.py +++ b/src/cloudflare/types/user/load_balancers/pool.py @@ -4,160 +4,13 @@ from datetime import datetime from typing_extensions import Literal -from pydantic import Field as FieldInfo - +from ...origin import Origin from ...._models import BaseModel +from ...load_shedding import LoadShedding +from ...origin_steering import OriginSteering +from ...notification_filter import NotificationFilter -__all__ = [ - "Pool", - "LoadShedding", - "NotificationFilter", - "NotificationFilterOrigin", - "NotificationFilterPool", - "OriginSteering", - "Origin", - "OriginHeader", -] - - -class LoadShedding(BaseModel): - default_percent: Optional[float] = None - """The percent of traffic to shed from the pool, according to the default policy. - - Applies to new sessions and traffic without session affinity. - """ - - default_policy: Optional[Literal["random", "hash"]] = None - """The default policy to use when load shedding. - - A random policy randomly sheds a given percent of requests. A hash policy - computes a hash over the CF-Connecting-IP address and sheds all requests - originating from a percent of IPs. - """ - - session_percent: Optional[float] = None - """ - The percent of existing sessions to shed from the pool, according to the session - policy. - """ - - session_policy: Optional[Literal["hash"]] = None - """ - Only the hash policy is supported for existing sessions (to avoid exponential - decay). - """ - - -class NotificationFilterOrigin(BaseModel): - disable: Optional[bool] = None - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] = None - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilterPool(BaseModel): - disable: Optional[bool] = None - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] = None - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilter(BaseModel): - origin: Optional[NotificationFilterOrigin] = None - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - pool: Optional[NotificationFilterPool] = None - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - -class OriginSteering(BaseModel): - policy: Optional[Literal["random", "hash", "least_outstanding_requests", "least_connections"]] = None - """The type of origin steering policy to use. - - - `"random"`: Select an origin randomly. - - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP - address. - - `"least_outstanding_requests"`: Select an origin by taking into consideration - origin weights, as well as each origin's number of outstanding requests. - Origins with more pending requests are weighted proportionately less relative - to others. - - `"least_connections"`: Select an origin by taking into consideration origin - weights, as well as each origin's number of open connections. Origins with - more open connections are weighted proportionately less relative to others. - Supported for HTTP/1 and HTTP/2 connections. - """ - - -class OriginHeader(BaseModel): - host: Optional[List[str]] = FieldInfo(alias="Host", default=None) - """The 'Host' header allows to override the hostname set in the HTTP request. - - Current support is 1 'Host' header override per origin. - """ - - -class Origin(BaseModel): - address: Optional[str] = None - """ - The IP address (IPv4 or IPv6) of the origin, or its publicly addressable - hostname. Hostnames entered here should resolve directly to the origin, and not - be a hostname proxied by Cloudflare. To set an internal/reserved address, - virtual_network_id must also be set. - """ - - disabled_at: Optional[datetime] = None - """This field shows up only if the origin is disabled. - - This field is set with the time the origin was disabled. - """ - - enabled: Optional[bool] = None - """Whether to enable (the default) this origin within the pool. - - Disabled origins will not receive traffic and are excluded from health checks. - The origin will only be disabled for the current pool. - """ - - header: Optional[OriginHeader] = None - """The request header is used to pass additional information with an HTTP request. - - Currently supported header is 'Host'. - """ - - name: Optional[str] = None - """A human-identifiable name for the origin.""" - - virtual_network_id: Optional[str] = None - """The virtual network subnet ID the origin belongs in. - - Virtual network must also belong to the account. - """ - - weight: Optional[float] = None - """The weight of this origin relative to other origins in the pool. - - Based on the configured weight the total traffic is distributed among origins - within the pool. - - - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the - origin's outstanding requests. - - `origin_steering.policy="least_connections"`: Use weight to scale the origin's - open connections. - """ +__all__ = ["Pool"] class Pool(BaseModel): diff --git a/src/cloudflare/types/user/load_balancers/pool_create_params.py b/src/cloudflare/types/user/load_balancers/pool_create_params.py index 65019aee9a1..e3a595de245 100644 --- a/src/cloudflare/types/user/load_balancers/pool_create_params.py +++ b/src/cloudflare/types/user/load_balancers/pool_create_params.py @@ -3,20 +3,14 @@ from __future__ import annotations from typing import List, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing_extensions import Literal, Required, TypedDict -from ...._utils import PropertyInfo +from ...origin_param import OriginParam +from ...load_shedding_param import LoadSheddingParam +from ...origin_steering_param import OriginSteeringParam +from ...notification_filter_param import NotificationFilterParam -__all__ = [ - "PoolCreateParams", - "Origin", - "OriginHeader", - "LoadShedding", - "NotificationFilter", - "NotificationFilterOrigin", - "NotificationFilterPool", - "OriginSteering", -] +__all__ = ["PoolCreateParams"] class PoolCreateParams(TypedDict, total=False): @@ -26,7 +20,7 @@ class PoolCreateParams(TypedDict, total=False): Only alphanumeric characters, hyphens, and underscores are allowed. """ - origins: Required[Iterable[Origin]] + origins: Required[Iterable[OriginParam]] """The list of origins within this pool. Traffic directed at this pool is balanced across all currently healthy origins, @@ -75,7 +69,7 @@ class PoolCreateParams(TypedDict, total=False): decimal degrees. If this is set, longitude must also be set. """ - load_shedding: LoadShedding + load_shedding: LoadSheddingParam """Configures load shedding policies and percentages for the pool.""" longitude: float @@ -106,149 +100,15 @@ class PoolCreateParams(TypedDict, total=False): mailing list. Multiple emails can be supplied as a comma delimited list. """ - notification_filter: Optional[NotificationFilter] + notification_filter: Optional[NotificationFilterParam] """Filter pool and origin health notifications by resource type or health status. Use null to reset. """ - origin_steering: OriginSteering + origin_steering: OriginSteeringParam """Configures origin steering for the pool. Controls how origins are selected for new sessions and traffic without session affinity. """ - - -class OriginHeader(TypedDict, total=False): - host: Annotated[List[str], PropertyInfo(alias="Host")] - """The 'Host' header allows to override the hostname set in the HTTP request. - - Current support is 1 'Host' header override per origin. - """ - - -class Origin(TypedDict, total=False): - address: str - """ - The IP address (IPv4 or IPv6) of the origin, or its publicly addressable - hostname. Hostnames entered here should resolve directly to the origin, and not - be a hostname proxied by Cloudflare. To set an internal/reserved address, - virtual_network_id must also be set. - """ - - enabled: bool - """Whether to enable (the default) this origin within the pool. - - Disabled origins will not receive traffic and are excluded from health checks. - The origin will only be disabled for the current pool. - """ - - header: OriginHeader - """The request header is used to pass additional information with an HTTP request. - - Currently supported header is 'Host'. - """ - - name: str - """A human-identifiable name for the origin.""" - - virtual_network_id: str - """The virtual network subnet ID the origin belongs in. - - Virtual network must also belong to the account. - """ - - weight: float - """The weight of this origin relative to other origins in the pool. - - Based on the configured weight the total traffic is distributed among origins - within the pool. - - - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the - origin's outstanding requests. - - `origin_steering.policy="least_connections"`: Use weight to scale the origin's - open connections. - """ - - -class LoadShedding(TypedDict, total=False): - default_percent: float - """The percent of traffic to shed from the pool, according to the default policy. - - Applies to new sessions and traffic without session affinity. - """ - - default_policy: Literal["random", "hash"] - """The default policy to use when load shedding. - - A random policy randomly sheds a given percent of requests. A hash policy - computes a hash over the CF-Connecting-IP address and sheds all requests - originating from a percent of IPs. - """ - - session_percent: float - """ - The percent of existing sessions to shed from the pool, according to the session - policy. - """ - - session_policy: Literal["hash"] - """ - Only the hash policy is supported for existing sessions (to avoid exponential - decay). - """ - - -class NotificationFilterOrigin(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilterPool(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilter(TypedDict, total=False): - origin: Optional[NotificationFilterOrigin] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - pool: Optional[NotificationFilterPool] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - -class OriginSteering(TypedDict, total=False): - policy: Literal["random", "hash", "least_outstanding_requests", "least_connections"] - """The type of origin steering policy to use. - - - `"random"`: Select an origin randomly. - - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP - address. - - `"least_outstanding_requests"`: Select an origin by taking into consideration - origin weights, as well as each origin's number of outstanding requests. - Origins with more pending requests are weighted proportionately less relative - to others. - - `"least_connections"`: Select an origin by taking into consideration origin - weights, as well as each origin's number of open connections. Origins with - more open connections are weighted proportionately less relative to others. - Supported for HTTP/1 and HTTP/2 connections. - """ diff --git a/src/cloudflare/types/user/load_balancers/pool_edit_params.py b/src/cloudflare/types/user/load_balancers/pool_edit_params.py index f046e3937c3..3109737efa0 100644 --- a/src/cloudflare/types/user/load_balancers/pool_edit_params.py +++ b/src/cloudflare/types/user/load_balancers/pool_edit_params.py @@ -3,20 +3,14 @@ from __future__ import annotations from typing import List, Iterable, Optional -from typing_extensions import Literal, Annotated, TypedDict +from typing_extensions import Literal, TypedDict -from ...._utils import PropertyInfo +from ...origin_param import OriginParam +from ...load_shedding_param import LoadSheddingParam +from ...origin_steering_param import OriginSteeringParam +from ...notification_filter_param import NotificationFilterParam -__all__ = [ - "PoolEditParams", - "LoadShedding", - "NotificationFilter", - "NotificationFilterOrigin", - "NotificationFilterPool", - "OriginSteering", - "Origin", - "OriginHeader", -] +__all__ = ["PoolEditParams"] class PoolEditParams(TypedDict, total=False): @@ -62,7 +56,7 @@ class PoolEditParams(TypedDict, total=False): decimal degrees. If this is set, longitude must also be set. """ - load_shedding: LoadShedding + load_shedding: LoadSheddingParam """Configures load shedding policies and percentages for the pool.""" longitude: float @@ -99,156 +93,22 @@ class PoolEditParams(TypedDict, total=False): mailing list. Multiple emails can be supplied as a comma delimited list. """ - notification_filter: Optional[NotificationFilter] + notification_filter: Optional[NotificationFilterParam] """Filter pool and origin health notifications by resource type or health status. Use null to reset. """ - origin_steering: OriginSteering + origin_steering: OriginSteeringParam """Configures origin steering for the pool. Controls how origins are selected for new sessions and traffic without session affinity. """ - origins: Iterable[Origin] + origins: Iterable[OriginParam] """The list of origins within this pool. Traffic directed at this pool is balanced across all currently healthy origins, provided the pool itself is healthy. """ - - -class LoadShedding(TypedDict, total=False): - default_percent: float - """The percent of traffic to shed from the pool, according to the default policy. - - Applies to new sessions and traffic without session affinity. - """ - - default_policy: Literal["random", "hash"] - """The default policy to use when load shedding. - - A random policy randomly sheds a given percent of requests. A hash policy - computes a hash over the CF-Connecting-IP address and sheds all requests - originating from a percent of IPs. - """ - - session_percent: float - """ - The percent of existing sessions to shed from the pool, according to the session - policy. - """ - - session_policy: Literal["hash"] - """ - Only the hash policy is supported for existing sessions (to avoid exponential - decay). - """ - - -class NotificationFilterOrigin(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilterPool(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilter(TypedDict, total=False): - origin: Optional[NotificationFilterOrigin] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - pool: Optional[NotificationFilterPool] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - -class OriginSteering(TypedDict, total=False): - policy: Literal["random", "hash", "least_outstanding_requests", "least_connections"] - """The type of origin steering policy to use. - - - `"random"`: Select an origin randomly. - - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP - address. - - `"least_outstanding_requests"`: Select an origin by taking into consideration - origin weights, as well as each origin's number of outstanding requests. - Origins with more pending requests are weighted proportionately less relative - to others. - - `"least_connections"`: Select an origin by taking into consideration origin - weights, as well as each origin's number of open connections. Origins with - more open connections are weighted proportionately less relative to others. - Supported for HTTP/1 and HTTP/2 connections. - """ - - -class OriginHeader(TypedDict, total=False): - host: Annotated[List[str], PropertyInfo(alias="Host")] - """The 'Host' header allows to override the hostname set in the HTTP request. - - Current support is 1 'Host' header override per origin. - """ - - -class Origin(TypedDict, total=False): - address: str - """ - The IP address (IPv4 or IPv6) of the origin, or its publicly addressable - hostname. Hostnames entered here should resolve directly to the origin, and not - be a hostname proxied by Cloudflare. To set an internal/reserved address, - virtual_network_id must also be set. - """ - - enabled: bool - """Whether to enable (the default) this origin within the pool. - - Disabled origins will not receive traffic and are excluded from health checks. - The origin will only be disabled for the current pool. - """ - - header: OriginHeader - """The request header is used to pass additional information with an HTTP request. - - Currently supported header is 'Host'. - """ - - name: str - """A human-identifiable name for the origin.""" - - virtual_network_id: str - """The virtual network subnet ID the origin belongs in. - - Virtual network must also belong to the account. - """ - - weight: float - """The weight of this origin relative to other origins in the pool. - - Based on the configured weight the total traffic is distributed among origins - within the pool. - - - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the - origin's outstanding requests. - - `origin_steering.policy="least_connections"`: Use weight to scale the origin's - open connections. - """ diff --git a/src/cloudflare/types/user/load_balancers/pool_update_params.py b/src/cloudflare/types/user/load_balancers/pool_update_params.py index e073f1cb377..3d6f82bcd17 100644 --- a/src/cloudflare/types/user/load_balancers/pool_update_params.py +++ b/src/cloudflare/types/user/load_balancers/pool_update_params.py @@ -3,20 +3,14 @@ from __future__ import annotations from typing import List, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing_extensions import Literal, Required, TypedDict -from ...._utils import PropertyInfo +from ...origin_param import OriginParam +from ...load_shedding_param import LoadSheddingParam +from ...origin_steering_param import OriginSteeringParam +from ...notification_filter_param import NotificationFilterParam -__all__ = [ - "PoolUpdateParams", - "Origin", - "OriginHeader", - "LoadShedding", - "NotificationFilter", - "NotificationFilterOrigin", - "NotificationFilterPool", - "OriginSteering", -] +__all__ = ["PoolUpdateParams"] class PoolUpdateParams(TypedDict, total=False): @@ -26,7 +20,7 @@ class PoolUpdateParams(TypedDict, total=False): Only alphanumeric characters, hyphens, and underscores are allowed. """ - origins: Required[Iterable[Origin]] + origins: Required[Iterable[OriginParam]] """The list of origins within this pool. Traffic directed at this pool is balanced across all currently healthy origins, @@ -75,7 +69,7 @@ class PoolUpdateParams(TypedDict, total=False): decimal degrees. If this is set, longitude must also be set. """ - load_shedding: LoadShedding + load_shedding: LoadSheddingParam """Configures load shedding policies and percentages for the pool.""" longitude: float @@ -106,149 +100,15 @@ class PoolUpdateParams(TypedDict, total=False): mailing list. Multiple emails can be supplied as a comma delimited list. """ - notification_filter: Optional[NotificationFilter] + notification_filter: Optional[NotificationFilterParam] """Filter pool and origin health notifications by resource type or health status. Use null to reset. """ - origin_steering: OriginSteering + origin_steering: OriginSteeringParam """Configures origin steering for the pool. Controls how origins are selected for new sessions and traffic without session affinity. """ - - -class OriginHeader(TypedDict, total=False): - host: Annotated[List[str], PropertyInfo(alias="Host")] - """The 'Host' header allows to override the hostname set in the HTTP request. - - Current support is 1 'Host' header override per origin. - """ - - -class Origin(TypedDict, total=False): - address: str - """ - The IP address (IPv4 or IPv6) of the origin, or its publicly addressable - hostname. Hostnames entered here should resolve directly to the origin, and not - be a hostname proxied by Cloudflare. To set an internal/reserved address, - virtual_network_id must also be set. - """ - - enabled: bool - """Whether to enable (the default) this origin within the pool. - - Disabled origins will not receive traffic and are excluded from health checks. - The origin will only be disabled for the current pool. - """ - - header: OriginHeader - """The request header is used to pass additional information with an HTTP request. - - Currently supported header is 'Host'. - """ - - name: str - """A human-identifiable name for the origin.""" - - virtual_network_id: str - """The virtual network subnet ID the origin belongs in. - - Virtual network must also belong to the account. - """ - - weight: float - """The weight of this origin relative to other origins in the pool. - - Based on the configured weight the total traffic is distributed among origins - within the pool. - - - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the - origin's outstanding requests. - - `origin_steering.policy="least_connections"`: Use weight to scale the origin's - open connections. - """ - - -class LoadShedding(TypedDict, total=False): - default_percent: float - """The percent of traffic to shed from the pool, according to the default policy. - - Applies to new sessions and traffic without session affinity. - """ - - default_policy: Literal["random", "hash"] - """The default policy to use when load shedding. - - A random policy randomly sheds a given percent of requests. A hash policy - computes a hash over the CF-Connecting-IP address and sheds all requests - originating from a percent of IPs. - """ - - session_percent: float - """ - The percent of existing sessions to shed from the pool, according to the session - policy. - """ - - session_policy: Literal["hash"] - """ - Only the hash policy is supported for existing sessions (to avoid exponential - decay). - """ - - -class NotificationFilterOrigin(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilterPool(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilter(TypedDict, total=False): - origin: Optional[NotificationFilterOrigin] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - pool: Optional[NotificationFilterPool] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - -class OriginSteering(TypedDict, total=False): - policy: Literal["random", "hash", "least_outstanding_requests", "least_connections"] - """The type of origin steering policy to use. - - - `"random"`: Select an origin randomly. - - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP - address. - - `"least_outstanding_requests"`: Select an origin by taking into consideration - origin weights, as well as each origin's number of outstanding requests. - Origins with more pending requests are weighted proportionately less relative - to others. - - `"least_connections"`: Select an origin by taking into consideration origin - weights, as well as each origin's number of open connections. Origins with - more open connections are weighted proportionately less relative to others. - Supported for HTTP/1 and HTTP/2 connections. - """ diff --git a/src/cloudflare/types/user/tokens/__init__.py b/src/cloudflare/types/user/tokens/__init__.py index 11148d0023c..6a39f3034a5 100644 --- a/src/cloudflare/types/user/tokens/__init__.py +++ b/src/cloudflare/types/user/tokens/__init__.py @@ -2,5 +2,8 @@ from __future__ import annotations +from .permission import Permission as Permission from .token_value import TokenValue as TokenValue +from .permission_item import PermissionItem as PermissionItem +from .permission_param import PermissionParam as PermissionParam from .value_update_params import ValueUpdateParams as ValueUpdateParams diff --git a/src/cloudflare/types/accounts/member_permission.py b/src/cloudflare/types/user/tokens/permission.py similarity index 82% rename from src/cloudflare/types/accounts/member_permission.py rename to src/cloudflare/types/user/tokens/permission.py index e940111b203..075bd9b5ed1 100644 --- a/src/cloudflare/types/accounts/member_permission.py +++ b/src/cloudflare/types/user/tokens/permission.py @@ -2,13 +2,13 @@ from typing import Optional -from ..._models import BaseModel -from .permission_grant import PermissionGrant +from ...._models import BaseModel +from ...accounts import PermissionGrant -__all__ = ["MemberPermission"] +__all__ = ["Permission"] -class MemberPermission(BaseModel): +class Permission(BaseModel): analytics: Optional[PermissionGrant] = None billing: Optional[PermissionGrant] = None diff --git a/src/cloudflare/types/user/tokens/permission_item.py b/src/cloudflare/types/user/tokens/permission_item.py new file mode 100644 index 00000000000..924d72bfa9e --- /dev/null +++ b/src/cloudflare/types/user/tokens/permission_item.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["PermissionItem"] + +PermissionItem = str diff --git a/src/cloudflare/types/accounts/member_permission_param.py b/src/cloudflare/types/user/tokens/permission_param.py similarity index 80% rename from src/cloudflare/types/accounts/member_permission_param.py rename to src/cloudflare/types/user/tokens/permission_param.py index e612295eb17..a0e3bfd8925 100644 --- a/src/cloudflare/types/accounts/member_permission_param.py +++ b/src/cloudflare/types/user/tokens/permission_param.py @@ -4,12 +4,12 @@ from typing_extensions import TypedDict -from .permission_grant_param import PermissionGrantParam +from ...accounts import PermissionGrantParam -__all__ = ["MemberPermissionParam"] +__all__ = ["PermissionParam"] -class MemberPermissionParam(TypedDict, total=False): +class PermissionParam(TypedDict, total=False): analytics: PermissionGrantParam billing: PermissionGrantParam diff --git a/tests/api_resources/accounts/test_roles.py b/tests/api_resources/accounts/test_roles.py index 0fa4f2c8a47..9aff85ab569 100644 --- a/tests/api_resources/accounts/test_roles.py +++ b/tests/api_resources/accounts/test_roles.py @@ -11,7 +11,7 @@ from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.shared import UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a -from cloudflare.types.accounts import RoleListResponse +from cloudflare.types.accounts import Role base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: role = client.accounts.roles.list( account_id={}, ) - assert_matches_type(SyncSinglePage[RoleListResponse], role, path=["response"]) + assert_matches_type(SyncSinglePage[Role], role, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = response.parse() - assert_matches_type(SyncSinglePage[RoleListResponse], role, path=["response"]) + assert_matches_type(SyncSinglePage[Role], role, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +49,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = response.parse() - assert_matches_type(SyncSinglePage[RoleListResponse], role, path=["response"]) + assert_matches_type(SyncSinglePage[Role], role, path=["response"]) assert cast(Any, response.is_closed) is True @@ -100,7 +100,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: role = await async_client.accounts.roles.list( account_id={}, ) - assert_matches_type(AsyncSinglePage[RoleListResponse], role, path=["response"]) + assert_matches_type(AsyncSinglePage[Role], role, path=["response"]) @pytest.mark.skip() @parametrize @@ -112,7 +112,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = await response.parse() - assert_matches_type(AsyncSinglePage[RoleListResponse], role, path=["response"]) + assert_matches_type(AsyncSinglePage[Role], role, path=["response"]) @pytest.mark.skip() @parametrize @@ -124,7 +124,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = await response.parse() - assert_matches_type(AsyncSinglePage[RoleListResponse], role, path=["response"]) + assert_matches_type(AsyncSinglePage[Role], role, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/alerting/test_policies.py b/tests/api_resources/alerting/test_policies.py index 759428106d7..47b38f7d628 100644 --- a/tests/api_resources/alerting/test_policies.py +++ b/tests/api_resources/alerting/test_policies.py @@ -12,7 +12,7 @@ from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.shared import UnnamedSchemaRef67bbb1ccdd42c3e2937b9fd19f791151 from cloudflare.types.alerting import ( - AlertingPolicies, + Policies, PolicyCreateResponse, PolicyUpdateResponse, ) @@ -274,7 +274,7 @@ def test_method_list(self, client: Cloudflare) -> None: policy = client.alerting.policies.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[AlertingPolicies], policy, path=["response"]) + assert_matches_type(SyncSinglePage[Policies], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -286,7 +286,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(SyncSinglePage[AlertingPolicies], policy, path=["response"]) + assert_matches_type(SyncSinglePage[Policies], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -298,7 +298,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(SyncSinglePage[AlertingPolicies], policy, path=["response"]) + assert_matches_type(SyncSinglePage[Policies], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -369,7 +369,7 @@ def test_method_get(self, client: Cloudflare) -> None: "0da2b59e-f118-439d-8097-bdfb215203c9", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AlertingPolicies, policy, path=["response"]) + assert_matches_type(Policies, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -382,7 +382,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(AlertingPolicies, policy, path=["response"]) + assert_matches_type(Policies, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -395,7 +395,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(AlertingPolicies, policy, path=["response"]) + assert_matches_type(Policies, policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -669,7 +669,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: policy = await async_client.alerting.policies.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[AlertingPolicies], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[Policies], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -681,7 +681,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AsyncSinglePage[AlertingPolicies], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[Policies], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -693,7 +693,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AsyncSinglePage[AlertingPolicies], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[Policies], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -764,7 +764,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "0da2b59e-f118-439d-8097-bdfb215203c9", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AlertingPolicies, policy, path=["response"]) + assert_matches_type(Policies, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -777,7 +777,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AlertingPolicies, policy, path=["response"]) + assert_matches_type(Policies, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -790,7 +790,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AlertingPolicies, policy, path=["response"]) + assert_matches_type(Policies, policy, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/email_routing/test_addresses.py b/tests/api_resources/email_routing/test_addresses.py index 5c2ba2fe99c..4a88f556567 100644 --- a/tests/api_resources/email_routing/test_addresses.py +++ b/tests/api_resources/email_routing/test_addresses.py @@ -10,12 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.email_routing import ( - AddressGetResponse, - AddressListResponse, - AddressCreateResponse, - AddressDeleteResponse, -) +from cloudflare.types.email_routing import DestinationAddress base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +25,7 @@ def test_method_create(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", email="user@example.com", ) - assert_matches_type(AddressCreateResponse, address, path=["response"]) + assert_matches_type(DestinationAddress, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -43,7 +38,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(AddressCreateResponse, address, path=["response"]) + assert_matches_type(DestinationAddress, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +51,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(AddressCreateResponse, address, path=["response"]) + assert_matches_type(DestinationAddress, address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -75,7 +70,7 @@ def test_method_list(self, client: Cloudflare) -> None: address = client.email_routing.addresses.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[AddressListResponse], address, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DestinationAddress], address, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,7 +82,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: per_page=5, verified=True, ) - assert_matches_type(SyncV4PagePaginationArray[AddressListResponse], address, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DestinationAddress], address, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,7 +94,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(SyncV4PagePaginationArray[AddressListResponse], address, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DestinationAddress], address, path=["response"]) @pytest.mark.skip() @parametrize @@ -111,7 +106,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(SyncV4PagePaginationArray[AddressListResponse], address, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DestinationAddress], address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -130,7 +125,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressDeleteResponse, address, path=["response"]) + assert_matches_type(DestinationAddress, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -143,7 +138,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(AddressDeleteResponse, address, path=["response"]) + assert_matches_type(DestinationAddress, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -156,7 +151,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(AddressDeleteResponse, address, path=["response"]) + assert_matches_type(DestinationAddress, address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -184,7 +179,7 @@ def test_method_get(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressGetResponse, address, path=["response"]) + assert_matches_type(DestinationAddress, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -197,7 +192,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(AddressGetResponse, address, path=["response"]) + assert_matches_type(DestinationAddress, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -210,7 +205,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(AddressGetResponse, address, path=["response"]) + assert_matches_type(DestinationAddress, address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -242,7 +237,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", email="user@example.com", ) - assert_matches_type(AddressCreateResponse, address, path=["response"]) + assert_matches_type(DestinationAddress, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -255,7 +250,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(AddressCreateResponse, address, path=["response"]) + assert_matches_type(DestinationAddress, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -268,7 +263,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(AddressCreateResponse, address, path=["response"]) + assert_matches_type(DestinationAddress, address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -287,7 +282,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: address = await async_client.email_routing.addresses.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[AddressListResponse], address, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[DestinationAddress], address, path=["response"]) @pytest.mark.skip() @parametrize @@ -299,7 +294,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) per_page=5, verified=True, ) - assert_matches_type(AsyncV4PagePaginationArray[AddressListResponse], address, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[DestinationAddress], address, path=["response"]) @pytest.mark.skip() @parametrize @@ -311,7 +306,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[AddressListResponse], address, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[DestinationAddress], address, path=["response"]) @pytest.mark.skip() @parametrize @@ -323,7 +318,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[AddressListResponse], address, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[DestinationAddress], address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -342,7 +337,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressDeleteResponse, address, path=["response"]) + assert_matches_type(DestinationAddress, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -355,7 +350,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(AddressDeleteResponse, address, path=["response"]) + assert_matches_type(DestinationAddress, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -368,7 +363,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(AddressDeleteResponse, address, path=["response"]) + assert_matches_type(DestinationAddress, address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -396,7 +391,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressGetResponse, address, path=["response"]) + assert_matches_type(DestinationAddress, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -409,7 +404,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(AddressGetResponse, address, path=["response"]) + assert_matches_type(DestinationAddress, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -422,7 +417,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(AddressGetResponse, address, path=["response"]) + assert_matches_type(DestinationAddress, address, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/email_routing/test_rules.py b/tests/api_resources/email_routing/test_rules.py index 1cef90e4b86..baed29ac5b9 100644 --- a/tests/api_resources/email_routing/test_rules.py +++ b/tests/api_resources/email_routing/test_rules.py @@ -10,13 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.email_routing import ( - RuleGetResponse, - RuleListResponse, - RuleCreateResponse, - RuleDeleteResponse, - RuleUpdateResponse, -) +from cloudflare.types.email_routing import Properties base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -73,7 +67,7 @@ def test_method_create(self, client: Cloudflare) -> None: }, ], ) - assert_matches_type(RuleCreateResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -127,7 +121,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: name="Send to user@example.net rule.", priority=0, ) - assert_matches_type(RuleCreateResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -182,7 +176,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleCreateResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -237,7 +231,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleCreateResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -342,7 +336,7 @@ def test_method_update(self, client: Cloudflare) -> None: }, ], ) - assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -397,7 +391,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: name="Send to user@example.net rule.", priority=0, ) - assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -453,7 +447,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -509,7 +503,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -620,7 +614,7 @@ def test_method_list(self, client: Cloudflare) -> None: rule = client.email_routing.rules.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Properties], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -631,7 +625,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: page=1, per_page=5, ) - assert_matches_type(SyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Properties], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -643,7 +637,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(SyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Properties], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -655,7 +649,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(SyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Properties], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -674,7 +668,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "a7e6fb77503c41d8a7f3113c6918f10c", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -687,7 +681,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -700,7 +694,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -726,7 +720,7 @@ def test_method_get(self, client: Cloudflare) -> None: "a7e6fb77503c41d8a7f3113c6918f10c", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RuleGetResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -739,7 +733,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleGetResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -752,7 +746,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleGetResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -824,7 +818,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: }, ], ) - assert_matches_type(RuleCreateResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -878,7 +872,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare name="Send to user@example.net rule.", priority=0, ) - assert_matches_type(RuleCreateResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -933,7 +927,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleCreateResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -988,7 +982,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleCreateResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1093,7 +1087,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: }, ], ) - assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1148,7 +1142,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare name="Send to user@example.net rule.", priority=0, ) - assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1204,7 +1198,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1260,7 +1254,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1371,7 +1365,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: rule = await async_client.email_routing.rules.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Properties], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1382,7 +1376,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) page=1, per_page=5, ) - assert_matches_type(AsyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Properties], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1394,7 +1388,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Properties], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1406,7 +1400,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Properties], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1425,7 +1419,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "a7e6fb77503c41d8a7f3113c6918f10c", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1438,7 +1432,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1451,7 +1445,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1477,7 +1471,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "a7e6fb77503c41d8a7f3113c6918f10c", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RuleGetResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1490,7 +1484,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleGetResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1503,7 +1497,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleGetResponse, rule, path=["response"]) + assert_matches_type(Properties, rule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_email_routing.py b/tests/api_resources/test_email_routing.py index 7e7929fc646..138f47222f6 100644 --- a/tests/api_resources/test_email_routing.py +++ b/tests/api_resources/test_email_routing.py @@ -9,11 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - EmailRoutingGetResponse, - EmailRoutingEnableResponse, - EmailRoutingDisableResponse, -) +from cloudflare.types import EmailSettings base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +24,7 @@ def test_method_disable(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(EmailRoutingDisableResponse, email_routing, path=["response"]) + assert_matches_type(EmailSettings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize @@ -41,7 +37,7 @@ def test_raw_response_disable(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = response.parse() - assert_matches_type(EmailRoutingDisableResponse, email_routing, path=["response"]) + assert_matches_type(EmailSettings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize @@ -54,7 +50,7 @@ def test_streaming_response_disable(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = response.parse() - assert_matches_type(EmailRoutingDisableResponse, email_routing, path=["response"]) + assert_matches_type(EmailSettings, email_routing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -74,7 +70,7 @@ def test_method_enable(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(EmailRoutingEnableResponse, email_routing, path=["response"]) + assert_matches_type(EmailSettings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,7 +83,7 @@ def test_raw_response_enable(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = response.parse() - assert_matches_type(EmailRoutingEnableResponse, email_routing, path=["response"]) + assert_matches_type(EmailSettings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +96,7 @@ def test_streaming_response_enable(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = response.parse() - assert_matches_type(EmailRoutingEnableResponse, email_routing, path=["response"]) + assert_matches_type(EmailSettings, email_routing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -119,7 +115,7 @@ def test_method_get(self, client: Cloudflare) -> None: email_routing = client.email_routing.get( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(EmailRoutingGetResponse, email_routing, path=["response"]) + assert_matches_type(EmailSettings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize @@ -131,7 +127,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = response.parse() - assert_matches_type(EmailRoutingGetResponse, email_routing, path=["response"]) + assert_matches_type(EmailSettings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize @@ -143,7 +139,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = response.parse() - assert_matches_type(EmailRoutingGetResponse, email_routing, path=["response"]) + assert_matches_type(EmailSettings, email_routing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -166,7 +162,7 @@ async def test_method_disable(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(EmailRoutingDisableResponse, email_routing, path=["response"]) + assert_matches_type(EmailSettings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize @@ -179,7 +175,7 @@ async def test_raw_response_disable(self, async_client: AsyncCloudflare) -> None assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = await response.parse() - assert_matches_type(EmailRoutingDisableResponse, email_routing, path=["response"]) + assert_matches_type(EmailSettings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize @@ -192,7 +188,7 @@ async def test_streaming_response_disable(self, async_client: AsyncCloudflare) - assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = await response.parse() - assert_matches_type(EmailRoutingDisableResponse, email_routing, path=["response"]) + assert_matches_type(EmailSettings, email_routing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -212,7 +208,7 @@ async def test_method_enable(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(EmailRoutingEnableResponse, email_routing, path=["response"]) + assert_matches_type(EmailSettings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize @@ -225,7 +221,7 @@ async def test_raw_response_enable(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = await response.parse() - assert_matches_type(EmailRoutingEnableResponse, email_routing, path=["response"]) + assert_matches_type(EmailSettings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize @@ -238,7 +234,7 @@ async def test_streaming_response_enable(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = await response.parse() - assert_matches_type(EmailRoutingEnableResponse, email_routing, path=["response"]) + assert_matches_type(EmailSettings, email_routing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -257,7 +253,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: email_routing = await async_client.email_routing.get( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(EmailRoutingGetResponse, email_routing, path=["response"]) + assert_matches_type(EmailSettings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize @@ -269,7 +265,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = await response.parse() - assert_matches_type(EmailRoutingGetResponse, email_routing, path=["response"]) + assert_matches_type(EmailSettings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize @@ -281,7 +277,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = await response.parse() - assert_matches_type(EmailRoutingGetResponse, email_routing, path=["response"]) + assert_matches_type(EmailSettings, email_routing, path=["response"]) assert cast(Any, response.is_closed) is True