From 9c5b4473d11a839e4e31dfe2e22e3a04836ca91e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 11 Apr 2024 01:50:56 +0000 Subject: [PATCH] feat(api): update via SDK Studio (#286) --- api.md | 30 +++---- src/cloudflare/resources/accounts/members.py | 5 +- src/cloudflare/resources/accounts/roles.py | 15 ++-- src/cloudflare/resources/audit_logs.py | 15 ++-- .../resources/rulesets/phases/phases.py | 5 +- src/cloudflare/resources/rulesets/rulesets.py | 9 +- src/cloudflare/resources/subscriptions.py | 31 ++++--- src/cloudflare/resources/user/audit_logs.py | 15 ++-- .../resources/user/subscriptions.py | 27 +++--- .../resources/zones/subscriptions.py | 19 ++-- src/cloudflare/types/__init__.py | 6 +- src/cloudflare/types/accounts/__init__.py | 2 +- src/cloudflare/types/accounts/member.py | 45 +--------- .../types/accounts/member_list_response.py | 20 +---- src/cloudflare/types/accounts/member_role.py | 46 +++++++++- .../types/accounts/member_role_param.py | 12 +++ .../types/accounts/member_update_params.py | 11 +-- .../types/accounts/member_with_invite_code.py | 45 +--------- .../types/audit_log_list_response.py | 80 ----------------- src/cloudflare/types/membership.py | 6 +- src/cloudflare/types/rate_plan_param.py | 18 ++++ src/cloudflare/types/request_rule_param.py | 11 +++ src/cloudflare/types/respone_rule.py | 9 ++ src/cloudflare/types/ruleset_create_params.py | 11 +-- .../types/ruleset_create_response.py | 10 +-- src/cloudflare/types/ruleset_get_response.py | 10 +-- src/cloudflare/types/ruleset_update_params.py | 11 +-- .../types/ruleset_update_response.py | 10 +-- .../types/rulesets/phase_get_response.py | 13 +-- .../types/rulesets/phase_update_params.py | 14 +-- .../types/rulesets/phase_update_response.py | 13 +-- .../rulesets/phases/version_get_response.py | 13 +-- .../types/rulesets/rule_create_response.py | 13 +-- .../types/rulesets/rule_delete_response.py | 13 +-- .../types/rulesets/rule_edit_response.py | 13 +-- .../types/rulesets/version_get_response.py | 13 +-- .../rulesets/versions/by_tag_get_response.py | 13 +-- src/cloudflare/types/shared/__init__.py | 2 + .../audit_log.py} | 4 +- .../iam_role.py} | 4 +- src/cloudflare/types/shared/result.py | 86 +------------------ .../types/subscription_create_params.py | 53 ++---------- .../types/subscription_update_params.py | 53 ++---------- src/cloudflare/types/user/__init__.py | 7 +- src/cloudflare/types/user/invite.py | 20 +---- src/cloudflare/types/user/rate_plan.py | 30 +++++++ src/cloudflare/types/user/rate_plan_param.py | 31 +++++++ src/cloudflare/types/user/subscription.py | 54 ++---------- .../types/user/subscription_component.py | 21 +++++ .../user/subscription_component_param.py | 21 +++++ .../types/user/subscription_edit_params.py | 55 ++---------- .../types/user/subscription_update_params.py | 55 ++---------- .../types/user/subscription_zone.py | 15 ++++ .../types/user/subscription_zone_param.py | 11 +++ src/cloudflare/types/warp_connector.py | 75 +--------------- src/cloudflare/types/zero_trust/__init__.py | 1 + .../types/zero_trust/tunnel_connection.py | 39 +++++++++ .../types/zero_trust/tunnels/client.py | 36 +------- .../types/zones/subscription_create_params.py | 53 ++---------- tests/api_resources/accounts/test_roles.py | 15 ++-- tests/api_resources/test_audit_logs.py | 18 ++-- tests/api_resources/user/test_audit_logs.py | 18 ++-- 62 files changed, 529 insertions(+), 900 deletions(-) create mode 100644 src/cloudflare/types/accounts/member_role_param.py delete mode 100644 src/cloudflare/types/audit_log_list_response.py create mode 100644 src/cloudflare/types/rate_plan_param.py create mode 100644 src/cloudflare/types/request_rule_param.py create mode 100644 src/cloudflare/types/respone_rule.py rename src/cloudflare/types/{user/audit_log_list_response.py => shared/audit_log.py} (95%) rename src/cloudflare/types/{accounts/role_list_response.py => shared/iam_role.py} (86%) create mode 100644 src/cloudflare/types/user/rate_plan.py create mode 100644 src/cloudflare/types/user/rate_plan_param.py create mode 100644 src/cloudflare/types/user/subscription_component.py create mode 100644 src/cloudflare/types/user/subscription_component_param.py create mode 100644 src/cloudflare/types/user/subscription_zone.py create mode 100644 src/cloudflare/types/user/subscription_zone_param.py create mode 100644 src/cloudflare/types/zero_trust/tunnel_connection.py diff --git a/api.md b/api.md index 9931e255391..4de2a531f48 100644 --- a/api.md +++ b/api.md @@ -2,7 +2,9 @@ ```python from cloudflare.types import ( + AuditLog, ErrorData, + IamRole, Identifier, LoadBalancerPreview, PaginationInfo, @@ -52,12 +54,12 @@ Methods: Types: ```python -from cloudflare.types.accounts import PermissionGrant, RoleListResponse, RoleGetResponse +from cloudflare.types.accounts import PermissionGrant, RoleGetResponse ``` Methods: -- client.accounts.roles.list(\*, account_id) -> SyncSinglePage[RoleListResponse] +- client.accounts.roles.list(\*, account_id) -> SyncSinglePage[IamRole] - client.accounts.roles.get(role_id, \*, account_id) -> RoleGetResponse # OriginCACertificates @@ -127,15 +129,9 @@ Methods: ## AuditLogs -Types: - -```python -from cloudflare.types.user import AuditLogListResponse -``` - Methods: -- client.user.audit_logs.list(\*\*params) -> SyncV4PagePaginationArray[AuditLogListResponse] +- client.user.audit_logs.list(\*\*params) -> SyncV4PagePaginationArray[AuditLog] ## Billing @@ -197,7 +193,11 @@ Types: ```python from cloudflare.types.user import ( + RatePlan, Subscription, + SubscriptionComponent, + SubscriptionComponentValue, + SubscriptionZone, SubscriptionUpdateResponse, SubscriptionDeleteResponse, SubscriptionEditResponse, @@ -3019,6 +3019,8 @@ Types: ```python from cloudflare.types import ( + RequestRule, + ResponeRule, Ruleset, RulesetCreateResponse, RulesetUpdateResponse, @@ -3382,15 +3384,9 @@ Methods: # AuditLogs -Types: - -```python -from cloudflare.types import AuditLogListResponse -``` - Methods: -- client.audit_logs.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[AuditLogListResponse] +- client.audit_logs.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[AuditLog] # Billing @@ -5435,7 +5431,7 @@ Methods: Types: ```python -from cloudflare.types.zero_trust import Tunnel, WARPConnectorTunnel +from cloudflare.types.zero_trust import Tunnel, TunnelConnection, WARPConnectorTunnel ``` Methods: diff --git a/src/cloudflare/resources/accounts/members.py b/src/cloudflare/resources/accounts/members.py index 6657d3c7e15..76b969ef07c 100644 --- a/src/cloudflare/resources/accounts/members.py +++ b/src/cloudflare/resources/accounts/members.py @@ -28,6 +28,7 @@ ) from ...types.accounts import ( Member, + MemberRoleParam, MemberListResponse, MemberDeleteResponse, MemberWithInviteCode, @@ -104,7 +105,7 @@ def update( member_id: str, *, account_id: object, - roles: Iterable[member_update_params.Role], + roles: Iterable[MemberRoleParam], # 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, @@ -350,7 +351,7 @@ async def update( member_id: str, *, account_id: object, - roles: Iterable[member_update_params.Role], + roles: Iterable[MemberRoleParam], # 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 c3d7190308e..e56831d4144 100644 --- a/src/cloudflare/resources/accounts/roles.py +++ b/src/cloudflare/resources/accounts/roles.py @@ -21,7 +21,8 @@ AsyncPaginator, make_request_options, ) -from ...types.accounts import RoleGetResponse, RoleListResponse +from ...types.shared import IamRole +from ...types.accounts import RoleGetResponse __all__ = ["Roles", "AsyncRoles"] @@ -45,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[IamRole]: """ Get all available roles for an account. @@ -60,11 +61,11 @@ def list( """ return self._get_api_list( f"/accounts/{account_id}/roles", - page=SyncSinglePage[RoleListResponse], + page=SyncSinglePage[IamRole], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=RoleListResponse, + model=IamRole, ) def get( @@ -128,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[IamRole, AsyncSinglePage[IamRole]]: """ Get all available roles for an account. @@ -143,11 +144,11 @@ def list( """ return self._get_api_list( f"/accounts/{account_id}/roles", - page=AsyncSinglePage[RoleListResponse], + page=AsyncSinglePage[IamRole], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=RoleListResponse, + model=IamRole, ) async def get( diff --git a/src/cloudflare/resources/audit_logs.py b/src/cloudflare/resources/audit_logs.py index fcedf6f2630..a3e27c5c9fe 100644 --- a/src/cloudflare/resources/audit_logs.py +++ b/src/cloudflare/resources/audit_logs.py @@ -8,7 +8,7 @@ import httpx -from ..types import AuditLogListResponse, audit_log_list_params +from ..types import audit_log_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import maybe_transform from .._compat import cached_property @@ -24,6 +24,7 @@ AsyncPaginator, make_request_options, ) +from ..types.shared import AuditLog __all__ = ["AuditLogs", "AsyncAuditLogs"] @@ -58,7 +59,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[AuditLogListResponse]: + ) -> SyncV4PagePaginationArray[AuditLog]: """Gets a list of audit logs for an account. Can be filtered by who made the @@ -97,7 +98,7 @@ 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}/audit_logs", - page=SyncV4PagePaginationArray[AuditLogListResponse], + page=SyncV4PagePaginationArray[AuditLog], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -120,7 +121,7 @@ def list( audit_log_list_params.AuditLogListParams, ), ), - model=AuditLogListResponse, + model=AuditLog, ) @@ -154,7 +155,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AuditLogListResponse, AsyncV4PagePaginationArray[AuditLogListResponse]]: + ) -> AsyncPaginator[AuditLog, AsyncV4PagePaginationArray[AuditLog]]: """Gets a list of audit logs for an account. Can be filtered by who made the @@ -193,7 +194,7 @@ 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}/audit_logs", - page=AsyncV4PagePaginationArray[AuditLogListResponse], + page=AsyncV4PagePaginationArray[AuditLog], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -216,7 +217,7 @@ def list( audit_log_list_params.AuditLogListParams, ), ), - model=AuditLogListResponse, + model=AuditLog, ) diff --git a/src/cloudflare/resources/rulesets/phases/phases.py b/src/cloudflare/resources/rulesets/phases/phases.py index cc59c4d3d6f..0900e523671 100644 --- a/src/cloudflare/resources/rulesets/phases/phases.py +++ b/src/cloudflare/resources/rulesets/phases/phases.py @@ -7,6 +7,7 @@ import httpx +from ....types import RequestRuleParam from .versions import ( Versions, AsyncVersions, @@ -78,7 +79,7 @@ def update( "magic_transit_managed", ], *, - rules: Iterable[phase_update_params.Rule], + rules: Iterable[RequestRuleParam], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, @@ -311,7 +312,7 @@ async def update( "magic_transit_managed", ], *, - rules: Iterable[phase_update_params.Rule], + rules: Iterable[RequestRuleParam], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, diff --git a/src/cloudflare/resources/rulesets/rulesets.py b/src/cloudflare/resources/rulesets/rulesets.py index e88c1e2317a..3fcb3c271fd 100644 --- a/src/cloudflare/resources/rulesets/rulesets.py +++ b/src/cloudflare/resources/rulesets/rulesets.py @@ -25,6 +25,7 @@ ) from ...types import ( Ruleset, + RequestRuleParam, RulesetGetResponse, RulesetCreateResponse, RulesetUpdateResponse, @@ -115,7 +116,7 @@ def create( "magic_transit_ids_managed", "magic_transit_managed", ], - rules: Iterable[ruleset_create_params.Rule], + rules: Iterable[RequestRuleParam], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, @@ -193,7 +194,7 @@ def update( self, ruleset_id: str, *, - rules: Iterable[ruleset_update_params.Rule], + rules: Iterable[RequestRuleParam], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, @@ -520,7 +521,7 @@ async def create( "magic_transit_ids_managed", "magic_transit_managed", ], - rules: Iterable[ruleset_create_params.Rule], + rules: Iterable[RequestRuleParam], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, @@ -598,7 +599,7 @@ async def update( self, ruleset_id: str, *, - rules: Iterable[ruleset_update_params.Rule], + rules: Iterable[RequestRuleParam], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, diff --git a/src/cloudflare/resources/subscriptions.py b/src/cloudflare/resources/subscriptions.py index 8f5c04a27d5..93aa580df86 100644 --- a/src/cloudflare/resources/subscriptions.py +++ b/src/cloudflare/resources/subscriptions.py @@ -31,7 +31,12 @@ ) from .._wrappers import ResultWrapper from ..pagination import SyncSinglePage, AsyncSinglePage -from ..types.user import Subscription +from ..types.user import ( + Subscription, + RatePlanParam, + SubscriptionZoneParam, + SubscriptionComponentParam, +) from .._base_client import ( AsyncPaginator, make_request_options, @@ -54,10 +59,10 @@ def create( identifier: str, *, app: subscription_create_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_create_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_create_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_create_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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, @@ -122,10 +127,10 @@ def update( *, account_identifier: str, app: subscription_update_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_update_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_update_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_update_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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, @@ -333,10 +338,10 @@ async def create( identifier: str, *, app: subscription_create_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_create_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_create_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_create_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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, @@ -401,10 +406,10 @@ async def update( *, account_identifier: str, app: subscription_update_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_update_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_update_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_update_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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/audit_logs.py b/src/cloudflare/resources/user/audit_logs.py index 72dc9767cb5..b05f7a40fda 100644 --- a/src/cloudflare/resources/user/audit_logs.py +++ b/src/cloudflare/resources/user/audit_logs.py @@ -19,11 +19,12 @@ async_to_streamed_response_wrapper, ) from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from ...types.user import AuditLogListResponse, audit_log_list_params +from ...types.user import audit_log_list_params from ..._base_client import ( AsyncPaginator, make_request_options, ) +from ...types.shared import AuditLog __all__ = ["AuditLogs", "AsyncAuditLogs"] @@ -57,7 +58,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[AuditLogListResponse]: + ) -> SyncV4PagePaginationArray[AuditLog]: """Gets a list of audit logs for a user account. Can be filtered by who made the @@ -92,7 +93,7 @@ def list( """ return self._get_api_list( "/user/audit_logs", - page=SyncV4PagePaginationArray[AuditLogListResponse], + page=SyncV4PagePaginationArray[AuditLog], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -115,7 +116,7 @@ def list( audit_log_list_params.AuditLogListParams, ), ), - model=AuditLogListResponse, + model=AuditLog, ) @@ -148,7 +149,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AuditLogListResponse, AsyncV4PagePaginationArray[AuditLogListResponse]]: + ) -> AsyncPaginator[AuditLog, AsyncV4PagePaginationArray[AuditLog]]: """Gets a list of audit logs for a user account. Can be filtered by who made the @@ -183,7 +184,7 @@ def list( """ return self._get_api_list( "/user/audit_logs", - page=AsyncV4PagePaginationArray[AuditLogListResponse], + page=AsyncV4PagePaginationArray[AuditLog], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -206,7 +207,7 @@ def list( audit_log_list_params.AuditLogListParams, ), ), - model=AuditLogListResponse, + model=AuditLog, ) diff --git a/src/cloudflare/resources/user/subscriptions.py b/src/cloudflare/resources/user/subscriptions.py index 48a9fef6ed7..73866fbb84b 100644 --- a/src/cloudflare/resources/user/subscriptions.py +++ b/src/cloudflare/resources/user/subscriptions.py @@ -22,8 +22,11 @@ ) from ..._wrappers import ResultWrapper from ...types.user import ( + RatePlanParam, + SubscriptionZoneParam, SubscriptionGetResponse, SubscriptionEditResponse, + SubscriptionComponentParam, SubscriptionDeleteResponse, SubscriptionUpdateResponse, subscription_edit_params, @@ -51,10 +54,10 @@ def update( identifier: str, *, app: subscription_update_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_update_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_update_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_update_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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, @@ -155,10 +158,10 @@ def edit( identifier: str, *, app: subscription_edit_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_edit_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_edit_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_edit_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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, @@ -255,10 +258,10 @@ async def update( identifier: str, *, app: subscription_update_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_update_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_update_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_update_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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, @@ -359,10 +362,10 @@ async def edit( identifier: str, *, app: subscription_edit_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_edit_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_edit_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_edit_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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/zones/subscriptions.py b/src/cloudflare/resources/zones/subscriptions.py index 313c81490b1..bf75cc18edd 100644 --- a/src/cloudflare/resources/zones/subscriptions.py +++ b/src/cloudflare/resources/zones/subscriptions.py @@ -22,7 +22,12 @@ ) from ..._wrappers import ResultWrapper from ...pagination import SyncSinglePage, AsyncSinglePage -from ...types.user import Subscription +from ...types.user import ( + Subscription, + RatePlanParam, + SubscriptionZoneParam, + SubscriptionComponentParam, +) from ...types.zones import SubscriptionGetResponse, SubscriptionCreateResponse, subscription_create_params from ..._base_client import ( AsyncPaginator, @@ -46,10 +51,10 @@ def create( identifier: str, *, app: subscription_create_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_create_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_create_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_create_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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, @@ -203,10 +208,10 @@ async def create( identifier: str, *, app: subscription_create_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_create_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_create_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_create_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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 2c4533ea5a0..add2017238e 100644 --- a/src/cloudflare/types/__init__.py +++ b/src/cloudflare/types/__init__.py @@ -20,6 +20,8 @@ from .origin import Origin as Origin from .shared import ( Result as Result, + IamRole as IamRole, + AuditLog as AuditLog, ErrorData as ErrorData, Identifier as Identifier, ResponseInfo as ResponseInfo, @@ -62,6 +64,7 @@ from .header_param import HeaderParam as HeaderParam from .health_check import HealthCheck as HealthCheck from .origin_param import OriginParam as OriginParam +from .respone_rule import ResponeRule as ResponeRule from .targes_param import TargesParam as TargesParam from .tunnel_param import TunnelParam as TunnelParam from .waiting_room import WaitingRoom as WaitingRoom @@ -83,6 +86,7 @@ from .firewall_filter import FirewallFilter as FirewallFilter from .origin_steering import OriginSteering as OriginSteering from .random_steering import RandomSteering as RandomSteering +from .rate_plan_param import RatePlanParam as RatePlanParam from .service_binding import ServiceBinding as ServiceBinding from .adaptive_routing import AdaptiveRouting as AdaptiveRouting from .geo_restrictions import GeoRestrictions as GeoRestrictions @@ -116,6 +120,7 @@ from .http_configuration import HTTPConfiguration as HTTPConfiguration from .pcap_create_params import PCAPCreateParams as PCAPCreateParams from .pcap_list_response import PCAPListResponse as PCAPListResponse +from .request_rule_param import RequestRuleParam as RequestRuleParam from .stream_list_params import StreamListParams as StreamListParams from .user_edit_response import UserEditResponse as UserEditResponse from .zone_create_params import ZoneCreateParams as ZoneCreateParams @@ -178,7 +183,6 @@ from .url_info_model_results import URLInfoModelResults as URLInfoModelResults from .account_update_response import AccountUpdateResponse as AccountUpdateResponse from .additional_routes_param import AdditionalRoutesParam as AdditionalRoutesParam -from .audit_log_list_response import AuditLogListResponse as AuditLogListResponse from .cookie_attributes_param import CookieAttributesParam as CookieAttributesParam from .healthcheck_edit_params import HealthcheckEditParams as HealthcheckEditParams from .location_strategy_param import LocationStrategyParam as LocationStrategyParam diff --git a/src/cloudflare/types/accounts/__init__.py b/src/cloudflare/types/accounts/__init__.py index e8460936d42..4323e8c1edc 100644 --- a/src/cloudflare/types/accounts/__init__.py +++ b/src/cloudflare/types/accounts/__init__.py @@ -5,9 +5,9 @@ from .member import Member as Member from .member_role import MemberRole as MemberRole from .permission_grant import PermissionGrant as PermissionGrant +from .member_role_param import MemberRoleParam as MemberRoleParam from .role_get_response import RoleGetResponse as RoleGetResponse 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 diff --git a/src/cloudflare/types/accounts/member.py b/src/cloudflare/types/accounts/member.py index 101555dd229..c357dd2a41f 100644 --- a/src/cloudflare/types/accounts/member.py +++ b/src/cloudflare/types/accounts/member.py @@ -3,48 +3,9 @@ from typing import List, Optional from ..._models import BaseModel -from .permission_grant import PermissionGrant +from .member_role import MemberRole -__all__ = ["Member", "Role", "RolePermissions", "User"] - - -class RolePermissions(BaseModel): - analytics: Optional[PermissionGrant] = None - - billing: Optional[PermissionGrant] = None - - cache_purge: Optional[PermissionGrant] = None - - dns: Optional[PermissionGrant] = None - - dns_records: Optional[PermissionGrant] = None - - lb: Optional[PermissionGrant] = None - - logs: Optional[PermissionGrant] = None - - organization: Optional[PermissionGrant] = None - - ssl: Optional[PermissionGrant] = None - - waf: Optional[PermissionGrant] = None - - zone_settings: Optional[PermissionGrant] = None - - zones: Optional[PermissionGrant] = None - - -class Role(BaseModel): - id: str - """Role identifier tag.""" - - description: str - """Description of role's permissions.""" - - name: str - """Role name.""" - - permissions: RolePermissions +__all__ = ["Member", "User"] class User(BaseModel): @@ -71,7 +32,7 @@ class Member(BaseModel): id: str """Membership identifier tag.""" - roles: List[Role] + roles: List[MemberRole] """Roles assigned to this member.""" status: object diff --git a/src/cloudflare/types/accounts/member_list_response.py b/src/cloudflare/types/accounts/member_list_response.py index ae7b932f3c0..84eb19601f0 100644 --- a/src/cloudflare/types/accounts/member_list_response.py +++ b/src/cloudflare/types/accounts/member_list_response.py @@ -3,24 +3,10 @@ from typing import List, Optional from typing_extensions import Literal +from ..shared import IamRole from ..._models import BaseModel -from ..user.tokens import Permission -__all__ = ["MemberListResponse", "Role"] - - -class Role(BaseModel): - id: str - """Role identifier tag.""" - - description: str - """Description of role's permissions.""" - - name: str - """Role Name.""" - - permissions: List[Permission] - """Access permissions for this User.""" +__all__ = ["MemberListResponse"] class MemberListResponse(BaseModel): @@ -33,7 +19,7 @@ class MemberListResponse(BaseModel): name: Optional[str] = None """Member Name.""" - roles: List[Role] + roles: List[IamRole] """Roles assigned to this Member.""" status: Literal["accepted", "invited"] diff --git a/src/cloudflare/types/accounts/member_role.py b/src/cloudflare/types/accounts/member_role.py index f397dc48575..fd4e70fa932 100644 --- a/src/cloudflare/types/accounts/member_role.py +++ b/src/cloudflare/types/accounts/member_role.py @@ -1,7 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import Optional -__all__ = ["MemberRole"] +from ..._models import BaseModel +from .permission_grant import PermissionGrant -MemberRole = List[str] +__all__ = ["MemberRole", "Permissions"] + + +class Permissions(BaseModel): + analytics: Optional[PermissionGrant] = None + + billing: Optional[PermissionGrant] = None + + cache_purge: Optional[PermissionGrant] = None + + dns: Optional[PermissionGrant] = None + + dns_records: Optional[PermissionGrant] = None + + lb: Optional[PermissionGrant] = None + + logs: Optional[PermissionGrant] = None + + organization: Optional[PermissionGrant] = None + + ssl: Optional[PermissionGrant] = None + + waf: Optional[PermissionGrant] = None + + zone_settings: Optional[PermissionGrant] = None + + zones: Optional[PermissionGrant] = None + + +class MemberRole(BaseModel): + id: str + """Role identifier tag.""" + + description: str + """Description of role's permissions.""" + + name: str + """Role name.""" + + permissions: Permissions diff --git a/src/cloudflare/types/accounts/member_role_param.py b/src/cloudflare/types/accounts/member_role_param.py new file mode 100644 index 00000000000..70bce379300 --- /dev/null +++ b/src/cloudflare/types/accounts/member_role_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 Required, TypedDict + +__all__ = ["MemberRoleParam"] + + +class MemberRoleParam(TypedDict, total=False): + id: Required[str] + """Role identifier tag.""" diff --git a/src/cloudflare/types/accounts/member_update_params.py b/src/cloudflare/types/accounts/member_update_params.py index 69867eb443e..fa8bc46954b 100644 --- a/src/cloudflare/types/accounts/member_update_params.py +++ b/src/cloudflare/types/accounts/member_update_params.py @@ -5,16 +5,13 @@ from typing import Iterable from typing_extensions import Required, TypedDict -__all__ = ["MemberUpdateParams", "Role"] +from .member_role_param import MemberRoleParam + +__all__ = ["MemberUpdateParams"] class MemberUpdateParams(TypedDict, total=False): account_id: Required[object] - roles: Required[Iterable[Role]] + roles: Required[Iterable[MemberRoleParam]] """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_invite_code.py b/src/cloudflare/types/accounts/member_with_invite_code.py index deb20533c23..7584f6b2c26 100644 --- a/src/cloudflare/types/accounts/member_with_invite_code.py +++ b/src/cloudflare/types/accounts/member_with_invite_code.py @@ -3,48 +3,9 @@ from typing import List, Optional from ..._models import BaseModel -from .permission_grant import PermissionGrant +from .member_role import MemberRole -__all__ = ["MemberWithInviteCode", "Role", "RolePermissions", "User"] - - -class RolePermissions(BaseModel): - analytics: Optional[PermissionGrant] = None - - billing: Optional[PermissionGrant] = None - - cache_purge: Optional[PermissionGrant] = None - - dns: Optional[PermissionGrant] = None - - dns_records: Optional[PermissionGrant] = None - - lb: Optional[PermissionGrant] = None - - logs: Optional[PermissionGrant] = None - - organization: Optional[PermissionGrant] = None - - ssl: Optional[PermissionGrant] = None - - waf: Optional[PermissionGrant] = None - - zone_settings: Optional[PermissionGrant] = None - - zones: Optional[PermissionGrant] = None - - -class Role(BaseModel): - id: str - """Role identifier tag.""" - - description: str - """Description of role's permissions.""" - - name: str - """Role name.""" - - permissions: RolePermissions +__all__ = ["MemberWithInviteCode", "User"] class User(BaseModel): @@ -71,7 +32,7 @@ class MemberWithInviteCode(BaseModel): id: str """Membership identifier tag.""" - roles: List[Role] + roles: List[MemberRole] """Roles assigned to this member.""" status: object diff --git a/src/cloudflare/types/audit_log_list_response.py b/src/cloudflare/types/audit_log_list_response.py deleted file mode 100644 index 7383de914a3..00000000000 --- a/src/cloudflare/types/audit_log_list_response.py +++ /dev/null @@ -1,80 +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 pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["AuditLogListResponse", "Action", "Actor", "Owner", "Resource"] - - -class Action(BaseModel): - result: Optional[bool] = None - """A boolean that indicates if the action attempted was successful.""" - - type: Optional[str] = None - """A short string that describes the action that was performed.""" - - -class Actor(BaseModel): - id: Optional[str] = None - """The ID of the actor that performed the action. - - If a user performed the action, this will be their User ID. - """ - - email: Optional[str] = None - """The email of the user that performed the action.""" - - ip: Optional[str] = None - """The IP address of the request that performed the action.""" - - type: Optional[Literal["user", "admin", "Cloudflare"]] = None - """The type of actor, whether a User, Cloudflare Admin, or an Automated System.""" - - -class Owner(BaseModel): - id: Optional[str] = None - """Identifier""" - - -class Resource(BaseModel): - id: Optional[str] = None - """An identifier for the resource that was affected by the action.""" - - type: Optional[str] = None - """A short string that describes the resource that was affected by the action.""" - - -class AuditLogListResponse(BaseModel): - id: Optional[str] = None - """A string that uniquely identifies the audit log.""" - - action: Optional[Action] = None - - actor: Optional[Actor] = None - - interface: Optional[str] = None - """The source of the event.""" - - metadata: Optional[object] = None - """An object which can lend more context to the action being logged. - - This is a flexible value and varies between different actions. - """ - - new_value: Optional[str] = FieldInfo(alias="newValue", default=None) - """The new value of the resource that was modified.""" - - old_value: Optional[str] = FieldInfo(alias="oldValue", default=None) - """The value of the resource before it was modified.""" - - owner: Optional[Owner] = None - - resource: Optional[Resource] = None - - when: Optional[datetime] = None - """A UTC RFC3339 timestamp that specifies when the action being logged occured.""" diff --git a/src/cloudflare/types/membership.py b/src/cloudflare/types/membership.py index 472cc749955..190795fd4fe 100644 --- a/src/cloudflare/types/membership.py +++ b/src/cloudflare/types/membership.py @@ -1,11 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Optional from typing_extensions import Literal from .account import Account from .._models import BaseModel -from .accounts import MemberRole, PermissionGrant +from .accounts import PermissionGrant __all__ = ["Membership", "Permissions"] @@ -55,7 +55,7 @@ class Membership(BaseModel): permissions: Optional[Permissions] = None """All access permissions for the user at the account.""" - roles: Optional[MemberRole] = None + roles: Optional[List[str]] = None """List of role names for the user at the account.""" status: Optional[Literal["accepted", "pending", "rejected"]] = None diff --git a/src/cloudflare/types/rate_plan_param.py b/src/cloudflare/types/rate_plan_param.py new file mode 100644 index 00000000000..36cc091ceae --- /dev/null +++ b/src/cloudflare/types/rate_plan_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 import Iterable +from typing_extensions import TypedDict + +from .component import Component + +__all__ = ["RatePlanParam"] + + +class RatePlanParam(TypedDict, total=False): + components: Iterable[Component] + """Array of available components values for the plan.""" + + duration: float + """The duration of the plan subscription.""" diff --git a/src/cloudflare/types/request_rule_param.py b/src/cloudflare/types/request_rule_param.py new file mode 100644 index 00000000000..e94893764bc --- /dev/null +++ b/src/cloudflare/types/request_rule_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 import Union + +from .rulesets import LogRuleParam, SkipRuleParam, BlockRuleParam, ExecuteRuleParam + +__all__ = ["RequestRuleParam"] + +RequestRuleParam = Union[BlockRuleParam, ExecuteRuleParam, LogRuleParam, SkipRuleParam] diff --git a/src/cloudflare/types/respone_rule.py b/src/cloudflare/types/respone_rule.py new file mode 100644 index 00000000000..85565ed81d5 --- /dev/null +++ b/src/cloudflare/types/respone_rule.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union + +from .rulesets import LogRule, SkipRule, BlockRule, ExecuteRule + +__all__ = ["ResponeRule"] + +ResponeRule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] diff --git a/src/cloudflare/types/ruleset_create_params.py b/src/cloudflare/types/ruleset_create_params.py index b2f900106ea..27128c076da 100644 --- a/src/cloudflare/types/ruleset_create_params.py +++ b/src/cloudflare/types/ruleset_create_params.py @@ -2,12 +2,12 @@ from __future__ import annotations -from typing import Union, Iterable +from typing import Iterable from typing_extensions import Literal, Required, TypedDict -from .rulesets import LogRuleParam, SkipRuleParam, BlockRuleParam, ExecuteRuleParam +from .request_rule_param import RequestRuleParam -__all__ = ["RulesetCreateParams", "Rule"] +__all__ = ["RulesetCreateParams"] class RulesetCreateParams(TypedDict, total=False): @@ -46,7 +46,7 @@ class RulesetCreateParams(TypedDict, total=False): ] """The phase of the ruleset.""" - rules: Required[Iterable[Rule]] + rules: Required[Iterable[RequestRuleParam]] """The list of rules in the ruleset.""" account_id: str @@ -57,6 +57,3 @@ class RulesetCreateParams(TypedDict, total=False): description: str """An informative description of the ruleset.""" - - -Rule = Union[BlockRuleParam, ExecuteRuleParam, LogRuleParam, SkipRuleParam] diff --git a/src/cloudflare/types/ruleset_create_response.py b/src/cloudflare/types/ruleset_create_response.py index 8af27df5445..ead1e8accf6 100644 --- a/src/cloudflare/types/ruleset_create_response.py +++ b/src/cloudflare/types/ruleset_create_response.py @@ -1,15 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import List, Optional from datetime import datetime from typing_extensions import Literal from .._models import BaseModel -from .rulesets import LogRule, SkipRule, BlockRule, ExecuteRule +from .respone_rule import ResponeRule -__all__ = ["RulesetCreateResponse", "Rule"] - -Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] +__all__ = ["RulesetCreateResponse"] class RulesetCreateResponse(BaseModel): @@ -52,7 +50,7 @@ class RulesetCreateResponse(BaseModel): ] """The phase of the ruleset.""" - rules: List[Rule] + rules: List[ResponeRule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/ruleset_get_response.py b/src/cloudflare/types/ruleset_get_response.py index 3ec45ca675e..c6a1fc3cf5f 100644 --- a/src/cloudflare/types/ruleset_get_response.py +++ b/src/cloudflare/types/ruleset_get_response.py @@ -1,15 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import List, Optional from datetime import datetime from typing_extensions import Literal from .._models import BaseModel -from .rulesets import LogRule, SkipRule, BlockRule, ExecuteRule +from .respone_rule import ResponeRule -__all__ = ["RulesetGetResponse", "Rule"] - -Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] +__all__ = ["RulesetGetResponse"] class RulesetGetResponse(BaseModel): @@ -52,7 +50,7 @@ class RulesetGetResponse(BaseModel): ] """The phase of the ruleset.""" - rules: List[Rule] + rules: List[ResponeRule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/ruleset_update_params.py b/src/cloudflare/types/ruleset_update_params.py index fcb7b5b0298..1c0d34cd3e2 100644 --- a/src/cloudflare/types/ruleset_update_params.py +++ b/src/cloudflare/types/ruleset_update_params.py @@ -2,16 +2,16 @@ from __future__ import annotations -from typing import Union, Iterable +from typing import Iterable from typing_extensions import Literal, Required, TypedDict -from .rulesets import LogRuleParam, SkipRuleParam, BlockRuleParam, ExecuteRuleParam +from .request_rule_param import RequestRuleParam -__all__ = ["RulesetUpdateParams", "Rule"] +__all__ = ["RulesetUpdateParams"] class RulesetUpdateParams(TypedDict, total=False): - rules: Required[Iterable[Rule]] + rules: Required[Iterable[RequestRuleParam]] """The list of rules in the ruleset.""" account_id: str @@ -55,6 +55,3 @@ class RulesetUpdateParams(TypedDict, total=False): "magic_transit_managed", ] """The phase of the ruleset.""" - - -Rule = Union[BlockRuleParam, ExecuteRuleParam, LogRuleParam, SkipRuleParam] diff --git a/src/cloudflare/types/ruleset_update_response.py b/src/cloudflare/types/ruleset_update_response.py index 691bb31e2fd..0d024ee0f37 100644 --- a/src/cloudflare/types/ruleset_update_response.py +++ b/src/cloudflare/types/ruleset_update_response.py @@ -1,15 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import List, Optional from datetime import datetime from typing_extensions import Literal from .._models import BaseModel -from .rulesets import LogRule, SkipRule, BlockRule, ExecuteRule +from .respone_rule import ResponeRule -__all__ = ["RulesetUpdateResponse", "Rule"] - -Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] +__all__ = ["RulesetUpdateResponse"] class RulesetUpdateResponse(BaseModel): @@ -52,7 +50,7 @@ class RulesetUpdateResponse(BaseModel): ] """The phase of the ruleset.""" - rules: List[Rule] + rules: List[ResponeRule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/rulesets/phase_get_response.py b/src/cloudflare/types/rulesets/phase_get_response.py index e509a7cda57..2abbbf5424f 100644 --- a/src/cloudflare/types/rulesets/phase_get_response.py +++ b/src/cloudflare/types/rulesets/phase_get_response.py @@ -1,18 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import List, Optional from datetime import datetime from typing_extensions import Literal -from .log_rule import LogRule from ..._models import BaseModel -from .skip_rule import SkipRule -from .block_rule import BlockRule -from .execute_rule import ExecuteRule +from ..respone_rule import ResponeRule -__all__ = ["PhaseGetResponse", "Rule"] - -Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] +__all__ = ["PhaseGetResponse"] class PhaseGetResponse(BaseModel): @@ -55,7 +50,7 @@ class PhaseGetResponse(BaseModel): ] """The phase of the ruleset.""" - rules: List[Rule] + rules: List[ResponeRule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/rulesets/phase_update_params.py b/src/cloudflare/types/rulesets/phase_update_params.py index d3d9f075311..6358187dc13 100644 --- a/src/cloudflare/types/rulesets/phase_update_params.py +++ b/src/cloudflare/types/rulesets/phase_update_params.py @@ -2,19 +2,16 @@ from __future__ import annotations -from typing import Union, Iterable +from typing import Iterable from typing_extensions import Literal, Required, TypedDict -from .log_rule_param import LogRuleParam -from .skip_rule_param import SkipRuleParam -from .block_rule_param import BlockRuleParam -from .execute_rule_param import ExecuteRuleParam +from ..request_rule_param import RequestRuleParam -__all__ = ["PhaseUpdateParams", "Rule"] +__all__ = ["PhaseUpdateParams"] class PhaseUpdateParams(TypedDict, total=False): - rules: Required[Iterable[Rule]] + rules: Required[Iterable[RequestRuleParam]] """The list of rules in the ruleset.""" account_id: str @@ -58,6 +55,3 @@ class PhaseUpdateParams(TypedDict, total=False): "magic_transit_managed", ] """The phase of the ruleset.""" - - -Rule = Union[BlockRuleParam, ExecuteRuleParam, LogRuleParam, SkipRuleParam] diff --git a/src/cloudflare/types/rulesets/phase_update_response.py b/src/cloudflare/types/rulesets/phase_update_response.py index 0c1cd322a13..fb4e15ea6c6 100644 --- a/src/cloudflare/types/rulesets/phase_update_response.py +++ b/src/cloudflare/types/rulesets/phase_update_response.py @@ -1,18 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import List, Optional from datetime import datetime from typing_extensions import Literal -from .log_rule import LogRule from ..._models import BaseModel -from .skip_rule import SkipRule -from .block_rule import BlockRule -from .execute_rule import ExecuteRule +from ..respone_rule import ResponeRule -__all__ = ["PhaseUpdateResponse", "Rule"] - -Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] +__all__ = ["PhaseUpdateResponse"] class PhaseUpdateResponse(BaseModel): @@ -55,7 +50,7 @@ class PhaseUpdateResponse(BaseModel): ] """The phase of the ruleset.""" - rules: List[Rule] + rules: List[ResponeRule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/rulesets/phases/version_get_response.py b/src/cloudflare/types/rulesets/phases/version_get_response.py index e8f1701d4dd..46ca9cd68cb 100644 --- a/src/cloudflare/types/rulesets/phases/version_get_response.py +++ b/src/cloudflare/types/rulesets/phases/version_get_response.py @@ -1,18 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import List, Optional from datetime import datetime from typing_extensions import Literal -from ..log_rule import LogRule from ...._models import BaseModel -from ..skip_rule import SkipRule -from ..block_rule import BlockRule -from ..execute_rule import ExecuteRule +from ...respone_rule import ResponeRule -__all__ = ["VersionGetResponse", "Rule"] - -Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] +__all__ = ["VersionGetResponse"] class VersionGetResponse(BaseModel): @@ -55,7 +50,7 @@ class VersionGetResponse(BaseModel): ] """The phase of the ruleset.""" - rules: List[Rule] + rules: List[ResponeRule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/rulesets/rule_create_response.py b/src/cloudflare/types/rulesets/rule_create_response.py index 3d96e28a3ea..7fc7f8e16d5 100644 --- a/src/cloudflare/types/rulesets/rule_create_response.py +++ b/src/cloudflare/types/rulesets/rule_create_response.py @@ -1,18 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import List, Optional from datetime import datetime from typing_extensions import Literal -from .log_rule import LogRule from ..._models import BaseModel -from .skip_rule import SkipRule -from .block_rule import BlockRule -from .execute_rule import ExecuteRule +from ..respone_rule import ResponeRule -__all__ = ["RuleCreateResponse", "Rule"] - -Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] +__all__ = ["RuleCreateResponse"] class RuleCreateResponse(BaseModel): @@ -55,7 +50,7 @@ class RuleCreateResponse(BaseModel): ] """The phase of the ruleset.""" - rules: List[Rule] + rules: List[ResponeRule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/rulesets/rule_delete_response.py b/src/cloudflare/types/rulesets/rule_delete_response.py index 9533a139323..47eec7625c1 100644 --- a/src/cloudflare/types/rulesets/rule_delete_response.py +++ b/src/cloudflare/types/rulesets/rule_delete_response.py @@ -1,18 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import List, Optional from datetime import datetime from typing_extensions import Literal -from .log_rule import LogRule from ..._models import BaseModel -from .skip_rule import SkipRule -from .block_rule import BlockRule -from .execute_rule import ExecuteRule +from ..respone_rule import ResponeRule -__all__ = ["RuleDeleteResponse", "Rule"] - -Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] +__all__ = ["RuleDeleteResponse"] class RuleDeleteResponse(BaseModel): @@ -55,7 +50,7 @@ class RuleDeleteResponse(BaseModel): ] """The phase of the ruleset.""" - rules: List[Rule] + rules: List[ResponeRule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/rulesets/rule_edit_response.py b/src/cloudflare/types/rulesets/rule_edit_response.py index d13e37c8643..87c1d04511c 100644 --- a/src/cloudflare/types/rulesets/rule_edit_response.py +++ b/src/cloudflare/types/rulesets/rule_edit_response.py @@ -1,18 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import List, Optional from datetime import datetime from typing_extensions import Literal -from .log_rule import LogRule from ..._models import BaseModel -from .skip_rule import SkipRule -from .block_rule import BlockRule -from .execute_rule import ExecuteRule +from ..respone_rule import ResponeRule -__all__ = ["RuleEditResponse", "Rule"] - -Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] +__all__ = ["RuleEditResponse"] class RuleEditResponse(BaseModel): @@ -55,7 +50,7 @@ class RuleEditResponse(BaseModel): ] """The phase of the ruleset.""" - rules: List[Rule] + rules: List[ResponeRule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/rulesets/version_get_response.py b/src/cloudflare/types/rulesets/version_get_response.py index fdd1e094340..ef8ea2b80ac 100644 --- a/src/cloudflare/types/rulesets/version_get_response.py +++ b/src/cloudflare/types/rulesets/version_get_response.py @@ -1,18 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import List, Optional from datetime import datetime from typing_extensions import Literal -from .log_rule import LogRule from ..._models import BaseModel -from .skip_rule import SkipRule -from .block_rule import BlockRule -from .execute_rule import ExecuteRule +from ..respone_rule import ResponeRule -__all__ = ["VersionGetResponse", "Rule"] - -Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] +__all__ = ["VersionGetResponse"] class VersionGetResponse(BaseModel): @@ -55,7 +50,7 @@ class VersionGetResponse(BaseModel): ] """The phase of the ruleset.""" - rules: List[Rule] + rules: List[ResponeRule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/rulesets/versions/by_tag_get_response.py b/src/cloudflare/types/rulesets/versions/by_tag_get_response.py index e5d1f322f3a..b5ae633293f 100644 --- a/src/cloudflare/types/rulesets/versions/by_tag_get_response.py +++ b/src/cloudflare/types/rulesets/versions/by_tag_get_response.py @@ -1,18 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import List, Optional from datetime import datetime from typing_extensions import Literal -from ..log_rule import LogRule from ...._models import BaseModel -from ..skip_rule import SkipRule -from ..block_rule import BlockRule -from ..execute_rule import ExecuteRule +from ...respone_rule import ResponeRule -__all__ = ["ByTagGetResponse", "Rule"] - -Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] +__all__ = ["ByTagGetResponse"] class ByTagGetResponse(BaseModel): @@ -55,7 +50,7 @@ class ByTagGetResponse(BaseModel): ] """The phase of the ruleset.""" - rules: List[Rule] + rules: List[ResponeRule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/shared/__init__.py b/src/cloudflare/types/shared/__init__.py index 5a67949303d..f208be63f6b 100644 --- a/src/cloudflare/types/shared/__init__.py +++ b/src/cloudflare/types/shared/__init__.py @@ -1,6 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .result import Result as Result +from .iam_role import IamRole as IamRole +from .audit_log import AuditLog as AuditLog from .error_data import ErrorData as ErrorData from .identifier import Identifier as Identifier from .response_info import ResponseInfo as ResponseInfo diff --git a/src/cloudflare/types/user/audit_log_list_response.py b/src/cloudflare/types/shared/audit_log.py similarity index 95% rename from src/cloudflare/types/user/audit_log_list_response.py rename to src/cloudflare/types/shared/audit_log.py index 4d7f2580aae..22eef13a50c 100644 --- a/src/cloudflare/types/user/audit_log_list_response.py +++ b/src/cloudflare/types/shared/audit_log.py @@ -8,7 +8,7 @@ from ..._models import BaseModel -__all__ = ["AuditLogListResponse", "Action", "Actor", "Owner", "Resource"] +__all__ = ["AuditLog", "Action", "Actor", "Owner", "Resource"] class Action(BaseModel): @@ -49,7 +49,7 @@ class Resource(BaseModel): """A short string that describes the resource that was affected by the action.""" -class AuditLogListResponse(BaseModel): +class AuditLog(BaseModel): id: Optional[str] = None """A string that uniquely identifies the audit log.""" diff --git a/src/cloudflare/types/accounts/role_list_response.py b/src/cloudflare/types/shared/iam_role.py similarity index 86% rename from src/cloudflare/types/accounts/role_list_response.py rename to src/cloudflare/types/shared/iam_role.py index a2ed62ad78b..11cd30c1882 100644 --- a/src/cloudflare/types/accounts/role_list_response.py +++ b/src/cloudflare/types/shared/iam_role.py @@ -5,10 +5,10 @@ from ..._models import BaseModel from ..user.tokens import Permission -__all__ = ["RoleListResponse"] +__all__ = ["IamRole"] -class RoleListResponse(BaseModel): +class IamRole(BaseModel): id: str """Role identifier tag.""" diff --git a/src/cloudflare/types/shared/result.py b/src/cloudflare/types/shared/result.py index 82ad0e63b6c..27983e6c0fd 100644 --- a/src/cloudflare/types/shared/result.py +++ b/src/cloudflare/types/shared/result.py @@ -1,93 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Union, Optional -from datetime import datetime from typing_extensions import Literal -from pydantic import Field as FieldInfo - from ..._models import BaseModel +from .audit_log import AuditLog from .response_info import ResponseInfo -__all__ = [ - "Result", - "UnionMember0", - "UnionMember0Result", - "UnionMember0ResultAction", - "UnionMember0ResultActor", - "UnionMember0ResultOwner", - "UnionMember0ResultResource", - "AaaAPIResponseCommon", -] - - -class UnionMember0ResultAction(BaseModel): - result: Optional[bool] = None - """A boolean that indicates if the action attempted was successful.""" - - type: Optional[str] = None - """A short string that describes the action that was performed.""" - - -class UnionMember0ResultActor(BaseModel): - id: Optional[str] = None - """The ID of the actor that performed the action. - - If a user performed the action, this will be their User ID. - """ - - email: Optional[str] = None - """The email of the user that performed the action.""" - - ip: Optional[str] = None - """The IP address of the request that performed the action.""" - - type: Optional[Literal["user", "admin", "Cloudflare"]] = None - """The type of actor, whether a User, Cloudflare Admin, or an Automated System.""" - - -class UnionMember0ResultOwner(BaseModel): - id: Optional[str] = None - """Identifier""" - - -class UnionMember0ResultResource(BaseModel): - id: Optional[str] = None - """An identifier for the resource that was affected by the action.""" - - type: Optional[str] = None - """A short string that describes the resource that was affected by the action.""" - - -class UnionMember0Result(BaseModel): - id: Optional[str] = None - """A string that uniquely identifies the audit log.""" - - action: Optional[UnionMember0ResultAction] = None - - actor: Optional[UnionMember0ResultActor] = None - - interface: Optional[str] = None - """The source of the event.""" - - metadata: Optional[object] = None - """An object which can lend more context to the action being logged. - - This is a flexible value and varies between different actions. - """ - - new_value: Optional[str] = FieldInfo(alias="newValue", default=None) - """The new value of the resource that was modified.""" - - old_value: Optional[str] = FieldInfo(alias="oldValue", default=None) - """The value of the resource before it was modified.""" - - owner: Optional[UnionMember0ResultOwner] = None - - resource: Optional[UnionMember0ResultResource] = None - - when: Optional[datetime] = None - """A UTC RFC3339 timestamp that specifies when the action being logged occured.""" +__all__ = ["Result", "UnionMember0", "AaaAPIResponseCommon"] class UnionMember0(BaseModel): @@ -95,7 +15,7 @@ class UnionMember0(BaseModel): messages: Optional[List[object]] = None - result: Optional[List[UnionMember0Result]] = None + result: Optional[List[AuditLog]] = None success: Optional[bool] = None diff --git a/src/cloudflare/types/subscription_create_params.py b/src/cloudflare/types/subscription_create_params.py index b345c7a8b90..49e4f424768 100644 --- a/src/cloudflare/types/subscription_create_params.py +++ b/src/cloudflare/types/subscription_create_params.py @@ -2,69 +2,30 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Iterable from typing_extensions import Literal, TypedDict -__all__ = ["SubscriptionCreateParams", "App", "ComponentValue", "RatePlan", "Zone"] +from .user import RatePlanParam, SubscriptionZoneParam, SubscriptionComponentParam + +__all__ = ["SubscriptionCreateParams", "App"] class SubscriptionCreateParams(TypedDict, total=False): app: App - component_values: Iterable[ComponentValue] + component_values: Iterable[SubscriptionComponentParam] """The list of add-ons subscribed to.""" frequency: Literal["weekly", "monthly", "quarterly", "yearly"] """How often the subscription is renewed automatically.""" - rate_plan: RatePlan + rate_plan: RatePlanParam """The rate plan applied to the subscription.""" - zone: Zone + zone: SubscriptionZoneParam """A simple zone object. May have null properties if not a zone subscription.""" class App(TypedDict, total=False): install_id: str """app install id.""" - - -class ComponentValue(TypedDict, total=False): - default: float - """The default amount assigned.""" - - name: str - """The name of the component value.""" - - price: float - """The unit price for the component value.""" - - value: float - """The amount of the component value assigned.""" - - -class RatePlan(TypedDict, total=False): - id: str - """The ID of the rate plan.""" - - currency: str - """The currency applied to the rate plan subscription.""" - - externally_managed: bool - """Whether this rate plan is managed externally from Cloudflare.""" - - is_contract: bool - """Whether a rate plan is enterprise-based (or newly adopted term contract).""" - - public_name: str - """The full name of the rate plan.""" - - scope: str - """The scope that this rate plan applies to.""" - - sets: List[str] - """The list of sets this rate plan applies to.""" - - -class Zone(TypedDict, total=False): - pass diff --git a/src/cloudflare/types/subscription_update_params.py b/src/cloudflare/types/subscription_update_params.py index dfc3e37e92d..fc8d51ff7ba 100644 --- a/src/cloudflare/types/subscription_update_params.py +++ b/src/cloudflare/types/subscription_update_params.py @@ -2,10 +2,12 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["SubscriptionUpdateParams", "App", "ComponentValue", "RatePlan", "Zone"] +from .user import RatePlanParam, SubscriptionZoneParam, SubscriptionComponentParam + +__all__ = ["SubscriptionUpdateParams", "App"] class SubscriptionUpdateParams(TypedDict, total=False): @@ -14,60 +16,19 @@ class SubscriptionUpdateParams(TypedDict, total=False): app: App - component_values: Iterable[ComponentValue] + component_values: Iterable[SubscriptionComponentParam] """The list of add-ons subscribed to.""" frequency: Literal["weekly", "monthly", "quarterly", "yearly"] """How often the subscription is renewed automatically.""" - rate_plan: RatePlan + rate_plan: RatePlanParam """The rate plan applied to the subscription.""" - zone: Zone + zone: SubscriptionZoneParam """A simple zone object. May have null properties if not a zone subscription.""" class App(TypedDict, total=False): install_id: str """app install id.""" - - -class ComponentValue(TypedDict, total=False): - default: float - """The default amount assigned.""" - - name: str - """The name of the component value.""" - - price: float - """The unit price for the component value.""" - - value: float - """The amount of the component value assigned.""" - - -class RatePlan(TypedDict, total=False): - id: str - """The ID of the rate plan.""" - - currency: str - """The currency applied to the rate plan subscription.""" - - externally_managed: bool - """Whether this rate plan is managed externally from Cloudflare.""" - - is_contract: bool - """Whether a rate plan is enterprise-based (or newly adopted term contract).""" - - public_name: str - """The full name of the rate plan.""" - - scope: str - """The scope that this rate plan applies to.""" - - sets: List[str] - """The list of sets this rate plan applies to.""" - - -class Zone(TypedDict, total=False): - pass diff --git a/src/cloudflare/types/user/__init__.py b/src/cloudflare/types/user/__init__.py index 87aa4f37df5..5cf8009e08a 100644 --- a/src/cloudflare/types/user/__init__.py +++ b/src/cloudflare/types/user/__init__.py @@ -5,9 +5,12 @@ from .invite import Invite as Invite from .policy import Policy as Policy from .cidr_list import CIDRList as CIDRList +from .rate_plan import RatePlan as RatePlan from .organization import Organization as Organization from .policy_param import PolicyParam as PolicyParam from .subscription import Subscription as Subscription +from .rate_plan_param import RatePlanParam as RatePlanParam +from .subscription_zone import SubscriptionZone as SubscriptionZone from .token_list_params import TokenListParams as TokenListParams from .invite_edit_params import InviteEditParams as InviteEditParams from .token_get_response import TokenGetResponse as TokenGetResponse @@ -21,7 +24,8 @@ from .token_delete_response import TokenDeleteResponse as TokenDeleteResponse from .token_update_response import TokenUpdateResponse as TokenUpdateResponse from .token_verify_response import TokenVerifyResponse as TokenVerifyResponse -from .audit_log_list_response import AuditLogListResponse as AuditLogListResponse +from .subscription_component import SubscriptionComponent as SubscriptionComponent +from .subscription_zone_param import SubscriptionZoneParam as SubscriptionZoneParam from .organization_list_params import OrganizationListParams as OrganizationListParams from .subscription_edit_params import SubscriptionEditParams as SubscriptionEditParams from .organization_get_response import OrganizationGetResponse as OrganizationGetResponse @@ -31,5 +35,6 @@ from .subscription_edit_response import SubscriptionEditResponse as SubscriptionEditResponse from .subscription_update_params import SubscriptionUpdateParams as SubscriptionUpdateParams from .organization_delete_response import OrganizationDeleteResponse as OrganizationDeleteResponse +from .subscription_component_param import SubscriptionComponentParam as SubscriptionComponentParam from .subscription_delete_response import SubscriptionDeleteResponse as SubscriptionDeleteResponse from .subscription_update_response import SubscriptionUpdateResponse as SubscriptionUpdateResponse diff --git a/src/cloudflare/types/user/invite.py b/src/cloudflare/types/user/invite.py index fe493799a7a..44246165585 100644 --- a/src/cloudflare/types/user/invite.py +++ b/src/cloudflare/types/user/invite.py @@ -4,24 +4,10 @@ from datetime import datetime from typing_extensions import Literal -from .tokens import Permission +from ..shared import IamRole from ..._models import BaseModel -__all__ = ["Invite", "Role"] - - -class Role(BaseModel): - id: str - """Role identifier tag.""" - - description: str - """Description of role's permissions.""" - - name: str - """Role Name.""" - - permissions: List[Permission] - """Access permissions for this User.""" +__all__ = ["Invite"] class Invite(BaseModel): @@ -49,7 +35,7 @@ class Invite(BaseModel): organization_name: Optional[str] = None """Organization name.""" - roles: Optional[List[Role]] = None + roles: Optional[List[IamRole]] = None """Roles to be assigned to this user.""" status: Optional[Literal["pending", "accepted", "rejected", "expired"]] = None diff --git a/src/cloudflare/types/user/rate_plan.py b/src/cloudflare/types/user/rate_plan.py new file mode 100644 index 00000000000..deab37dc61c --- /dev/null +++ b/src/cloudflare/types/user/rate_plan.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["RatePlan"] + + +class RatePlan(BaseModel): + id: Optional[str] = None + """The ID of the rate plan.""" + + currency: Optional[str] = None + """The currency applied to the rate plan subscription.""" + + externally_managed: Optional[bool] = None + """Whether this rate plan is managed externally from Cloudflare.""" + + is_contract: Optional[bool] = None + """Whether a rate plan is enterprise-based (or newly adopted term contract).""" + + public_name: Optional[str] = None + """The full name of the rate plan.""" + + scope: Optional[str] = None + """The scope that this rate plan applies to.""" + + sets: Optional[List[str]] = None + """The list of sets this rate plan applies to.""" diff --git a/src/cloudflare/types/user/rate_plan_param.py b/src/cloudflare/types/user/rate_plan_param.py new file mode 100644 index 00000000000..a937bcdf0f0 --- /dev/null +++ b/src/cloudflare/types/user/rate_plan_param.py @@ -0,0 +1,31 @@ +# 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 TypedDict + +__all__ = ["RatePlanParam"] + + +class RatePlanParam(TypedDict, total=False): + id: str + """The ID of the rate plan.""" + + currency: str + """The currency applied to the rate plan subscription.""" + + externally_managed: bool + """Whether this rate plan is managed externally from Cloudflare.""" + + is_contract: bool + """Whether a rate plan is enterprise-based (or newly adopted term contract).""" + + public_name: str + """The full name of the rate plan.""" + + scope: str + """The scope that this rate plan applies to.""" + + sets: List[str] + """The list of sets this rate plan applies to.""" diff --git a/src/cloudflare/types/user/subscription.py b/src/cloudflare/types/user/subscription.py index ff12f3e5414..1265c4f04cc 100644 --- a/src/cloudflare/types/user/subscription.py +++ b/src/cloudflare/types/user/subscription.py @@ -5,8 +5,11 @@ from typing_extensions import Literal from ..._models import BaseModel +from .rate_plan import RatePlan +from .subscription_zone import SubscriptionZone +from .subscription_component import SubscriptionComponent -__all__ = ["Subscription", "App", "ComponentValue", "RatePlan", "Zone"] +__all__ = ["Subscription", "App"] class App(BaseModel): @@ -14,58 +17,13 @@ class App(BaseModel): """app install id.""" -class ComponentValue(BaseModel): - default: Optional[float] = None - """The default amount assigned.""" - - name: Optional[str] = None - """The name of the component value.""" - - price: Optional[float] = None - """The unit price for the component value.""" - - value: Optional[float] = None - """The amount of the component value assigned.""" - - -class RatePlan(BaseModel): - id: Optional[str] = None - """The ID of the rate plan.""" - - currency: Optional[str] = None - """The currency applied to the rate plan subscription.""" - - externally_managed: Optional[bool] = None - """Whether this rate plan is managed externally from Cloudflare.""" - - is_contract: Optional[bool] = None - """Whether a rate plan is enterprise-based (or newly adopted term contract).""" - - public_name: Optional[str] = None - """The full name of the rate plan.""" - - scope: Optional[str] = None - """The scope that this rate plan applies to.""" - - sets: Optional[List[str]] = None - """The list of sets this rate plan applies to.""" - - -class Zone(BaseModel): - id: Optional[str] = None - """Identifier""" - - name: Optional[str] = None - """The domain name""" - - class Subscription(BaseModel): id: Optional[str] = None """Subscription identifier tag.""" app: Optional[App] = None - component_values: Optional[List[ComponentValue]] = None + component_values: Optional[List[SubscriptionComponent]] = None """The list of add-ons subscribed to.""" currency: Optional[str] = None @@ -92,5 +50,5 @@ class Subscription(BaseModel): state: Optional[Literal["Trial", "Provisioned", "Paid", "AwaitingPayment", "Cancelled", "Failed", "Expired"]] = None """The state that the subscription is in.""" - zone: Optional[Zone] = None + zone: Optional[SubscriptionZone] = None """A simple zone object. May have null properties if not a zone subscription.""" diff --git a/src/cloudflare/types/user/subscription_component.py b/src/cloudflare/types/user/subscription_component.py new file mode 100644 index 00000000000..3bfb3faf7b6 --- /dev/null +++ b/src/cloudflare/types/user/subscription_component.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["SubscriptionComponent"] + + +class SubscriptionComponent(BaseModel): + default: Optional[float] = None + """The default amount assigned.""" + + name: Optional[str] = None + """The name of the component value.""" + + price: Optional[float] = None + """The unit price for the component value.""" + + value: Optional[float] = None + """The amount of the component value assigned.""" diff --git a/src/cloudflare/types/user/subscription_component_param.py b/src/cloudflare/types/user/subscription_component_param.py new file mode 100644 index 00000000000..958846faedd --- /dev/null +++ b/src/cloudflare/types/user/subscription_component_param.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["SubscriptionComponentParam"] + + +class SubscriptionComponentParam(TypedDict, total=False): + default: float + """The default amount assigned.""" + + name: str + """The name of the component value.""" + + price: float + """The unit price for the component value.""" + + value: float + """The amount of the component value assigned.""" diff --git a/src/cloudflare/types/user/subscription_edit_params.py b/src/cloudflare/types/user/subscription_edit_params.py index 6a56403b8b8..42587341cbe 100644 --- a/src/cloudflare/types/user/subscription_edit_params.py +++ b/src/cloudflare/types/user/subscription_edit_params.py @@ -2,69 +2,32 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Iterable from typing_extensions import Literal, TypedDict -__all__ = ["SubscriptionEditParams", "App", "ComponentValue", "RatePlan", "Zone"] +from .rate_plan_param import RatePlanParam +from .subscription_zone_param import SubscriptionZoneParam +from .subscription_component_param import SubscriptionComponentParam + +__all__ = ["SubscriptionEditParams", "App"] class SubscriptionEditParams(TypedDict, total=False): app: App - component_values: Iterable[ComponentValue] + component_values: Iterable[SubscriptionComponentParam] """The list of add-ons subscribed to.""" frequency: Literal["weekly", "monthly", "quarterly", "yearly"] """How often the subscription is renewed automatically.""" - rate_plan: RatePlan + rate_plan: RatePlanParam """The rate plan applied to the subscription.""" - zone: Zone + zone: SubscriptionZoneParam """A simple zone object. May have null properties if not a zone subscription.""" class App(TypedDict, total=False): install_id: str """app install id.""" - - -class ComponentValue(TypedDict, total=False): - default: float - """The default amount assigned.""" - - name: str - """The name of the component value.""" - - price: float - """The unit price for the component value.""" - - value: float - """The amount of the component value assigned.""" - - -class RatePlan(TypedDict, total=False): - id: str - """The ID of the rate plan.""" - - currency: str - """The currency applied to the rate plan subscription.""" - - externally_managed: bool - """Whether this rate plan is managed externally from Cloudflare.""" - - is_contract: bool - """Whether a rate plan is enterprise-based (or newly adopted term contract).""" - - public_name: str - """The full name of the rate plan.""" - - scope: str - """The scope that this rate plan applies to.""" - - sets: List[str] - """The list of sets this rate plan applies to.""" - - -class Zone(TypedDict, total=False): - pass diff --git a/src/cloudflare/types/user/subscription_update_params.py b/src/cloudflare/types/user/subscription_update_params.py index b131772a989..e0114c776e4 100644 --- a/src/cloudflare/types/user/subscription_update_params.py +++ b/src/cloudflare/types/user/subscription_update_params.py @@ -2,69 +2,32 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Iterable from typing_extensions import Literal, TypedDict -__all__ = ["SubscriptionUpdateParams", "App", "ComponentValue", "RatePlan", "Zone"] +from .rate_plan_param import RatePlanParam +from .subscription_zone_param import SubscriptionZoneParam +from .subscription_component_param import SubscriptionComponentParam + +__all__ = ["SubscriptionUpdateParams", "App"] class SubscriptionUpdateParams(TypedDict, total=False): app: App - component_values: Iterable[ComponentValue] + component_values: Iterable[SubscriptionComponentParam] """The list of add-ons subscribed to.""" frequency: Literal["weekly", "monthly", "quarterly", "yearly"] """How often the subscription is renewed automatically.""" - rate_plan: RatePlan + rate_plan: RatePlanParam """The rate plan applied to the subscription.""" - zone: Zone + zone: SubscriptionZoneParam """A simple zone object. May have null properties if not a zone subscription.""" class App(TypedDict, total=False): install_id: str """app install id.""" - - -class ComponentValue(TypedDict, total=False): - default: float - """The default amount assigned.""" - - name: str - """The name of the component value.""" - - price: float - """The unit price for the component value.""" - - value: float - """The amount of the component value assigned.""" - - -class RatePlan(TypedDict, total=False): - id: str - """The ID of the rate plan.""" - - currency: str - """The currency applied to the rate plan subscription.""" - - externally_managed: bool - """Whether this rate plan is managed externally from Cloudflare.""" - - is_contract: bool - """Whether a rate plan is enterprise-based (or newly adopted term contract).""" - - public_name: str - """The full name of the rate plan.""" - - scope: str - """The scope that this rate plan applies to.""" - - sets: List[str] - """The list of sets this rate plan applies to.""" - - -class Zone(TypedDict, total=False): - pass diff --git a/src/cloudflare/types/user/subscription_zone.py b/src/cloudflare/types/user/subscription_zone.py new file mode 100644 index 00000000000..353d7100d9b --- /dev/null +++ b/src/cloudflare/types/user/subscription_zone.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["SubscriptionZone"] + + +class SubscriptionZone(BaseModel): + id: Optional[str] = None + """Identifier""" + + name: Optional[str] = None + """The domain name""" diff --git a/src/cloudflare/types/user/subscription_zone_param.py b/src/cloudflare/types/user/subscription_zone_param.py new file mode 100644 index 00000000000..5cc2fcb6b0c --- /dev/null +++ b/src/cloudflare/types/user/subscription_zone_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 TypedDict + +__all__ = ["SubscriptionZoneParam"] + + +class SubscriptionZoneParam(TypedDict, total=False): + pass diff --git a/src/cloudflare/types/warp_connector.py b/src/cloudflare/types/warp_connector.py index c8ba2fe49b5..2b449e055c9 100644 --- a/src/cloudflare/types/warp_connector.py +++ b/src/cloudflare/types/warp_connector.py @@ -5,45 +5,9 @@ from typing_extensions import Literal from .._models import BaseModel +from .zero_trust import TunnelConnection -__all__ = [ - "WARPConnector", - "TunnelCfdTunnel", - "TunnelCfdTunnelConnection", - "TunnelWARPConnectorTunnel", - "TunnelWARPConnectorTunnelConnection", -] - - -class TunnelCfdTunnelConnection(BaseModel): - id: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" - - client_version: Optional[str] = None - """The cloudflared version used to establish this connection.""" - - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" - - is_pending_reconnect: Optional[bool] = None - """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. - """ - - opened_at: Optional[datetime] = None - """Timestamp of when the connection was established.""" - - origin_ip: Optional[str] = None - """The public IP address of the host running cloudflared.""" - - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" +__all__ = ["WARPConnector", "TunnelCfdTunnel", "TunnelWARPConnectorTunnel"] class TunnelCfdTunnel(BaseModel): @@ -53,7 +17,7 @@ class TunnelCfdTunnel(BaseModel): account_tag: Optional[str] = None """Cloudflare account ID""" - connections: Optional[List[TunnelCfdTunnelConnection]] = None + connections: Optional[List[TunnelConnection]] = None """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" conns_active_at: Optional[datetime] = None @@ -102,37 +66,6 @@ class TunnelCfdTunnel(BaseModel): """The type of tunnel.""" -class TunnelWARPConnectorTunnelConnection(BaseModel): - id: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" - - client_version: Optional[str] = None - """The cloudflared version used to establish this connection.""" - - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" - - is_pending_reconnect: Optional[bool] = None - """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. - """ - - opened_at: Optional[datetime] = None - """Timestamp of when the connection was established.""" - - origin_ip: Optional[str] = None - """The public IP address of the host running cloudflared.""" - - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - class TunnelWARPConnectorTunnel(BaseModel): id: Optional[str] = None """UUID of the tunnel.""" @@ -140,7 +73,7 @@ class TunnelWARPConnectorTunnel(BaseModel): account_tag: Optional[str] = None """Cloudflare account ID""" - connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = None + connections: Optional[List[TunnelConnection]] = None """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" conns_active_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/__init__.py b/src/cloudflare/types/zero_trust/__init__.py index 18f026b1887..2930717e831 100644 --- a/src/cloudflare/types/zero_trust/__init__.py +++ b/src/cloudflare/types/zero_trust/__init__.py @@ -34,6 +34,7 @@ from .gsuite_group_rule import GSuiteGroupRule as GSuiteGroupRule from .identity_provider import IdentityProvider as IdentityProvider from .scim_config_param import ScimConfigParam as ScimConfigParam +from .tunnel_connection import TunnelConnection as TunnelConnection from .country_rule_param import CountryRuleParam as CountryRuleParam from .ip_list_rule_param import IPListRuleParam as IPListRuleParam from .login_design_param import LoginDesignParam as LoginDesignParam diff --git a/src/cloudflare/types/zero_trust/tunnel_connection.py b/src/cloudflare/types/zero_trust/tunnel_connection.py new file mode 100644 index 00000000000..d1c6ac1e6fa --- /dev/null +++ b/src/cloudflare/types/zero_trust/tunnel_connection.py @@ -0,0 +1,39 @@ +# 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__ = ["TunnelConnection"] + + +class TunnelConnection(BaseModel): + id: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + client_id: Optional[object] = None + """UUID of the cloudflared instance.""" + + client_version: Optional[str] = None + """The cloudflared version used to establish this connection.""" + + colo_name: Optional[str] = None + """The Cloudflare data center used for this connection.""" + + is_pending_reconnect: Optional[bool] = None + """ + Cloudflare continues to track connections for several minutes after they + disconnect. This is an optimization to improve latency and reliability of + reconnecting. If `true`, the connection has disconnected but is still being + tracked. If `false`, the connection is actively serving traffic. + """ + + opened_at: Optional[datetime] = None + """Timestamp of when the connection was established.""" + + origin_ip: Optional[str] = None + """The public IP address of the host running cloudflared.""" + + uuid: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" diff --git a/src/cloudflare/types/zero_trust/tunnels/client.py b/src/cloudflare/types/zero_trust/tunnels/client.py index 1c18c5ff6f2..c77730f9f6a 100644 --- a/src/cloudflare/types/zero_trust/tunnels/client.py +++ b/src/cloudflare/types/zero_trust/tunnels/client.py @@ -4,39 +4,9 @@ from datetime import datetime from ...._models import BaseModel +from ..tunnel_connection import TunnelConnection -__all__ = ["Client", "Conn"] - - -class Conn(BaseModel): - id: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" - - client_version: Optional[str] = None - """The cloudflared version used to establish this connection.""" - - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" - - is_pending_reconnect: Optional[bool] = None - """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. - """ - - opened_at: Optional[datetime] = None - """Timestamp of when the connection was established.""" - - origin_ip: Optional[str] = None - """The public IP address of the host running cloudflared.""" - - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" +__all__ = ["Client"] class Client(BaseModel): @@ -52,7 +22,7 @@ class Client(BaseModel): Used internally to sync cloudflared with the Zero Trust dashboard. """ - conns: Optional[List[Conn]] = None + conns: Optional[List[TunnelConnection]] = None """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" features: Optional[List[str]] = None diff --git a/src/cloudflare/types/zones/subscription_create_params.py b/src/cloudflare/types/zones/subscription_create_params.py index b345c7a8b90..1d2b9b5dbb0 100644 --- a/src/cloudflare/types/zones/subscription_create_params.py +++ b/src/cloudflare/types/zones/subscription_create_params.py @@ -2,69 +2,30 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Iterable from typing_extensions import Literal, TypedDict -__all__ = ["SubscriptionCreateParams", "App", "ComponentValue", "RatePlan", "Zone"] +from ..user import RatePlanParam, SubscriptionZoneParam, SubscriptionComponentParam + +__all__ = ["SubscriptionCreateParams", "App"] class SubscriptionCreateParams(TypedDict, total=False): app: App - component_values: Iterable[ComponentValue] + component_values: Iterable[SubscriptionComponentParam] """The list of add-ons subscribed to.""" frequency: Literal["weekly", "monthly", "quarterly", "yearly"] """How often the subscription is renewed automatically.""" - rate_plan: RatePlan + rate_plan: RatePlanParam """The rate plan applied to the subscription.""" - zone: Zone + zone: SubscriptionZoneParam """A simple zone object. May have null properties if not a zone subscription.""" class App(TypedDict, total=False): install_id: str """app install id.""" - - -class ComponentValue(TypedDict, total=False): - default: float - """The default amount assigned.""" - - name: str - """The name of the component value.""" - - price: float - """The unit price for the component value.""" - - value: float - """The amount of the component value assigned.""" - - -class RatePlan(TypedDict, total=False): - id: str - """The ID of the rate plan.""" - - currency: str - """The currency applied to the rate plan subscription.""" - - externally_managed: bool - """Whether this rate plan is managed externally from Cloudflare.""" - - is_contract: bool - """Whether a rate plan is enterprise-based (or newly adopted term contract).""" - - public_name: str - """The full name of the rate plan.""" - - scope: str - """The scope that this rate plan applies to.""" - - sets: List[str] - """The list of sets this rate plan applies to.""" - - -class Zone(TypedDict, total=False): - pass diff --git a/tests/api_resources/accounts/test_roles.py b/tests/api_resources/accounts/test_roles.py index 2cbdcfab4c5..f2fd87644ca 100644 --- a/tests/api_resources/accounts/test_roles.py +++ b/tests/api_resources/accounts/test_roles.py @@ -10,7 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.accounts import RoleGetResponse, RoleListResponse +from cloudflare.types.shared import IamRole +from cloudflare.types.accounts import RoleGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,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[IamRole], role, path=["response"]) @pytest.mark.skip() @parametrize @@ -36,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[IamRole], role, path=["response"]) @pytest.mark.skip() @parametrize @@ -48,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[IamRole], role, path=["response"]) assert cast(Any, response.is_closed) is True @@ -99,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[IamRole], role, path=["response"]) @pytest.mark.skip() @parametrize @@ -111,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[IamRole], role, path=["response"]) @pytest.mark.skip() @parametrize @@ -123,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[IamRole], role, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_audit_logs.py b/tests/api_resources/test_audit_logs.py index 305e7cc8894..1e5562aa2f7 100644 --- a/tests/api_resources/test_audit_logs.py +++ b/tests/api_resources/test_audit_logs.py @@ -9,9 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import AuditLogListResponse from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.shared import AuditLog 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: audit_log = client.audit_logs.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +47,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: since=parse_datetime("2019-04-30T01:12:20Z"), zone={"name": "example.com"}, ) - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -59,7 +59,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" audit_log = response.parse() - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -71,7 +71,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = response.parse() - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) assert cast(Any, response.is_closed) is True @@ -93,7 +93,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: audit_log = await async_client.audit_logs.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -115,7 +115,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) since=parse_datetime("2019-04-30T01:12:20Z"), zone={"name": "example.com"}, ) - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -127,7 +127,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" audit_log = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -139,7 +139,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/user/test_audit_logs.py b/tests/api_resources/user/test_audit_logs.py index 6d0b5089a82..991015f606d 100644 --- a/tests/api_resources/user/test_audit_logs.py +++ b/tests/api_resources/user/test_audit_logs.py @@ -11,7 +11,7 @@ from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.user import AuditLogListResponse +from cloudflare.types.shared import AuditLog base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ class TestAuditLogs: @parametrize def test_method_list(self, client: Cloudflare) -> None: audit_log = client.user.audit_logs.list() - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +44,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: since=parse_datetime("2019-04-30T01:12:20Z"), zone={"name": "example.com"}, ) - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -54,7 +54,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" audit_log = response.parse() - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -64,7 +64,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = response.parse() - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) assert cast(Any, response.is_closed) is True @@ -76,7 +76,7 @@ class TestAsyncAuditLogs: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: audit_log = await async_client.user.audit_logs.list() - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -97,7 +97,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) since=parse_datetime("2019-04-30T01:12:20Z"), zone={"name": "example.com"}, ) - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +107,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" audit_log = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,6 +117,6 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) assert cast(Any, response.is_closed) is True