diff --git a/.stats.yml b/.stats.yml index 9ad762c7dd4..30e67c9adb7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1321 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-15197dfa1bffc0cc6e86526b7f3b95282aa7af4a5ea87406312e87f0586d2dfa.yml +configured_endpoints: 1274 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-14c9c9adbd65eee546c4f54d95b7627f10b02185348e334a68cbebbe3442733e.yml diff --git a/api.md b/api.md index 7a0d3b24707..0a50bcdb16f 100644 --- a/api.md +++ b/api.md @@ -3051,7 +3051,6 @@ Types: from cloudflare.types.api_gateway import ( Message, PublicSchema, - Schema, SchemaUpload, UserSchemaDeleteResponse, ) @@ -3796,7 +3795,7 @@ from cloudflare.types.intel import Whois, WhoisGetResponse Methods: -- client.intel.whois.get(\*, account_id, \*\*params) -> WhoisGetResponse +- client.intel.whois.get(\*, account_id, \*\*params) -> Optional ## IndicatorFeeds @@ -5179,17 +5178,13 @@ from cloudflare.types.zero_trust import ( IdentityProviderType, ScimConfig, IdentityProviderListResponse, - IdentityProviderDeleteResponse, ) ``` Methods: - client.zero_trust.identity_providers.create(\*, account_id, zone_id, \*\*params) -> Optional -- client.zero_trust.identity_providers.update(uuid, \*, account_id, zone_id, \*\*params) -> Optional - client.zero_trust.identity_providers.list(\*, account_id, zone_id) -> SyncSinglePage[IdentityProviderListResponse] -- client.zero_trust.identity_providers.delete(uuid, \*, account_id, zone_id) -> Optional -- client.zero_trust.identity_providers.get(uuid, \*, account_id, zone_id) -> Optional ## Organizations @@ -5211,13 +5206,9 @@ Methods: Types: ```python -from cloudflare.types.zero_trust import Seat, SeatEditResponse +from cloudflare.types.zero_trust import Seat ``` -Methods: - -- client.zero_trust.seats.edit(identifier, \*\*params) -> Optional - ## Access Types: @@ -5290,20 +5281,12 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.access.applications import ( - CA, - CACreateResponse, - CADeleteResponse, - CAGetResponse, -) +from cloudflare.types.zero_trust.access.applications import CA ``` Methods: -- client.zero_trust.access.applications.cas.create(uuid, \*, account_id, zone_id) -> Optional - client.zero_trust.access.applications.cas.list(\*, account_id, zone_id) -> SyncSinglePage[CA] -- client.zero_trust.access.applications.cas.delete(uuid, \*, account_id, zone_id) -> Optional -- client.zero_trust.access.applications.cas.get(uuid, \*, account_id, zone_id) -> Optional #### UserPolicyChecks @@ -5325,44 +5308,21 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.access.applications import ( - ApprovalGroup, - Policy, - PolicyCreateResponse, - PolicyUpdateResponse, - PolicyListResponse, - PolicyDeleteResponse, - PolicyGetResponse, -) +from cloudflare.types.zero_trust.access.applications import ApprovalGroup, Policy ``` -Methods: - -- client.zero_trust.access.applications.policies.create(uuid, \*, account_id, zone_id, \*\*params) -> Optional -- client.zero_trust.access.applications.policies.update(uuid, \*, uuid1, account_id, zone_id, \*\*params) -> Optional -- client.zero_trust.access.applications.policies.list(uuid, \*, account_id, zone_id) -> SyncSinglePage[PolicyListResponse] -- client.zero_trust.access.applications.policies.delete(uuid, \*, uuid1, account_id, zone_id) -> Optional -- client.zero_trust.access.applications.policies.get(uuid, \*, uuid1, account_id, zone_id) -> Optional - ### Certificates Types: ```python -from cloudflare.types.zero_trust.access import ( - AssociatedHostnames, - Certificate, - CertificateDeleteResponse, -) +from cloudflare.types.zero_trust.access import AssociatedHostnames, Certificate ``` Methods: - client.zero_trust.access.certificates.create(\*, account_id, zone_id, \*\*params) -> Optional -- client.zero_trust.access.certificates.update(uuid, \*, account_id, zone_id, \*\*params) -> Optional - client.zero_trust.access.certificates.list(\*, account_id, zone_id) -> SyncSinglePage[Certificate] -- client.zero_trust.access.certificates.delete(uuid, \*, account_id, zone_id) -> Optional -- client.zero_trust.access.certificates.get(uuid, \*, account_id, zone_id) -> Optional #### Settings @@ -5386,69 +5346,35 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.access import ZeroTrustGroup, GroupDeleteResponse +from cloudflare.types.zero_trust.access import ZeroTrustGroup ``` Methods: - client.zero_trust.access.groups.create(\*, account_id, zone_id, \*\*params) -> Optional -- client.zero_trust.access.groups.update(uuid, \*, account_id, zone_id, \*\*params) -> Optional - client.zero_trust.access.groups.list(\*, account_id, zone_id) -> SyncSinglePage[ZeroTrustGroup] -- client.zero_trust.access.groups.delete(uuid, \*, account_id, zone_id) -> Optional -- client.zero_trust.access.groups.get(uuid, \*, account_id, zone_id) -> Optional ### ServiceTokens Types: ```python -from cloudflare.types.zero_trust.access import ( - ServiceToken, - ServiceTokenCreateResponse, - ServiceTokenRotateResponse, -) +from cloudflare.types.zero_trust.access import ServiceToken, ServiceTokenCreateResponse ``` Methods: - client.zero_trust.access.service_tokens.create(\*, account_id, zone_id, \*\*params) -> Optional -- client.zero_trust.access.service_tokens.update(uuid, \*, account_id, zone_id, \*\*params) -> Optional - client.zero_trust.access.service_tokens.list(\*, account_id, zone_id) -> SyncSinglePage[ServiceToken] -- client.zero_trust.access.service_tokens.delete(uuid, \*, account_id, zone_id) -> Optional -- client.zero_trust.access.service_tokens.get(uuid, \*, account_id, zone_id) -> Optional -- client.zero_trust.access.service_tokens.refresh(uuid, \*, identifier) -> Optional -- client.zero_trust.access.service_tokens.rotate(uuid, \*, identifier) -> Optional ### Bookmarks Types: ```python -from cloudflare.types.zero_trust.access import Bookmark, BookmarkDeleteResponse +from cloudflare.types.zero_trust.access import Bookmark ``` -Methods: - -- client.zero_trust.access.bookmarks.create(uuid, \*, identifier, \*\*params) -> Optional -- client.zero_trust.access.bookmarks.update(uuid, \*, identifier, \*\*params) -> Optional -- client.zero_trust.access.bookmarks.list(identifier) -> SyncSinglePage[Bookmark] -- client.zero_trust.access.bookmarks.delete(uuid, \*, identifier) -> Optional -- client.zero_trust.access.bookmarks.get(uuid, \*, identifier) -> Optional - -### Keys - -Types: - -```python -from cloudflare.types.zero_trust.access import KeyUpdateResponse, KeyGetResponse, KeyRotateResponse -``` - -Methods: - -- client.zero_trust.access.keys.update(identifier, \*\*params) -> Optional -- client.zero_trust.access.keys.get(identifier) -> Optional -- client.zero_trust.access.keys.rotate(identifier) -> Optional - ### Logs #### AccessRequests @@ -5456,13 +5382,9 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.access.logs import AccessRequests, AccessRequestListResponse +from cloudflare.types.zero_trust.access.logs import AccessRequests ``` -Methods: - -- client.zero_trust.access.logs.access_requests.list(identifier) -> Optional - ### Users Types: @@ -5471,26 +5393,6 @@ Types: from cloudflare.types.zero_trust.access import AccessUser ``` -Methods: - -- client.zero_trust.access.users.list(identifier) -> SyncSinglePage[AccessUser] - -#### ActiveSessions - -Types: - -```python -from cloudflare.types.zero_trust.access.users import ( - ActiveSessionListResponse, - ActiveSessionGetResponse, -) -``` - -Methods: - -- client.zero_trust.access.users.active_sessions.list(id, \*, identifier) -> SyncSinglePage[ActiveSessionListResponse] -- client.zero_trust.access.users.active_sessions.get(nonce, \*, identifier, id) -> Optional - #### LastSeenIdentity Types: @@ -5499,58 +5401,22 @@ Types: from cloudflare.types.zero_trust.access.users import Identity ``` -Methods: - -- client.zero_trust.access.users.last_seen_identity.get(id, \*, identifier) -> Optional - -#### FailedLogins - -Types: - -```python -from cloudflare.types.zero_trust.access.users import FailedLoginListResponse -``` - -Methods: - -- client.zero_trust.access.users.failed_logins.list(id, \*, identifier) -> SyncSinglePage[FailedLoginListResponse] - ### CustomPages Types: ```python -from cloudflare.types.zero_trust.access import ( - CustomPage, - CustomPageWithoutHTML, - CustomPageDeleteResponse, -) +from cloudflare.types.zero_trust.access import CustomPage, CustomPageWithoutHTML ``` -Methods: - -- client.zero_trust.access.custom_pages.create(identifier, \*\*params) -> Optional -- client.zero_trust.access.custom_pages.update(uuid, \*, identifier, \*\*params) -> Optional -- client.zero_trust.access.custom_pages.list(identifier) -> SyncSinglePage[CustomPageWithoutHTML] -- client.zero_trust.access.custom_pages.delete(uuid, \*, identifier) -> Optional -- client.zero_trust.access.custom_pages.get(uuid, \*, identifier) -> Optional - ### Tags Types: ```python -from cloudflare.types.zero_trust.access import Tag, TagDeleteResponse +from cloudflare.types.zero_trust.access import Tag ``` -Methods: - -- client.zero_trust.access.tags.create(identifier, \*\*params) -> Optional -- client.zero_trust.access.tags.update(tag_name, \*, identifier, \*\*params) -> Optional -- client.zero_trust.access.tags.list(identifier) -> SyncSinglePage[Tag] -- client.zero_trust.access.tags.delete(name, \*, identifier) -> Optional -- client.zero_trust.access.tags.get(name, \*, identifier) -> Optional - ## DEX Types: @@ -7643,14 +7509,14 @@ from cloudflare.types.cloudforce_one import ( Methods: -- client.cloudforce_one.requests.create(account_identifier, \*\*params) -> Item -- client.cloudforce_one.requests.update(request_identifier, \*, account_identifier, \*\*params) -> Item +- client.cloudforce_one.requests.create(account_identifier, \*\*params) -> Optional +- client.cloudforce_one.requests.update(request_identifier, \*, account_identifier, \*\*params) -> Optional - client.cloudforce_one.requests.list(account_identifier, \*\*params) -> SyncV4PagePaginationArray[ListItem] - client.cloudforce_one.requests.delete(request_identifier, \*, account_identifier) -> RequestDeleteResponse -- client.cloudforce_one.requests.constants(account_identifier) -> RequestConstants -- client.cloudforce_one.requests.get(request_identifier, \*, account_identifier) -> Item -- client.cloudforce_one.requests.quota(account_identifier) -> Quota -- client.cloudforce_one.requests.types(account_identifier) -> RequestTypes +- client.cloudforce_one.requests.constants(account_identifier) -> Optional +- client.cloudforce_one.requests.get(request_identifier, \*, account_identifier) -> Optional +- client.cloudforce_one.requests.quota(account_identifier) -> Optional +- client.cloudforce_one.requests.types(account_identifier) -> Optional ### Message @@ -7666,10 +7532,10 @@ from cloudflare.types.cloudforce_one.requests import ( Methods: -- client.cloudforce_one.requests.message.create(request_identifier, \*, account_identifier, \*\*params) -> Message -- client.cloudforce_one.requests.message.update(message_identifer, \*, account_identifier, request_identifier, \*\*params) -> Message +- client.cloudforce_one.requests.message.create(request_identifier, \*, account_identifier, \*\*params) -> Optional +- client.cloudforce_one.requests.message.update(message_identifer, \*, account_identifier, request_identifier, \*\*params) -> Optional - client.cloudforce_one.requests.message.delete(message_identifer, \*, account_identifier, request_identifier) -> MessageDeleteResponse -- client.cloudforce_one.requests.message.get(request_identifier, \*, account_identifier, \*\*params) -> MessageGetResponse +- client.cloudforce_one.requests.message.get(request_identifier, \*, account_identifier, \*\*params) -> Optional ### Priority @@ -7686,11 +7552,11 @@ from cloudflare.types.cloudforce_one.requests import ( Methods: -- client.cloudforce_one.requests.priority.create(account_identifier, \*\*params) -> Priority -- client.cloudforce_one.requests.priority.update(priority_identifer, \*, account_identifier, \*\*params) -> Item +- client.cloudforce_one.requests.priority.create(account_identifier, \*\*params) -> Optional +- client.cloudforce_one.requests.priority.update(priority_identifer, \*, account_identifier, \*\*params) -> Optional - client.cloudforce_one.requests.priority.delete(priority_identifer, \*, account_identifier) -> PriorityDeleteResponse -- client.cloudforce_one.requests.priority.get(priority_identifer, \*, account_identifier) -> Item -- client.cloudforce_one.requests.priority.quota(account_identifier) -> Quota +- client.cloudforce_one.requests.priority.get(priority_identifer, \*, account_identifier) -> Optional +- client.cloudforce_one.requests.priority.quota(account_identifier) -> Optional # EventNotifications diff --git a/src/cloudflare/resources/cloudforce_one/requests/message.py b/src/cloudflare/resources/cloudforce_one/requests/message.py index eaea1a987b6..177e2c5b099 100644 --- a/src/cloudflare/resources/cloudforce_one/requests/message.py +++ b/src/cloudflare/resources/cloudforce_one/requests/message.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Union, cast +from typing import Type, Union, Optional, cast from datetime import datetime from typing_extensions import Literal @@ -54,7 +54,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Message: + ) -> Optional[Message]: """ Creating a request adds the request into the Cloudforce One queue for analysis. In addition to the content, a short title, type, priority, and releasability @@ -87,9 +87,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Message]._unwrapper, + post_parser=ResultWrapper[Optional[Message]]._unwrapper, ), - cast_to=cast(Type[Message], ResultWrapper[Message]), + cast_to=cast(Type[Optional[Message]], ResultWrapper[Message]), ) def update( @@ -109,7 +109,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Message: + ) -> Optional[Message]: """ Update a Request Message @@ -157,9 +157,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Message]._unwrapper, + post_parser=ResultWrapper[Optional[Message]]._unwrapper, ), - cast_to=cast(Type[Message], ResultWrapper[Message]), + cast_to=cast(Type[Optional[Message]], ResultWrapper[Message]), ) def delete( @@ -195,21 +195,12 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") if not request_identifier: raise ValueError(f"Expected a non-empty value for `request_identifier` but received {request_identifier!r}") - return cast( - MessageDeleteResponse, - self._delete( - f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message/{message_identifer}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[MessageDeleteResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[MessageDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message/{message_identifer}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=MessageDeleteResponse, ) def get( @@ -229,7 +220,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MessageGetResponse: + ) -> Optional[MessageGetResponse]: """ List Request Messages @@ -280,9 +271,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[MessageGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[MessageGetResponse]]._unwrapper, ), - cast_to=cast(Type[MessageGetResponse], ResultWrapper[MessageGetResponse]), + cast_to=cast(Type[Optional[MessageGetResponse]], ResultWrapper[MessageGetResponse]), ) @@ -307,7 +298,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Message: + ) -> Optional[Message]: """ Creating a request adds the request into the Cloudforce One queue for analysis. In addition to the content, a short title, type, priority, and releasability @@ -340,9 +331,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Message]._unwrapper, + post_parser=ResultWrapper[Optional[Message]]._unwrapper, ), - cast_to=cast(Type[Message], ResultWrapper[Message]), + cast_to=cast(Type[Optional[Message]], ResultWrapper[Message]), ) async def update( @@ -362,7 +353,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Message: + ) -> Optional[Message]: """ Update a Request Message @@ -410,9 +401,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Message]._unwrapper, + post_parser=ResultWrapper[Optional[Message]]._unwrapper, ), - cast_to=cast(Type[Message], ResultWrapper[Message]), + cast_to=cast(Type[Optional[Message]], ResultWrapper[Message]), ) async def delete( @@ -448,21 +439,12 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") if not request_identifier: raise ValueError(f"Expected a non-empty value for `request_identifier` but received {request_identifier!r}") - return cast( - MessageDeleteResponse, - await self._delete( - f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message/{message_identifer}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[MessageDeleteResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[MessageDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message/{message_identifer}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=MessageDeleteResponse, ) async def get( @@ -482,7 +464,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MessageGetResponse: + ) -> Optional[MessageGetResponse]: """ List Request Messages @@ -533,9 +515,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[MessageGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[MessageGetResponse]]._unwrapper, ), - cast_to=cast(Type[MessageGetResponse], ResultWrapper[MessageGetResponse]), + cast_to=cast(Type[Optional[MessageGetResponse]], ResultWrapper[MessageGetResponse]), ) diff --git a/src/cloudflare/resources/cloudforce_one/requests/priority.py b/src/cloudflare/resources/cloudforce_one/requests/priority.py index 0f1d6795a40..243e43f789b 100644 --- a/src/cloudflare/resources/cloudforce_one/requests/priority.py +++ b/src/cloudflare/resources/cloudforce_one/requests/priority.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, Type, cast +from typing import List, Type, Optional, cast from typing_extensions import Literal import httpx @@ -57,7 +57,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Priority: + ) -> Optional[Priority]: """ Create a New Priority Requirement @@ -98,9 +98,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Priority]._unwrapper, + post_parser=ResultWrapper[Optional[Priority]]._unwrapper, ), - cast_to=cast(Type[Priority], ResultWrapper[Priority]), + cast_to=cast(Type[Optional[Priority]], ResultWrapper[Priority]), ) def update( @@ -118,7 +118,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Item: + ) -> Optional[Item]: """ Update a Priority Intelligence Requirement @@ -163,9 +163,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) def delete( @@ -200,21 +200,12 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") if not priority_identifer: raise ValueError(f"Expected a non-empty value for `priority_identifer` but received {priority_identifer!r}") - return cast( - PriorityDeleteResponse, - self._delete( - f"/accounts/{account_identifier}/cloudforce-one/requests/priority/{priority_identifer}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[PriorityDeleteResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PriorityDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_identifier}/cloudforce-one/requests/priority/{priority_identifer}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=PriorityDeleteResponse, ) def get( @@ -228,7 +219,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Item: + ) -> Optional[Item]: """ Get a Priority Intelligence Requirement @@ -256,9 +247,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) def quota( @@ -271,7 +262,7 @@ def quota( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Quota: + ) -> Optional[Quota]: """ Get Priority Intelligence Requirement Quota @@ -295,9 +286,9 @@ def quota( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Quota]._unwrapper, + post_parser=ResultWrapper[Optional[Quota]]._unwrapper, ), - cast_to=cast(Type[Quota], ResultWrapper[Quota]), + cast_to=cast(Type[Optional[Quota]], ResultWrapper[Quota]), ) @@ -324,7 +315,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Priority: + ) -> Optional[Priority]: """ Create a New Priority Requirement @@ -365,9 +356,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Priority]._unwrapper, + post_parser=ResultWrapper[Optional[Priority]]._unwrapper, ), - cast_to=cast(Type[Priority], ResultWrapper[Priority]), + cast_to=cast(Type[Optional[Priority]], ResultWrapper[Priority]), ) async def update( @@ -385,7 +376,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Item: + ) -> Optional[Item]: """ Update a Priority Intelligence Requirement @@ -430,9 +421,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) async def delete( @@ -467,21 +458,12 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") if not priority_identifer: raise ValueError(f"Expected a non-empty value for `priority_identifer` but received {priority_identifer!r}") - return cast( - PriorityDeleteResponse, - await self._delete( - f"/accounts/{account_identifier}/cloudforce-one/requests/priority/{priority_identifer}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[PriorityDeleteResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PriorityDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_identifier}/cloudforce-one/requests/priority/{priority_identifer}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=PriorityDeleteResponse, ) async def get( @@ -495,7 +477,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Item: + ) -> Optional[Item]: """ Get a Priority Intelligence Requirement @@ -523,9 +505,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) async def quota( @@ -538,7 +520,7 @@ async def quota( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Quota: + ) -> Optional[Quota]: """ Get Priority Intelligence Requirement Quota @@ -562,9 +544,9 @@ async def quota( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Quota]._unwrapper, + post_parser=ResultWrapper[Optional[Quota]]._unwrapper, ), - cast_to=cast(Type[Quota], ResultWrapper[Quota]), + cast_to=cast(Type[Optional[Quota]], ResultWrapper[Quota]), ) diff --git a/src/cloudflare/resources/cloudforce_one/requests/requests.py b/src/cloudflare/resources/cloudforce_one/requests/requests.py index 61a739aaa7c..267e04595d6 100644 --- a/src/cloudflare/resources/cloudforce_one/requests/requests.py +++ b/src/cloudflare/resources/cloudforce_one/requests/requests.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Union, cast +from typing import Type, Union, Optional, cast from datetime import datetime from typing_extensions import Literal @@ -86,7 +86,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Item: + ) -> Optional[Item]: """ Creating a request adds the request into the Cloudforce One queue for analysis. In addition to the content, a short title, type, priority, and releasability @@ -132,9 +132,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) def update( @@ -153,7 +153,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Item: + ) -> Optional[Item]: """Updating a request alters the request in the Cloudforce One queue. This API may @@ -204,9 +204,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) def list( @@ -323,21 +323,12 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") if not request_identifier: raise ValueError(f"Expected a non-empty value for `request_identifier` but received {request_identifier!r}") - return cast( - RequestDeleteResponse, - self._delete( - f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[RequestDeleteResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[RequestDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=RequestDeleteResponse, ) def constants( @@ -350,7 +341,7 @@ def constants( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RequestConstants: + ) -> Optional[RequestConstants]: """ Get Request Priority, Status, and TLP constants @@ -374,9 +365,9 @@ def constants( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RequestConstants]._unwrapper, + post_parser=ResultWrapper[Optional[RequestConstants]]._unwrapper, ), - cast_to=cast(Type[RequestConstants], ResultWrapper[RequestConstants]), + cast_to=cast(Type[Optional[RequestConstants]], ResultWrapper[RequestConstants]), ) def get( @@ -390,7 +381,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Item: + ) -> Optional[Item]: """ Get a Request @@ -418,9 +409,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) def quota( @@ -433,7 +424,7 @@ def quota( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Quota: + ) -> Optional[Quota]: """ Get Request Quota @@ -457,9 +448,9 @@ def quota( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Quota]._unwrapper, + post_parser=ResultWrapper[Optional[Quota]]._unwrapper, ), - cast_to=cast(Type[Quota], ResultWrapper[Quota]), + cast_to=cast(Type[Optional[Quota]], ResultWrapper[Quota]), ) def types( @@ -472,7 +463,7 @@ def types( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RequestTypes: + ) -> Optional[RequestTypes]: """ Get Request Types @@ -496,9 +487,9 @@ def types( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RequestTypes]._unwrapper, + post_parser=ResultWrapper[Optional[RequestTypes]]._unwrapper, ), - cast_to=cast(Type[RequestTypes], ResultWrapper[RequestTypes]), + cast_to=cast(Type[Optional[RequestTypes]], ResultWrapper[RequestTypes]), ) @@ -534,7 +525,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Item: + ) -> Optional[Item]: """ Creating a request adds the request into the Cloudforce One queue for analysis. In addition to the content, a short title, type, priority, and releasability @@ -580,9 +571,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) async def update( @@ -601,7 +592,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Item: + ) -> Optional[Item]: """Updating a request alters the request in the Cloudforce One queue. This API may @@ -652,9 +643,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) def list( @@ -771,21 +762,12 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") if not request_identifier: raise ValueError(f"Expected a non-empty value for `request_identifier` but received {request_identifier!r}") - return cast( - RequestDeleteResponse, - await self._delete( - f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[RequestDeleteResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[RequestDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=RequestDeleteResponse, ) async def constants( @@ -798,7 +780,7 @@ async def constants( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RequestConstants: + ) -> Optional[RequestConstants]: """ Get Request Priority, Status, and TLP constants @@ -822,9 +804,9 @@ async def constants( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RequestConstants]._unwrapper, + post_parser=ResultWrapper[Optional[RequestConstants]]._unwrapper, ), - cast_to=cast(Type[RequestConstants], ResultWrapper[RequestConstants]), + cast_to=cast(Type[Optional[RequestConstants]], ResultWrapper[RequestConstants]), ) async def get( @@ -838,7 +820,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Item: + ) -> Optional[Item]: """ Get a Request @@ -866,9 +848,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) async def quota( @@ -881,7 +863,7 @@ async def quota( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Quota: + ) -> Optional[Quota]: """ Get Request Quota @@ -905,9 +887,9 @@ async def quota( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Quota]._unwrapper, + post_parser=ResultWrapper[Optional[Quota]]._unwrapper, ), - cast_to=cast(Type[Quota], ResultWrapper[Quota]), + cast_to=cast(Type[Optional[Quota]], ResultWrapper[Quota]), ) async def types( @@ -920,7 +902,7 @@ async def types( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RequestTypes: + ) -> Optional[RequestTypes]: """ Get Request Types @@ -944,9 +926,9 @@ async def types( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RequestTypes]._unwrapper, + post_parser=ResultWrapper[Optional[RequestTypes]]._unwrapper, ), - cast_to=cast(Type[RequestTypes], ResultWrapper[RequestTypes]), + cast_to=cast(Type[Optional[RequestTypes]], ResultWrapper[RequestTypes]), ) diff --git a/src/cloudflare/resources/intel/whois.py b/src/cloudflare/resources/intel/whois.py index 050da13d396..d8f2efe389c 100644 --- a/src/cloudflare/resources/intel/whois.py +++ b/src/cloudflare/resources/intel/whois.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -49,7 +49,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WhoisGetResponse: + ) -> Optional[WhoisGetResponse]: """ Get WHOIS Record @@ -74,9 +74,9 @@ def get( extra_body=extra_body, timeout=timeout, query=maybe_transform({"domain": domain}, whois_get_params.WhoisGetParams), - post_parser=ResultWrapper[WhoisGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[WhoisGetResponse]]._unwrapper, ), - cast_to=cast(Type[WhoisGetResponse], ResultWrapper[WhoisGetResponse]), + cast_to=cast(Type[Optional[WhoisGetResponse]], ResultWrapper[WhoisGetResponse]), ) @@ -100,7 +100,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WhoisGetResponse: + ) -> Optional[WhoisGetResponse]: """ Get WHOIS Record @@ -125,9 +125,9 @@ async def get( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"domain": domain}, whois_get_params.WhoisGetParams), - post_parser=ResultWrapper[WhoisGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[WhoisGetResponse]]._unwrapper, ), - cast_to=cast(Type[WhoisGetResponse], ResultWrapper[WhoisGetResponse]), + cast_to=cast(Type[Optional[WhoisGetResponse]], ResultWrapper[WhoisGetResponse]), ) diff --git a/src/cloudflare/resources/rulesets/rules.py b/src/cloudflare/resources/rulesets/rules.py index ecf569b9efa..bd7c415a47b 100644 --- a/src/cloudflare/resources/rulesets/rules.py +++ b/src/cloudflare/resources/rulesets/rules.py @@ -1003,126 +1003,6 @@ def create( """ ... - @overload - def create( - self, - ruleset_id: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - id: str | NotGiven = NOT_GIVEN, - action: Literal["ddos_dynamic"] | NotGiven = NOT_GIVEN, - action_parameters: object | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expression: str | NotGiven = NOT_GIVEN, - logging: LoggingParam | NotGiven = NOT_GIVEN, - ref: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleCreateResponse: - """Adds a new rule to an account or zone ruleset. - - The rule will be added to the end - of the existing list of rules in the ruleset by default. - - Args: - ruleset_id: The unique ID of the ruleset. - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - id: The unique ID of the rule. - - action: The action to perform when the rule matches. - - action_parameters: The parameters configuring the rule's action. - - description: An informative description of the rule. - - enabled: Whether the rule should be executed. - - expression: The expression defining which traffic will match the rule. - - logging: An object configuring the rule's logging behavior. - - ref: The reference of the rule (the rule ID by default). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def create( - self, - ruleset_id: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - id: str | NotGiven = NOT_GIVEN, - action: Literal["force_connection_close"] | NotGiven = NOT_GIVEN, - action_parameters: object | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expression: str | NotGiven = NOT_GIVEN, - logging: LoggingParam | NotGiven = NOT_GIVEN, - ref: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleCreateResponse: - """Adds a new rule to an account or zone ruleset. - - The rule will be added to the end - of the existing list of rules in the ruleset by default. - - Args: - ruleset_id: The unique ID of the ruleset. - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - id: The unique ID of the rule. - - action: The action to perform when the rule matches. - - action_parameters: The parameters configuring the rule's action. - - description: An informative description of the rule. - - enabled: Whether the rule should be executed. - - expression: The expression defining which traffic will match the rule. - - logging: An object configuring the rule's logging behavior. - - ref: The reference of the rule (the rule ID by default). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - def create( self, ruleset_id: str, @@ -1146,8 +1026,6 @@ def create( | Literal["skip"] | Literal["set_cache_settings"] | Literal["log_custom_field"] - | Literal["ddos_dynamic"] - | Literal["force_connection_close"] | NotGiven = NOT_GIVEN, action_parameters: rule_create_params.BlockRuleActionParameters | object @@ -2252,128 +2130,6 @@ def edit( """ ... - @overload - def edit( - self, - rule_id: str, - *, - ruleset_id: str, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - id: str | NotGiven = NOT_GIVEN, - action: Literal["ddos_dynamic"] | NotGiven = NOT_GIVEN, - action_parameters: object | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expression: str | NotGiven = NOT_GIVEN, - logging: LoggingParam | NotGiven = NOT_GIVEN, - ref: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleEditResponse: - """ - Updates an existing rule in an account or zone ruleset. - - Args: - ruleset_id: The unique ID of the ruleset. - - rule_id: The unique ID of the rule. - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - id: The unique ID of the rule. - - action: The action to perform when the rule matches. - - action_parameters: The parameters configuring the rule's action. - - description: An informative description of the rule. - - enabled: Whether the rule should be executed. - - expression: The expression defining which traffic will match the rule. - - logging: An object configuring the rule's logging behavior. - - ref: The reference of the rule (the rule ID by default). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def edit( - self, - rule_id: str, - *, - ruleset_id: str, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - id: str | NotGiven = NOT_GIVEN, - action: Literal["force_connection_close"] | NotGiven = NOT_GIVEN, - action_parameters: object | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expression: str | NotGiven = NOT_GIVEN, - logging: LoggingParam | NotGiven = NOT_GIVEN, - ref: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleEditResponse: - """ - Updates an existing rule in an account or zone ruleset. - - Args: - ruleset_id: The unique ID of the ruleset. - - rule_id: The unique ID of the rule. - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - id: The unique ID of the rule. - - action: The action to perform when the rule matches. - - action_parameters: The parameters configuring the rule's action. - - description: An informative description of the rule. - - enabled: Whether the rule should be executed. - - expression: The expression defining which traffic will match the rule. - - logging: An object configuring the rule's logging behavior. - - ref: The reference of the rule (the rule ID by default). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - @required_args(["ruleset_id"]) def edit( self, @@ -2399,8 +2155,6 @@ def edit( | Literal["skip"] | Literal["set_cache_settings"] | Literal["log_custom_field"] - | Literal["ddos_dynamic"] - | Literal["force_connection_close"] | NotGiven = NOT_GIVEN, action_parameters: rule_edit_params.BlockRuleActionParameters | object @@ -3439,126 +3193,6 @@ async def create( """ ... - @overload - async def create( - self, - ruleset_id: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - id: str | NotGiven = NOT_GIVEN, - action: Literal["ddos_dynamic"] | NotGiven = NOT_GIVEN, - action_parameters: object | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expression: str | NotGiven = NOT_GIVEN, - logging: LoggingParam | NotGiven = NOT_GIVEN, - ref: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleCreateResponse: - """Adds a new rule to an account or zone ruleset. - - The rule will be added to the end - of the existing list of rules in the ruleset by default. - - Args: - ruleset_id: The unique ID of the ruleset. - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - id: The unique ID of the rule. - - action: The action to perform when the rule matches. - - action_parameters: The parameters configuring the rule's action. - - description: An informative description of the rule. - - enabled: Whether the rule should be executed. - - expression: The expression defining which traffic will match the rule. - - logging: An object configuring the rule's logging behavior. - - ref: The reference of the rule (the rule ID by default). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - ruleset_id: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - id: str | NotGiven = NOT_GIVEN, - action: Literal["force_connection_close"] | NotGiven = NOT_GIVEN, - action_parameters: object | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expression: str | NotGiven = NOT_GIVEN, - logging: LoggingParam | NotGiven = NOT_GIVEN, - ref: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleCreateResponse: - """Adds a new rule to an account or zone ruleset. - - The rule will be added to the end - of the existing list of rules in the ruleset by default. - - Args: - ruleset_id: The unique ID of the ruleset. - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - id: The unique ID of the rule. - - action: The action to perform when the rule matches. - - action_parameters: The parameters configuring the rule's action. - - description: An informative description of the rule. - - enabled: Whether the rule should be executed. - - expression: The expression defining which traffic will match the rule. - - logging: An object configuring the rule's logging behavior. - - ref: The reference of the rule (the rule ID by default). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - async def create( self, ruleset_id: str, @@ -3582,8 +3216,6 @@ async def create( | Literal["skip"] | Literal["set_cache_settings"] | Literal["log_custom_field"] - | Literal["ddos_dynamic"] - | Literal["force_connection_close"] | NotGiven = NOT_GIVEN, action_parameters: rule_create_params.BlockRuleActionParameters | object @@ -4688,128 +4320,6 @@ async def edit( """ ... - @overload - async def edit( - self, - rule_id: str, - *, - ruleset_id: str, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - id: str | NotGiven = NOT_GIVEN, - action: Literal["ddos_dynamic"] | NotGiven = NOT_GIVEN, - action_parameters: object | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expression: str | NotGiven = NOT_GIVEN, - logging: LoggingParam | NotGiven = NOT_GIVEN, - ref: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleEditResponse: - """ - Updates an existing rule in an account or zone ruleset. - - Args: - ruleset_id: The unique ID of the ruleset. - - rule_id: The unique ID of the rule. - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - id: The unique ID of the rule. - - action: The action to perform when the rule matches. - - action_parameters: The parameters configuring the rule's action. - - description: An informative description of the rule. - - enabled: Whether the rule should be executed. - - expression: The expression defining which traffic will match the rule. - - logging: An object configuring the rule's logging behavior. - - ref: The reference of the rule (the rule ID by default). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def edit( - self, - rule_id: str, - *, - ruleset_id: str, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - id: str | NotGiven = NOT_GIVEN, - action: Literal["force_connection_close"] | NotGiven = NOT_GIVEN, - action_parameters: object | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expression: str | NotGiven = NOT_GIVEN, - logging: LoggingParam | NotGiven = NOT_GIVEN, - ref: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleEditResponse: - """ - Updates an existing rule in an account or zone ruleset. - - Args: - ruleset_id: The unique ID of the ruleset. - - rule_id: The unique ID of the rule. - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - id: The unique ID of the rule. - - action: The action to perform when the rule matches. - - action_parameters: The parameters configuring the rule's action. - - description: An informative description of the rule. - - enabled: Whether the rule should be executed. - - expression: The expression defining which traffic will match the rule. - - logging: An object configuring the rule's logging behavior. - - ref: The reference of the rule (the rule ID by default). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - @required_args(["ruleset_id"]) async def edit( self, @@ -4835,8 +4345,6 @@ async def edit( | Literal["skip"] | Literal["set_cache_settings"] | Literal["log_custom_field"] - | Literal["ddos_dynamic"] - | Literal["force_connection_close"] | NotGiven = NOT_GIVEN, action_parameters: rule_edit_params.BlockRuleActionParameters | object diff --git a/src/cloudflare/resources/zero_trust/__init__.py b/src/cloudflare/resources/zero_trust/__init__.py index 7703df18c9b..0eac27aeedb 100644 --- a/src/cloudflare/resources/zero_trust/__init__.py +++ b/src/cloudflare/resources/zero_trust/__init__.py @@ -16,14 +16,6 @@ DLPResourceWithStreamingResponse, AsyncDLPResourceWithStreamingResponse, ) -from .seats import ( - SeatsResource, - AsyncSeatsResource, - SeatsResourceWithRawResponse, - AsyncSeatsResourceWithRawResponse, - SeatsResourceWithStreamingResponse, - AsyncSeatsResourceWithStreamingResponse, -) from .access import ( AccessResource, AsyncAccessResource, @@ -124,12 +116,6 @@ "AsyncOrganizationsResourceWithRawResponse", "OrganizationsResourceWithStreamingResponse", "AsyncOrganizationsResourceWithStreamingResponse", - "SeatsResource", - "AsyncSeatsResource", - "SeatsResourceWithRawResponse", - "AsyncSeatsResourceWithRawResponse", - "SeatsResourceWithStreamingResponse", - "AsyncSeatsResourceWithStreamingResponse", "AccessResource", "AsyncAccessResource", "AccessResourceWithRawResponse", diff --git a/src/cloudflare/resources/zero_trust/access/__init__.py b/src/cloudflare/resources/zero_trust/access/__init__.py index b34af407a86..7f6771c4683 100644 --- a/src/cloudflare/resources/zero_trust/access/__init__.py +++ b/src/cloudflare/resources/zero_trust/access/__init__.py @@ -1,37 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .keys import ( - KeysResource, - AsyncKeysResource, - KeysResourceWithRawResponse, - AsyncKeysResourceWithRawResponse, - KeysResourceWithStreamingResponse, - AsyncKeysResourceWithStreamingResponse, -) -from .logs import ( - LogsResource, - AsyncLogsResource, - LogsResourceWithRawResponse, - AsyncLogsResourceWithRawResponse, - LogsResourceWithStreamingResponse, - AsyncLogsResourceWithStreamingResponse, -) -from .tags import ( - TagsResource, - AsyncTagsResource, - TagsResourceWithRawResponse, - AsyncTagsResourceWithRawResponse, - TagsResourceWithStreamingResponse, - AsyncTagsResourceWithStreamingResponse, -) -from .users import ( - UsersResource, - AsyncUsersResource, - UsersResourceWithRawResponse, - AsyncUsersResourceWithRawResponse, - UsersResourceWithStreamingResponse, - AsyncUsersResourceWithStreamingResponse, -) from .access import ( AccessResource, AsyncAccessResource, @@ -48,14 +16,6 @@ GroupsResourceWithStreamingResponse, AsyncGroupsResourceWithStreamingResponse, ) -from .bookmarks import ( - BookmarksResource, - AsyncBookmarksResource, - BookmarksResourceWithRawResponse, - AsyncBookmarksResourceWithRawResponse, - BookmarksResourceWithStreamingResponse, - AsyncBookmarksResourceWithStreamingResponse, -) from .applications import ( ApplicationsResource, AsyncApplicationsResource, @@ -72,14 +32,6 @@ CertificatesResourceWithStreamingResponse, AsyncCertificatesResourceWithStreamingResponse, ) -from .custom_pages import ( - CustomPagesResource, - AsyncCustomPagesResource, - CustomPagesResourceWithRawResponse, - AsyncCustomPagesResourceWithRawResponse, - CustomPagesResourceWithStreamingResponse, - AsyncCustomPagesResourceWithStreamingResponse, -) from .service_tokens import ( ServiceTokensResource, AsyncServiceTokensResource, @@ -114,42 +66,6 @@ "AsyncServiceTokensResourceWithRawResponse", "ServiceTokensResourceWithStreamingResponse", "AsyncServiceTokensResourceWithStreamingResponse", - "BookmarksResource", - "AsyncBookmarksResource", - "BookmarksResourceWithRawResponse", - "AsyncBookmarksResourceWithRawResponse", - "BookmarksResourceWithStreamingResponse", - "AsyncBookmarksResourceWithStreamingResponse", - "KeysResource", - "AsyncKeysResource", - "KeysResourceWithRawResponse", - "AsyncKeysResourceWithRawResponse", - "KeysResourceWithStreamingResponse", - "AsyncKeysResourceWithStreamingResponse", - "LogsResource", - "AsyncLogsResource", - "LogsResourceWithRawResponse", - "AsyncLogsResourceWithRawResponse", - "LogsResourceWithStreamingResponse", - "AsyncLogsResourceWithStreamingResponse", - "UsersResource", - "AsyncUsersResource", - "UsersResourceWithRawResponse", - "AsyncUsersResourceWithRawResponse", - "UsersResourceWithStreamingResponse", - "AsyncUsersResourceWithStreamingResponse", - "CustomPagesResource", - "AsyncCustomPagesResource", - "CustomPagesResourceWithRawResponse", - "AsyncCustomPagesResourceWithRawResponse", - "CustomPagesResourceWithStreamingResponse", - "AsyncCustomPagesResourceWithStreamingResponse", - "TagsResource", - "AsyncTagsResource", - "TagsResourceWithRawResponse", - "AsyncTagsResourceWithRawResponse", - "TagsResourceWithStreamingResponse", - "AsyncTagsResourceWithStreamingResponse", "AccessResource", "AsyncAccessResource", "AccessResourceWithRawResponse", diff --git a/src/cloudflare/resources/zero_trust/access/access.py b/src/cloudflare/resources/zero_trust/access/access.py index 6707c0f7745..f9f03534570 100644 --- a/src/cloudflare/resources/zero_trust/access/access.py +++ b/src/cloudflare/resources/zero_trust/access/access.py @@ -2,38 +2,6 @@ from __future__ import annotations -from .keys import ( - KeysResource, - AsyncKeysResource, - KeysResourceWithRawResponse, - AsyncKeysResourceWithRawResponse, - KeysResourceWithStreamingResponse, - AsyncKeysResourceWithStreamingResponse, -) -from .logs import ( - LogsResource, - AsyncLogsResource, - LogsResourceWithRawResponse, - AsyncLogsResourceWithRawResponse, - LogsResourceWithStreamingResponse, - AsyncLogsResourceWithStreamingResponse, -) -from .tags import ( - TagsResource, - AsyncTagsResource, - TagsResourceWithRawResponse, - AsyncTagsResourceWithRawResponse, - TagsResourceWithStreamingResponse, - AsyncTagsResourceWithStreamingResponse, -) -from .users import ( - UsersResource, - AsyncUsersResource, - UsersResourceWithRawResponse, - AsyncUsersResourceWithRawResponse, - UsersResourceWithStreamingResponse, - AsyncUsersResourceWithStreamingResponse, -) from .groups import ( GroupsResource, AsyncGroupsResource, @@ -42,17 +10,7 @@ GroupsResourceWithStreamingResponse, AsyncGroupsResourceWithStreamingResponse, ) -from .bookmarks import ( - BookmarksResource, - AsyncBookmarksResource, - BookmarksResourceWithRawResponse, - AsyncBookmarksResourceWithRawResponse, - BookmarksResourceWithStreamingResponse, - AsyncBookmarksResourceWithStreamingResponse, -) -from .logs.logs import LogsResource, AsyncLogsResource from ...._compat import cached_property -from .users.users import UsersResource, AsyncUsersResource from ...._resource import SyncAPIResource, AsyncAPIResource from .applications import ( ApplicationsResource, @@ -70,14 +28,6 @@ CertificatesResourceWithStreamingResponse, AsyncCertificatesResourceWithStreamingResponse, ) -from .custom_pages import ( - CustomPagesResource, - AsyncCustomPagesResource, - CustomPagesResourceWithRawResponse, - AsyncCustomPagesResourceWithRawResponse, - CustomPagesResourceWithStreamingResponse, - AsyncCustomPagesResourceWithStreamingResponse, -) from .service_tokens import ( ServiceTokensResource, AsyncServiceTokensResource, @@ -109,30 +59,6 @@ def groups(self) -> GroupsResource: def service_tokens(self) -> ServiceTokensResource: return ServiceTokensResource(self._client) - @cached_property - def bookmarks(self) -> BookmarksResource: - return BookmarksResource(self._client) - - @cached_property - def keys(self) -> KeysResource: - return KeysResource(self._client) - - @cached_property - def logs(self) -> LogsResource: - return LogsResource(self._client) - - @cached_property - def users(self) -> UsersResource: - return UsersResource(self._client) - - @cached_property - def custom_pages(self) -> CustomPagesResource: - return CustomPagesResource(self._client) - - @cached_property - def tags(self) -> TagsResource: - return TagsResource(self._client) - @cached_property def with_raw_response(self) -> AccessResourceWithRawResponse: return AccessResourceWithRawResponse(self) @@ -159,30 +85,6 @@ def groups(self) -> AsyncGroupsResource: def service_tokens(self) -> AsyncServiceTokensResource: return AsyncServiceTokensResource(self._client) - @cached_property - def bookmarks(self) -> AsyncBookmarksResource: - return AsyncBookmarksResource(self._client) - - @cached_property - def keys(self) -> AsyncKeysResource: - return AsyncKeysResource(self._client) - - @cached_property - def logs(self) -> AsyncLogsResource: - return AsyncLogsResource(self._client) - - @cached_property - def users(self) -> AsyncUsersResource: - return AsyncUsersResource(self._client) - - @cached_property - def custom_pages(self) -> AsyncCustomPagesResource: - return AsyncCustomPagesResource(self._client) - - @cached_property - def tags(self) -> AsyncTagsResource: - return AsyncTagsResource(self._client) - @cached_property def with_raw_response(self) -> AsyncAccessResourceWithRawResponse: return AsyncAccessResourceWithRawResponse(self) @@ -212,30 +114,6 @@ def groups(self) -> GroupsResourceWithRawResponse: def service_tokens(self) -> ServiceTokensResourceWithRawResponse: return ServiceTokensResourceWithRawResponse(self._access.service_tokens) - @cached_property - def bookmarks(self) -> BookmarksResourceWithRawResponse: - return BookmarksResourceWithRawResponse(self._access.bookmarks) - - @cached_property - def keys(self) -> KeysResourceWithRawResponse: - return KeysResourceWithRawResponse(self._access.keys) - - @cached_property - def logs(self) -> LogsResourceWithRawResponse: - return LogsResourceWithRawResponse(self._access.logs) - - @cached_property - def users(self) -> UsersResourceWithRawResponse: - return UsersResourceWithRawResponse(self._access.users) - - @cached_property - def custom_pages(self) -> CustomPagesResourceWithRawResponse: - return CustomPagesResourceWithRawResponse(self._access.custom_pages) - - @cached_property - def tags(self) -> TagsResourceWithRawResponse: - return TagsResourceWithRawResponse(self._access.tags) - class AsyncAccessResourceWithRawResponse: def __init__(self, access: AsyncAccessResource) -> None: @@ -257,30 +135,6 @@ def groups(self) -> AsyncGroupsResourceWithRawResponse: def service_tokens(self) -> AsyncServiceTokensResourceWithRawResponse: return AsyncServiceTokensResourceWithRawResponse(self._access.service_tokens) - @cached_property - def bookmarks(self) -> AsyncBookmarksResourceWithRawResponse: - return AsyncBookmarksResourceWithRawResponse(self._access.bookmarks) - - @cached_property - def keys(self) -> AsyncKeysResourceWithRawResponse: - return AsyncKeysResourceWithRawResponse(self._access.keys) - - @cached_property - def logs(self) -> AsyncLogsResourceWithRawResponse: - return AsyncLogsResourceWithRawResponse(self._access.logs) - - @cached_property - def users(self) -> AsyncUsersResourceWithRawResponse: - return AsyncUsersResourceWithRawResponse(self._access.users) - - @cached_property - def custom_pages(self) -> AsyncCustomPagesResourceWithRawResponse: - return AsyncCustomPagesResourceWithRawResponse(self._access.custom_pages) - - @cached_property - def tags(self) -> AsyncTagsResourceWithRawResponse: - return AsyncTagsResourceWithRawResponse(self._access.tags) - class AccessResourceWithStreamingResponse: def __init__(self, access: AccessResource) -> None: @@ -302,30 +156,6 @@ def groups(self) -> GroupsResourceWithStreamingResponse: def service_tokens(self) -> ServiceTokensResourceWithStreamingResponse: return ServiceTokensResourceWithStreamingResponse(self._access.service_tokens) - @cached_property - def bookmarks(self) -> BookmarksResourceWithStreamingResponse: - return BookmarksResourceWithStreamingResponse(self._access.bookmarks) - - @cached_property - def keys(self) -> KeysResourceWithStreamingResponse: - return KeysResourceWithStreamingResponse(self._access.keys) - - @cached_property - def logs(self) -> LogsResourceWithStreamingResponse: - return LogsResourceWithStreamingResponse(self._access.logs) - - @cached_property - def users(self) -> UsersResourceWithStreamingResponse: - return UsersResourceWithStreamingResponse(self._access.users) - - @cached_property - def custom_pages(self) -> CustomPagesResourceWithStreamingResponse: - return CustomPagesResourceWithStreamingResponse(self._access.custom_pages) - - @cached_property - def tags(self) -> TagsResourceWithStreamingResponse: - return TagsResourceWithStreamingResponse(self._access.tags) - class AsyncAccessResourceWithStreamingResponse: def __init__(self, access: AsyncAccessResource) -> None: @@ -346,27 +176,3 @@ def groups(self) -> AsyncGroupsResourceWithStreamingResponse: @cached_property def service_tokens(self) -> AsyncServiceTokensResourceWithStreamingResponse: return AsyncServiceTokensResourceWithStreamingResponse(self._access.service_tokens) - - @cached_property - def bookmarks(self) -> AsyncBookmarksResourceWithStreamingResponse: - return AsyncBookmarksResourceWithStreamingResponse(self._access.bookmarks) - - @cached_property - def keys(self) -> AsyncKeysResourceWithStreamingResponse: - return AsyncKeysResourceWithStreamingResponse(self._access.keys) - - @cached_property - def logs(self) -> AsyncLogsResourceWithStreamingResponse: - return AsyncLogsResourceWithStreamingResponse(self._access.logs) - - @cached_property - def users(self) -> AsyncUsersResourceWithStreamingResponse: - return AsyncUsersResourceWithStreamingResponse(self._access.users) - - @cached_property - def custom_pages(self) -> AsyncCustomPagesResourceWithStreamingResponse: - return AsyncCustomPagesResourceWithStreamingResponse(self._access.custom_pages) - - @cached_property - def tags(self) -> AsyncTagsResourceWithStreamingResponse: - return AsyncTagsResourceWithStreamingResponse(self._access.tags) diff --git a/src/cloudflare/resources/zero_trust/access/applications/__init__.py b/src/cloudflare/resources/zero_trust/access/applications/__init__.py index 8b6f39c4dd8..f4d00c67e8c 100644 --- a/src/cloudflare/resources/zero_trust/access/applications/__init__.py +++ b/src/cloudflare/resources/zero_trust/access/applications/__init__.py @@ -8,14 +8,6 @@ CAsResourceWithStreamingResponse, AsyncCAsResourceWithStreamingResponse, ) -from .policies import ( - PoliciesResource, - AsyncPoliciesResource, - PoliciesResourceWithRawResponse, - AsyncPoliciesResourceWithRawResponse, - PoliciesResourceWithStreamingResponse, - AsyncPoliciesResourceWithStreamingResponse, -) from .applications import ( ApplicationsResource, AsyncApplicationsResource, @@ -46,12 +38,6 @@ "AsyncUserPolicyChecksResourceWithRawResponse", "UserPolicyChecksResourceWithStreamingResponse", "AsyncUserPolicyChecksResourceWithStreamingResponse", - "PoliciesResource", - "AsyncPoliciesResource", - "PoliciesResourceWithRawResponse", - "AsyncPoliciesResourceWithRawResponse", - "PoliciesResourceWithStreamingResponse", - "AsyncPoliciesResourceWithStreamingResponse", "ApplicationsResource", "AsyncApplicationsResource", "ApplicationsResourceWithRawResponse", diff --git a/src/cloudflare/resources/zero_trust/access/applications/applications.py b/src/cloudflare/resources/zero_trust/access/applications/applications.py index cb837d07265..7cb75fe8ecc 100644 --- a/src/cloudflare/resources/zero_trust/access/applications/applications.py +++ b/src/cloudflare/resources/zero_trust/access/applications/applications.py @@ -14,14 +14,6 @@ CAsResourceWithStreamingResponse, AsyncCAsResourceWithStreamingResponse, ) -from .policies import ( - PoliciesResource, - AsyncPoliciesResource, - PoliciesResourceWithRawResponse, - AsyncPoliciesResourceWithRawResponse, - PoliciesResourceWithStreamingResponse, - AsyncPoliciesResourceWithStreamingResponse, -) from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ....._utils import ( maybe_transform, @@ -77,10 +69,6 @@ def cas(self) -> CAsResource: def user_policy_checks(self) -> UserPolicyChecksResource: return UserPolicyChecksResource(self._client) - @cached_property - def policies(self) -> PoliciesResource: - return PoliciesResource(self._client) - @cached_property def with_raw_response(self) -> ApplicationsResourceWithRawResponse: return ApplicationsResourceWithRawResponse(self) @@ -1863,10 +1851,6 @@ def cas(self) -> AsyncCAsResource: def user_policy_checks(self) -> AsyncUserPolicyChecksResource: return AsyncUserPolicyChecksResource(self._client) - @cached_property - def policies(self) -> AsyncPoliciesResource: - return AsyncPoliciesResource(self._client) - @cached_property def with_raw_response(self) -> AsyncApplicationsResourceWithRawResponse: return AsyncApplicationsResourceWithRawResponse(self) @@ -3671,10 +3655,6 @@ def cas(self) -> CAsResourceWithRawResponse: def user_policy_checks(self) -> UserPolicyChecksResourceWithRawResponse: return UserPolicyChecksResourceWithRawResponse(self._applications.user_policy_checks) - @cached_property - def policies(self) -> PoliciesResourceWithRawResponse: - return PoliciesResourceWithRawResponse(self._applications.policies) - class AsyncApplicationsResourceWithRawResponse: def __init__(self, applications: AsyncApplicationsResource) -> None: @@ -3707,10 +3687,6 @@ def cas(self) -> AsyncCAsResourceWithRawResponse: def user_policy_checks(self) -> AsyncUserPolicyChecksResourceWithRawResponse: return AsyncUserPolicyChecksResourceWithRawResponse(self._applications.user_policy_checks) - @cached_property - def policies(self) -> AsyncPoliciesResourceWithRawResponse: - return AsyncPoliciesResourceWithRawResponse(self._applications.policies) - class ApplicationsResourceWithStreamingResponse: def __init__(self, applications: ApplicationsResource) -> None: @@ -3743,10 +3719,6 @@ def cas(self) -> CAsResourceWithStreamingResponse: def user_policy_checks(self) -> UserPolicyChecksResourceWithStreamingResponse: return UserPolicyChecksResourceWithStreamingResponse(self._applications.user_policy_checks) - @cached_property - def policies(self) -> PoliciesResourceWithStreamingResponse: - return PoliciesResourceWithStreamingResponse(self._applications.policies) - class AsyncApplicationsResourceWithStreamingResponse: def __init__(self, applications: AsyncApplicationsResource) -> None: @@ -3778,7 +3750,3 @@ def cas(self) -> AsyncCAsResourceWithStreamingResponse: @cached_property def user_policy_checks(self) -> AsyncUserPolicyChecksResourceWithStreamingResponse: return AsyncUserPolicyChecksResourceWithStreamingResponse(self._applications.user_policy_checks) - - @cached_property - def policies(self) -> AsyncPoliciesResourceWithStreamingResponse: - return AsyncPoliciesResourceWithStreamingResponse(self._applications.policies) diff --git a/src/cloudflare/resources/zero_trust/access/applications/cas.py b/src/cloudflare/resources/zero_trust/access/applications/cas.py index 36c6f5f0483..29133e3028c 100644 --- a/src/cloudflare/resources/zero_trust/access/applications/cas.py +++ b/src/cloudflare/resources/zero_trust/access/applications/cas.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast - import httpx from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven @@ -15,16 +13,12 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....._wrappers import ResultWrapper from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( AsyncPaginator, make_request_options, ) from .....types.zero_trust.access.applications.ca import CA -from .....types.zero_trust.access.applications.ca_get_response import CAGetResponse -from .....types.zero_trust.access.applications.ca_create_response import CACreateResponse -from .....types.zero_trust.access.applications.ca_delete_response import CADeleteResponse __all__ = ["CAsResource", "AsyncCAsResource"] @@ -38,68 +32,6 @@ def with_raw_response(self) -> CAsResourceWithRawResponse: def with_streaming_response(self) -> CAsResourceWithStreamingResponse: return CAsResourceWithStreamingResponse(self) - def create( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CACreateResponse]: - """ - Generates a new short-lived certificate CA and public key. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return cast( - Optional[CACreateResponse], - self._post( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/ca", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CACreateResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[CACreateResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - def list( self, *, @@ -149,125 +81,6 @@ def list( model=CA, ) - def delete( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CADeleteResponse]: - """ - Deletes a short-lived certificate CA. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/ca", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CADeleteResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[CADeleteResponse]], ResultWrapper[CADeleteResponse]), - ) - - def get( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CAGetResponse]: - """ - Fetches a short-lived certificate CA and its public key. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return cast( - Optional[CAGetResponse], - self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/ca", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CAGetResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[CAGetResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - class AsyncCAsResource(AsyncAPIResource): @cached_property @@ -278,68 +91,6 @@ def with_raw_response(self) -> AsyncCAsResourceWithRawResponse: def with_streaming_response(self) -> AsyncCAsResourceWithStreamingResponse: return AsyncCAsResourceWithStreamingResponse(self) - async def create( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CACreateResponse]: - """ - Generates a new short-lived certificate CA and public key. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return cast( - Optional[CACreateResponse], - await self._post( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/ca", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CACreateResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[CACreateResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - def list( self, *, @@ -389,193 +140,38 @@ def list( model=CA, ) - async def delete( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CADeleteResponse]: - """ - Deletes a short-lived certificate CA. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return await self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/ca", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CADeleteResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[CADeleteResponse]], ResultWrapper[CADeleteResponse]), - ) - - async def get( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CAGetResponse]: - """ - Fetches a short-lived certificate CA and its public key. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return cast( - Optional[CAGetResponse], - await self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/ca", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CAGetResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[CAGetResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - class CAsResourceWithRawResponse: def __init__(self, cas: CAsResource) -> None: self._cas = cas - self.create = to_raw_response_wrapper( - cas.create, - ) self.list = to_raw_response_wrapper( cas.list, ) - self.delete = to_raw_response_wrapper( - cas.delete, - ) - self.get = to_raw_response_wrapper( - cas.get, - ) class AsyncCAsResourceWithRawResponse: def __init__(self, cas: AsyncCAsResource) -> None: self._cas = cas - self.create = async_to_raw_response_wrapper( - cas.create, - ) self.list = async_to_raw_response_wrapper( cas.list, ) - self.delete = async_to_raw_response_wrapper( - cas.delete, - ) - self.get = async_to_raw_response_wrapper( - cas.get, - ) class CAsResourceWithStreamingResponse: def __init__(self, cas: CAsResource) -> None: self._cas = cas - self.create = to_streamed_response_wrapper( - cas.create, - ) self.list = to_streamed_response_wrapper( cas.list, ) - self.delete = to_streamed_response_wrapper( - cas.delete, - ) - self.get = to_streamed_response_wrapper( - cas.get, - ) class AsyncCAsResourceWithStreamingResponse: def __init__(self, cas: AsyncCAsResource) -> None: self._cas = cas - self.create = async_to_streamed_response_wrapper( - cas.create, - ) self.list = async_to_streamed_response_wrapper( cas.list, ) - self.delete = async_to_streamed_response_wrapper( - cas.delete, - ) - self.get = async_to_streamed_response_wrapper( - cas.get, - ) diff --git a/src/cloudflare/resources/zero_trust/access/applications/policies.py b/src/cloudflare/resources/zero_trust/access/applications/policies.py deleted file mode 100644 index b5c9f110dee..00000000000 --- a/src/cloudflare/resources/zero_trust/access/applications/policies.py +++ /dev/null @@ -1,1007 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Iterable, Optional, cast - -import httpx - -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._utils import ( - maybe_transform, - async_maybe_transform, -) -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ....._wrappers import ResultWrapper -from .....pagination import SyncSinglePage, AsyncSinglePage -from ....._base_client import ( - AsyncPaginator, - make_request_options, -) -from .....types.zero_trust.access import Decision -from .....types.zero_trust.access.decision import Decision -from .....types.zero_trust.access_rule_param import AccessRuleParam -from .....types.zero_trust.access.applications import policy_create_params, policy_update_params -from .....types.zero_trust.access.applications.policy_get_response import PolicyGetResponse -from .....types.zero_trust.access.applications.approval_group_param import ApprovalGroupParam -from .....types.zero_trust.access.applications.policy_list_response import PolicyListResponse -from .....types.zero_trust.access.applications.policy_create_response import PolicyCreateResponse -from .....types.zero_trust.access.applications.policy_delete_response import PolicyDeleteResponse -from .....types.zero_trust.access.applications.policy_update_response import PolicyUpdateResponse - -__all__ = ["PoliciesResource", "AsyncPoliciesResource"] - - -class PoliciesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> PoliciesResourceWithRawResponse: - return PoliciesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> PoliciesResourceWithStreamingResponse: - return PoliciesResourceWithStreamingResponse(self) - - def create( - self, - uuid: str, - *, - decision: Decision, - include: Iterable[AccessRuleParam], - name: str, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - approval_groups: Iterable[ApprovalGroupParam] | NotGiven = NOT_GIVEN, - approval_required: bool | NotGiven = NOT_GIVEN, - exclude: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, - isolation_required: bool | NotGiven = NOT_GIVEN, - precedence: int | NotGiven = NOT_GIVEN, - purpose_justification_prompt: str | NotGiven = NOT_GIVEN, - purpose_justification_required: bool | NotGiven = NOT_GIVEN, - require: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, - session_duration: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PolicyCreateResponse]: - """ - Creates a policy applying exclusive to a single application that defines the - users or groups who can reach it. We recommend creating a reusable policy - instead and subsequently referencing its ID in the application's 'policies' - array. - - Args: - uuid: UUID - - decision: The action Access will take if a user matches this policy. - - include: Rules evaluated with an OR logical operator. A user needs to meet only one of - the Include rules. - - name: The name of the Access policy. - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - approval_groups: Administrators who can approve a temporary authentication request. - - approval_required: Requires the user to request access from an administrator at the start of each - session. - - exclude: Rules evaluated with a NOT logical operator. To match the policy, a user cannot - meet any of the Exclude rules. - - isolation_required: Require this application to be served in an isolated browser for users matching - this policy. 'Client Web Isolation' must be on for the account in order to use - this feature. - - precedence: The order of execution for this policy. Must be unique for each policy within an - app. - - purpose_justification_prompt: A custom message that will appear on the purpose justification screen. - - purpose_justification_required: Require users to enter a justification when they log in to the application. - - require: Rules evaluated with an AND logical operator. To match the policy, a user must - meet all of the Require rules. - - session_duration: The amount of time that tokens issued for the application will be valid. Must be - in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, - m, h. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._post( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/policies", - body=maybe_transform( - { - "decision": decision, - "include": include, - "name": name, - "approval_groups": approval_groups, - "approval_required": approval_required, - "exclude": exclude, - "isolation_required": isolation_required, - "precedence": precedence, - "purpose_justification_prompt": purpose_justification_prompt, - "purpose_justification_required": purpose_justification_required, - "require": require, - "session_duration": session_duration, - }, - policy_create_params.PolicyCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PolicyCreateResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[PolicyCreateResponse]], ResultWrapper[PolicyCreateResponse]), - ) - - def update( - self, - uuid: str, - *, - uuid1: str, - decision: Decision, - include: Iterable[AccessRuleParam], - name: str, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - approval_groups: Iterable[ApprovalGroupParam] | NotGiven = NOT_GIVEN, - approval_required: bool | NotGiven = NOT_GIVEN, - exclude: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, - isolation_required: bool | NotGiven = NOT_GIVEN, - precedence: int | NotGiven = NOT_GIVEN, - purpose_justification_prompt: str | NotGiven = NOT_GIVEN, - purpose_justification_required: bool | NotGiven = NOT_GIVEN, - require: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, - session_duration: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PolicyUpdateResponse]: - """Updates an Access policy specific to an application. - - To update a reusable - policy, use the /account or zones/{identifier}/policies/{uid} endpoint. - - Args: - uuid1: UUID - - uuid: UUID - - decision: The action Access will take if a user matches this policy. - - include: Rules evaluated with an OR logical operator. A user needs to meet only one of - the Include rules. - - name: The name of the Access policy. - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - approval_groups: Administrators who can approve a temporary authentication request. - - approval_required: Requires the user to request access from an administrator at the start of each - session. - - exclude: Rules evaluated with a NOT logical operator. To match the policy, a user cannot - meet any of the Exclude rules. - - isolation_required: Require this application to be served in an isolated browser for users matching - this policy. 'Client Web Isolation' must be on for the account in order to use - this feature. - - precedence: The order of execution for this policy. Must be unique for each policy within an - app. - - purpose_justification_prompt: A custom message that will appear on the purpose justification screen. - - purpose_justification_required: Require users to enter a justification when they log in to the application. - - require: Rules evaluated with an AND logical operator. To match the policy, a user must - meet all of the Require rules. - - session_duration: The amount of time that tokens issued for the application will be valid. Must be - in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, - m, h. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid1: - raise ValueError(f"Expected a non-empty value for `uuid1` but received {uuid1!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid1}/policies/{uuid}", - body=maybe_transform( - { - "decision": decision, - "include": include, - "name": name, - "approval_groups": approval_groups, - "approval_required": approval_required, - "exclude": exclude, - "isolation_required": isolation_required, - "precedence": precedence, - "purpose_justification_prompt": purpose_justification_prompt, - "purpose_justification_required": purpose_justification_required, - "require": require, - "session_duration": session_duration, - }, - policy_update_params.PolicyUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PolicyUpdateResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[PolicyUpdateResponse]], ResultWrapper[PolicyUpdateResponse]), - ) - - def list( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[PolicyListResponse]: - """Lists Access policies configured for an application. - - Returns both exclusively - scoped and reusable policies used by the application. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._get_api_list( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/policies", - page=SyncSinglePage[PolicyListResponse], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=PolicyListResponse, - ) - - def delete( - self, - uuid: str, - *, - uuid1: str, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PolicyDeleteResponse]: - """Deletes an Access policy specific to an application. - - To delete a reusable - policy, use the /account or zones/{identifier}/policies/{uid} endpoint. - - Args: - uuid1: UUID - - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid1: - raise ValueError(f"Expected a non-empty value for `uuid1` but received {uuid1!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid1}/policies/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PolicyDeleteResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[PolicyDeleteResponse]], ResultWrapper[PolicyDeleteResponse]), - ) - - def get( - self, - uuid: str, - *, - uuid1: str, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PolicyGetResponse]: - """Fetches a single Access policy configured for an application. - - Returns both - exclusively owned and reusable policies used by the application. - - Args: - uuid1: UUID - - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid1: - raise ValueError(f"Expected a non-empty value for `uuid1` but received {uuid1!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid1}/policies/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PolicyGetResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[PolicyGetResponse]], ResultWrapper[PolicyGetResponse]), - ) - - -class AsyncPoliciesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncPoliciesResourceWithRawResponse: - return AsyncPoliciesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncPoliciesResourceWithStreamingResponse: - return AsyncPoliciesResourceWithStreamingResponse(self) - - async def create( - self, - uuid: str, - *, - decision: Decision, - include: Iterable[AccessRuleParam], - name: str, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - approval_groups: Iterable[ApprovalGroupParam] | NotGiven = NOT_GIVEN, - approval_required: bool | NotGiven = NOT_GIVEN, - exclude: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, - isolation_required: bool | NotGiven = NOT_GIVEN, - precedence: int | NotGiven = NOT_GIVEN, - purpose_justification_prompt: str | NotGiven = NOT_GIVEN, - purpose_justification_required: bool | NotGiven = NOT_GIVEN, - require: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, - session_duration: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PolicyCreateResponse]: - """ - Creates a policy applying exclusive to a single application that defines the - users or groups who can reach it. We recommend creating a reusable policy - instead and subsequently referencing its ID in the application's 'policies' - array. - - Args: - uuid: UUID - - decision: The action Access will take if a user matches this policy. - - include: Rules evaluated with an OR logical operator. A user needs to meet only one of - the Include rules. - - name: The name of the Access policy. - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - approval_groups: Administrators who can approve a temporary authentication request. - - approval_required: Requires the user to request access from an administrator at the start of each - session. - - exclude: Rules evaluated with a NOT logical operator. To match the policy, a user cannot - meet any of the Exclude rules. - - isolation_required: Require this application to be served in an isolated browser for users matching - this policy. 'Client Web Isolation' must be on for the account in order to use - this feature. - - precedence: The order of execution for this policy. Must be unique for each policy within an - app. - - purpose_justification_prompt: A custom message that will appear on the purpose justification screen. - - purpose_justification_required: Require users to enter a justification when they log in to the application. - - require: Rules evaluated with an AND logical operator. To match the policy, a user must - meet all of the Require rules. - - session_duration: The amount of time that tokens issued for the application will be valid. Must be - in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, - m, h. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return await self._post( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/policies", - body=await async_maybe_transform( - { - "decision": decision, - "include": include, - "name": name, - "approval_groups": approval_groups, - "approval_required": approval_required, - "exclude": exclude, - "isolation_required": isolation_required, - "precedence": precedence, - "purpose_justification_prompt": purpose_justification_prompt, - "purpose_justification_required": purpose_justification_required, - "require": require, - "session_duration": session_duration, - }, - policy_create_params.PolicyCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PolicyCreateResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[PolicyCreateResponse]], ResultWrapper[PolicyCreateResponse]), - ) - - async def update( - self, - uuid: str, - *, - uuid1: str, - decision: Decision, - include: Iterable[AccessRuleParam], - name: str, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - approval_groups: Iterable[ApprovalGroupParam] | NotGiven = NOT_GIVEN, - approval_required: bool | NotGiven = NOT_GIVEN, - exclude: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, - isolation_required: bool | NotGiven = NOT_GIVEN, - precedence: int | NotGiven = NOT_GIVEN, - purpose_justification_prompt: str | NotGiven = NOT_GIVEN, - purpose_justification_required: bool | NotGiven = NOT_GIVEN, - require: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, - session_duration: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PolicyUpdateResponse]: - """Updates an Access policy specific to an application. - - To update a reusable - policy, use the /account or zones/{identifier}/policies/{uid} endpoint. - - Args: - uuid1: UUID - - uuid: UUID - - decision: The action Access will take if a user matches this policy. - - include: Rules evaluated with an OR logical operator. A user needs to meet only one of - the Include rules. - - name: The name of the Access policy. - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - approval_groups: Administrators who can approve a temporary authentication request. - - approval_required: Requires the user to request access from an administrator at the start of each - session. - - exclude: Rules evaluated with a NOT logical operator. To match the policy, a user cannot - meet any of the Exclude rules. - - isolation_required: Require this application to be served in an isolated browser for users matching - this policy. 'Client Web Isolation' must be on for the account in order to use - this feature. - - precedence: The order of execution for this policy. Must be unique for each policy within an - app. - - purpose_justification_prompt: A custom message that will appear on the purpose justification screen. - - purpose_justification_required: Require users to enter a justification when they log in to the application. - - require: Rules evaluated with an AND logical operator. To match the policy, a user must - meet all of the Require rules. - - session_duration: The amount of time that tokens issued for the application will be valid. Must be - in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, - m, h. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid1: - raise ValueError(f"Expected a non-empty value for `uuid1` but received {uuid1!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return await self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid1}/policies/{uuid}", - body=await async_maybe_transform( - { - "decision": decision, - "include": include, - "name": name, - "approval_groups": approval_groups, - "approval_required": approval_required, - "exclude": exclude, - "isolation_required": isolation_required, - "precedence": precedence, - "purpose_justification_prompt": purpose_justification_prompt, - "purpose_justification_required": purpose_justification_required, - "require": require, - "session_duration": session_duration, - }, - policy_update_params.PolicyUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PolicyUpdateResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[PolicyUpdateResponse]], ResultWrapper[PolicyUpdateResponse]), - ) - - def list( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[PolicyListResponse, AsyncSinglePage[PolicyListResponse]]: - """Lists Access policies configured for an application. - - Returns both exclusively - scoped and reusable policies used by the application. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._get_api_list( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/policies", - page=AsyncSinglePage[PolicyListResponse], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=PolicyListResponse, - ) - - async def delete( - self, - uuid: str, - *, - uuid1: str, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PolicyDeleteResponse]: - """Deletes an Access policy specific to an application. - - To delete a reusable - policy, use the /account or zones/{identifier}/policies/{uid} endpoint. - - Args: - uuid1: UUID - - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid1: - raise ValueError(f"Expected a non-empty value for `uuid1` but received {uuid1!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return await self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid1}/policies/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PolicyDeleteResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[PolicyDeleteResponse]], ResultWrapper[PolicyDeleteResponse]), - ) - - async def get( - self, - uuid: str, - *, - uuid1: str, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PolicyGetResponse]: - """Fetches a single Access policy configured for an application. - - Returns both - exclusively owned and reusable policies used by the application. - - Args: - uuid1: UUID - - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid1: - raise ValueError(f"Expected a non-empty value for `uuid1` but received {uuid1!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return await self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid1}/policies/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PolicyGetResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[PolicyGetResponse]], ResultWrapper[PolicyGetResponse]), - ) - - -class PoliciesResourceWithRawResponse: - def __init__(self, policies: PoliciesResource) -> None: - self._policies = policies - - self.create = to_raw_response_wrapper( - policies.create, - ) - self.update = to_raw_response_wrapper( - policies.update, - ) - self.list = to_raw_response_wrapper( - policies.list, - ) - self.delete = to_raw_response_wrapper( - policies.delete, - ) - self.get = to_raw_response_wrapper( - policies.get, - ) - - -class AsyncPoliciesResourceWithRawResponse: - def __init__(self, policies: AsyncPoliciesResource) -> None: - self._policies = policies - - self.create = async_to_raw_response_wrapper( - policies.create, - ) - self.update = async_to_raw_response_wrapper( - policies.update, - ) - self.list = async_to_raw_response_wrapper( - policies.list, - ) - self.delete = async_to_raw_response_wrapper( - policies.delete, - ) - self.get = async_to_raw_response_wrapper( - policies.get, - ) - - -class PoliciesResourceWithStreamingResponse: - def __init__(self, policies: PoliciesResource) -> None: - self._policies = policies - - self.create = to_streamed_response_wrapper( - policies.create, - ) - self.update = to_streamed_response_wrapper( - policies.update, - ) - self.list = to_streamed_response_wrapper( - policies.list, - ) - self.delete = to_streamed_response_wrapper( - policies.delete, - ) - self.get = to_streamed_response_wrapper( - policies.get, - ) - - -class AsyncPoliciesResourceWithStreamingResponse: - def __init__(self, policies: AsyncPoliciesResource) -> None: - self._policies = policies - - self.create = async_to_streamed_response_wrapper( - policies.create, - ) - self.update = async_to_streamed_response_wrapper( - policies.update, - ) - self.list = async_to_streamed_response_wrapper( - policies.list, - ) - self.delete = async_to_streamed_response_wrapper( - policies.delete, - ) - self.get = async_to_streamed_response_wrapper( - policies.get, - ) diff --git a/src/cloudflare/resources/zero_trust/access/bookmarks.py b/src/cloudflare/resources/zero_trust/access/bookmarks.py deleted file mode 100644 index 00f06515c4c..00000000000 --- a/src/cloudflare/resources/zero_trust/access/bookmarks.py +++ /dev/null @@ -1,548 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ....pagination import SyncSinglePage, AsyncSinglePage -from ...._base_client import ( - AsyncPaginator, - make_request_options, -) -from ....types.zero_trust.access import bookmark_create_params, bookmark_update_params -from ....types.zero_trust.access.bookmark import Bookmark -from ....types.zero_trust.access.bookmark_delete_response import BookmarkDeleteResponse - -__all__ = ["BookmarksResource", "AsyncBookmarksResource"] - - -class BookmarksResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> BookmarksResourceWithRawResponse: - return BookmarksResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> BookmarksResourceWithStreamingResponse: - return BookmarksResourceWithStreamingResponse(self) - - def create( - self, - uuid: str, - *, - identifier: str, - body: object, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Bookmark]: - """ - Create a new Bookmark application. - - Args: - uuid: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - return self._post( - f"/accounts/{identifier}/access/bookmarks/{uuid}", - body=maybe_transform(body, bookmark_create_params.BookmarkCreateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Bookmark]]._unwrapper, - ), - cast_to=cast(Type[Optional[Bookmark]], ResultWrapper[Bookmark]), - ) - - def update( - self, - uuid: str, - *, - identifier: str, - body: object, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Bookmark]: - """ - Updates a configured Bookmark application. - - Args: - uuid: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - return self._put( - f"/accounts/{identifier}/access/bookmarks/{uuid}", - body=maybe_transform(body, bookmark_update_params.BookmarkUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Bookmark]]._unwrapper, - ), - cast_to=cast(Type[Optional[Bookmark]], ResultWrapper[Bookmark]), - ) - - def list( - self, - identifier: str, - *, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[Bookmark]: - """ - Lists Bookmark applications. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get_api_list( - f"/accounts/{identifier}/access/bookmarks", - page=SyncSinglePage[Bookmark], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=Bookmark, - ) - - def delete( - self, - uuid: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[BookmarkDeleteResponse]: - """ - Deletes a Bookmark application. - - Args: - uuid: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - return self._delete( - f"/accounts/{identifier}/access/bookmarks/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[BookmarkDeleteResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[BookmarkDeleteResponse]], ResultWrapper[BookmarkDeleteResponse]), - ) - - def get( - self, - uuid: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Bookmark]: - """ - Fetches a single Bookmark application. - - Args: - uuid: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - return self._get( - f"/accounts/{identifier}/access/bookmarks/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Bookmark]]._unwrapper, - ), - cast_to=cast(Type[Optional[Bookmark]], ResultWrapper[Bookmark]), - ) - - -class AsyncBookmarksResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncBookmarksResourceWithRawResponse: - return AsyncBookmarksResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncBookmarksResourceWithStreamingResponse: - return AsyncBookmarksResourceWithStreamingResponse(self) - - async def create( - self, - uuid: str, - *, - identifier: str, - body: object, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Bookmark]: - """ - Create a new Bookmark application. - - Args: - uuid: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - return await self._post( - f"/accounts/{identifier}/access/bookmarks/{uuid}", - body=await async_maybe_transform(body, bookmark_create_params.BookmarkCreateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Bookmark]]._unwrapper, - ), - cast_to=cast(Type[Optional[Bookmark]], ResultWrapper[Bookmark]), - ) - - async def update( - self, - uuid: str, - *, - identifier: str, - body: object, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Bookmark]: - """ - Updates a configured Bookmark application. - - Args: - uuid: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - return await self._put( - f"/accounts/{identifier}/access/bookmarks/{uuid}", - body=await async_maybe_transform(body, bookmark_update_params.BookmarkUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Bookmark]]._unwrapper, - ), - cast_to=cast(Type[Optional[Bookmark]], ResultWrapper[Bookmark]), - ) - - def list( - self, - identifier: str, - *, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[Bookmark, AsyncSinglePage[Bookmark]]: - """ - Lists Bookmark applications. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get_api_list( - f"/accounts/{identifier}/access/bookmarks", - page=AsyncSinglePage[Bookmark], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=Bookmark, - ) - - async def delete( - self, - uuid: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[BookmarkDeleteResponse]: - """ - Deletes a Bookmark application. - - Args: - uuid: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - return await self._delete( - f"/accounts/{identifier}/access/bookmarks/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[BookmarkDeleteResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[BookmarkDeleteResponse]], ResultWrapper[BookmarkDeleteResponse]), - ) - - async def get( - self, - uuid: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Bookmark]: - """ - Fetches a single Bookmark application. - - Args: - uuid: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - return await self._get( - f"/accounts/{identifier}/access/bookmarks/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Bookmark]]._unwrapper, - ), - cast_to=cast(Type[Optional[Bookmark]], ResultWrapper[Bookmark]), - ) - - -class BookmarksResourceWithRawResponse: - def __init__(self, bookmarks: BookmarksResource) -> None: - self._bookmarks = bookmarks - - self.create = to_raw_response_wrapper( - bookmarks.create, - ) - self.update = to_raw_response_wrapper( - bookmarks.update, - ) - self.list = to_raw_response_wrapper( - bookmarks.list, - ) - self.delete = to_raw_response_wrapper( - bookmarks.delete, - ) - self.get = to_raw_response_wrapper( - bookmarks.get, - ) - - -class AsyncBookmarksResourceWithRawResponse: - def __init__(self, bookmarks: AsyncBookmarksResource) -> None: - self._bookmarks = bookmarks - - self.create = async_to_raw_response_wrapper( - bookmarks.create, - ) - self.update = async_to_raw_response_wrapper( - bookmarks.update, - ) - self.list = async_to_raw_response_wrapper( - bookmarks.list, - ) - self.delete = async_to_raw_response_wrapper( - bookmarks.delete, - ) - self.get = async_to_raw_response_wrapper( - bookmarks.get, - ) - - -class BookmarksResourceWithStreamingResponse: - def __init__(self, bookmarks: BookmarksResource) -> None: - self._bookmarks = bookmarks - - self.create = to_streamed_response_wrapper( - bookmarks.create, - ) - self.update = to_streamed_response_wrapper( - bookmarks.update, - ) - self.list = to_streamed_response_wrapper( - bookmarks.list, - ) - self.delete = to_streamed_response_wrapper( - bookmarks.delete, - ) - self.get = to_streamed_response_wrapper( - bookmarks.get, - ) - - -class AsyncBookmarksResourceWithStreamingResponse: - def __init__(self, bookmarks: AsyncBookmarksResource) -> None: - self._bookmarks = bookmarks - - self.create = async_to_streamed_response_wrapper( - bookmarks.create, - ) - self.update = async_to_streamed_response_wrapper( - bookmarks.update, - ) - self.list = async_to_streamed_response_wrapper( - bookmarks.list, - ) - self.delete = async_to_streamed_response_wrapper( - bookmarks.delete, - ) - self.get = async_to_streamed_response_wrapper( - bookmarks.get, - ) diff --git a/src/cloudflare/resources/zero_trust/access/certificates/certificates.py b/src/cloudflare/resources/zero_trust/access/certificates/certificates.py index e0e729cb755..a7e07081133 100644 --- a/src/cloudflare/resources/zero_trust/access/certificates/certificates.py +++ b/src/cloudflare/resources/zero_trust/access/certificates/certificates.py @@ -33,10 +33,9 @@ AsyncPaginator, make_request_options, ) -from .....types.zero_trust.access import certificate_create_params, certificate_update_params +from .....types.zero_trust.access import certificate_create_params from .....types.zero_trust.access.certificate import Certificate from .....types.zero_trust.access.associated_hostnames import AssociatedHostnames -from .....types.zero_trust.access.certificate_delete_response import CertificateDeleteResponse __all__ = ["CertificatesResource", "AsyncCertificatesResource"] @@ -123,76 +122,6 @@ def create( cast_to=cast(Type[Optional[Certificate]], ResultWrapper[Certificate]), ) - def update( - self, - uuid: str, - *, - associated_hostnames: List[AssociatedHostnames], - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Certificate]: - """ - Updates a configured mTLS certificate. - - Args: - uuid: UUID - - associated_hostnames: The hostnames of the applications that will use this certificate. - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - name: The name of the certificate. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/certificates/{uuid}", - body=maybe_transform( - { - "associated_hostnames": associated_hostnames, - "name": name, - }, - certificate_update_params.CertificateUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Certificate]]._unwrapper, - ), - cast_to=cast(Type[Optional[Certificate]], ResultWrapper[Certificate]), - ) - def list( self, *, @@ -242,120 +171,6 @@ def list( model=Certificate, ) - def delete( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CertificateDeleteResponse]: - """ - Deletes an mTLS certificate. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/certificates/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CertificateDeleteResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[CertificateDeleteResponse]], ResultWrapper[CertificateDeleteResponse]), - ) - - def get( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Certificate]: - """ - Fetches a single mTLS certificate. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/certificates/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Certificate]]._unwrapper, - ), - cast_to=cast(Type[Optional[Certificate]], ResultWrapper[Certificate]), - ) - class AsyncCertificatesResource(AsyncAPIResource): @cached_property @@ -439,76 +254,6 @@ async def create( cast_to=cast(Type[Optional[Certificate]], ResultWrapper[Certificate]), ) - async def update( - self, - uuid: str, - *, - associated_hostnames: List[AssociatedHostnames], - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Certificate]: - """ - Updates a configured mTLS certificate. - - Args: - uuid: UUID - - associated_hostnames: The hostnames of the applications that will use this certificate. - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - name: The name of the certificate. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return await self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/certificates/{uuid}", - body=await async_maybe_transform( - { - "associated_hostnames": associated_hostnames, - "name": name, - }, - certificate_update_params.CertificateUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Certificate]]._unwrapper, - ), - cast_to=cast(Type[Optional[Certificate]], ResultWrapper[Certificate]), - ) - def list( self, *, @@ -558,120 +303,6 @@ def list( model=Certificate, ) - async def delete( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CertificateDeleteResponse]: - """ - Deletes an mTLS certificate. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return await self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/certificates/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CertificateDeleteResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[CertificateDeleteResponse]], ResultWrapper[CertificateDeleteResponse]), - ) - - async def get( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Certificate]: - """ - Fetches a single mTLS certificate. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return await self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/certificates/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Certificate]]._unwrapper, - ), - cast_to=cast(Type[Optional[Certificate]], ResultWrapper[Certificate]), - ) - class CertificatesResourceWithRawResponse: def __init__(self, certificates: CertificatesResource) -> None: @@ -680,18 +311,9 @@ def __init__(self, certificates: CertificatesResource) -> None: self.create = to_raw_response_wrapper( certificates.create, ) - self.update = to_raw_response_wrapper( - certificates.update, - ) self.list = to_raw_response_wrapper( certificates.list, ) - self.delete = to_raw_response_wrapper( - certificates.delete, - ) - self.get = to_raw_response_wrapper( - certificates.get, - ) @cached_property def settings(self) -> SettingsResourceWithRawResponse: @@ -705,18 +327,9 @@ def __init__(self, certificates: AsyncCertificatesResource) -> None: self.create = async_to_raw_response_wrapper( certificates.create, ) - self.update = async_to_raw_response_wrapper( - certificates.update, - ) self.list = async_to_raw_response_wrapper( certificates.list, ) - self.delete = async_to_raw_response_wrapper( - certificates.delete, - ) - self.get = async_to_raw_response_wrapper( - certificates.get, - ) @cached_property def settings(self) -> AsyncSettingsResourceWithRawResponse: @@ -730,18 +343,9 @@ def __init__(self, certificates: CertificatesResource) -> None: self.create = to_streamed_response_wrapper( certificates.create, ) - self.update = to_streamed_response_wrapper( - certificates.update, - ) self.list = to_streamed_response_wrapper( certificates.list, ) - self.delete = to_streamed_response_wrapper( - certificates.delete, - ) - self.get = to_streamed_response_wrapper( - certificates.get, - ) @cached_property def settings(self) -> SettingsResourceWithStreamingResponse: @@ -755,18 +359,9 @@ def __init__(self, certificates: AsyncCertificatesResource) -> None: self.create = async_to_streamed_response_wrapper( certificates.create, ) - self.update = async_to_streamed_response_wrapper( - certificates.update, - ) self.list = async_to_streamed_response_wrapper( certificates.list, ) - self.delete = async_to_streamed_response_wrapper( - certificates.delete, - ) - self.get = async_to_streamed_response_wrapper( - certificates.get, - ) @cached_property def settings(self) -> AsyncSettingsResourceWithStreamingResponse: diff --git a/src/cloudflare/resources/zero_trust/access/custom_pages.py b/src/cloudflare/resources/zero_trust/access/custom_pages.py deleted file mode 100644 index 1314c7e01b9..00000000000 --- a/src/cloudflare/resources/zero_trust/access/custom_pages.py +++ /dev/null @@ -1,636 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ....pagination import SyncSinglePage, AsyncSinglePage -from ...._base_client import ( - AsyncPaginator, - make_request_options, -) -from ....types.zero_trust.access import custom_page_create_params, custom_page_update_params -from ....types.zero_trust.access.custom_page import CustomPage -from ....types.zero_trust.access.custom_page_without_html import CustomPageWithoutHTML -from ....types.zero_trust.access.custom_page_delete_response import CustomPageDeleteResponse - -__all__ = ["CustomPagesResource", "AsyncCustomPagesResource"] - - -class CustomPagesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> CustomPagesResourceWithRawResponse: - return CustomPagesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> CustomPagesResourceWithStreamingResponse: - return CustomPagesResourceWithStreamingResponse(self) - - def create( - self, - identifier: str, - *, - custom_html: str, - name: str, - type: Literal["identity_denied", "forbidden"], - app_count: int | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CustomPageWithoutHTML]: - """ - Create a custom page - - Args: - identifier: Identifier - - custom_html: Custom page HTML. - - name: Custom page name. - - type: Custom page type. - - app_count: Number of apps the custom page is assigned to. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._post( - f"/accounts/{identifier}/access/custom_pages", - body=maybe_transform( - { - "custom_html": custom_html, - "name": name, - "type": type, - "app_count": app_count, - }, - custom_page_create_params.CustomPageCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CustomPageWithoutHTML]]._unwrapper, - ), - cast_to=cast(Type[Optional[CustomPageWithoutHTML]], ResultWrapper[CustomPageWithoutHTML]), - ) - - def update( - self, - uuid: str, - *, - identifier: str, - custom_html: str, - name: str, - type: Literal["identity_denied", "forbidden"], - app_count: int | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CustomPageWithoutHTML]: - """ - Update a custom page - - Args: - identifier: Identifier - - uuid: UUID - - custom_html: Custom page HTML. - - name: Custom page name. - - type: Custom page type. - - app_count: Number of apps the custom page is assigned to. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - return self._put( - f"/accounts/{identifier}/access/custom_pages/{uuid}", - body=maybe_transform( - { - "custom_html": custom_html, - "name": name, - "type": type, - "app_count": app_count, - }, - custom_page_update_params.CustomPageUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CustomPageWithoutHTML]]._unwrapper, - ), - cast_to=cast(Type[Optional[CustomPageWithoutHTML]], ResultWrapper[CustomPageWithoutHTML]), - ) - - def list( - self, - identifier: str, - *, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[CustomPageWithoutHTML]: - """ - List custom pages - - Args: - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get_api_list( - f"/accounts/{identifier}/access/custom_pages", - page=SyncSinglePage[CustomPageWithoutHTML], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=CustomPageWithoutHTML, - ) - - def delete( - self, - uuid: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CustomPageDeleteResponse]: - """ - Delete a custom page - - Args: - identifier: Identifier - - uuid: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - return self._delete( - f"/accounts/{identifier}/access/custom_pages/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CustomPageDeleteResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[CustomPageDeleteResponse]], ResultWrapper[CustomPageDeleteResponse]), - ) - - def get( - self, - uuid: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CustomPage]: - """ - Fetches a custom page and also returns its HTML. - - Args: - identifier: Identifier - - uuid: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - return self._get( - f"/accounts/{identifier}/access/custom_pages/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CustomPage]]._unwrapper, - ), - cast_to=cast(Type[Optional[CustomPage]], ResultWrapper[CustomPage]), - ) - - -class AsyncCustomPagesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncCustomPagesResourceWithRawResponse: - return AsyncCustomPagesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncCustomPagesResourceWithStreamingResponse: - return AsyncCustomPagesResourceWithStreamingResponse(self) - - async def create( - self, - identifier: str, - *, - custom_html: str, - name: str, - type: Literal["identity_denied", "forbidden"], - app_count: int | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CustomPageWithoutHTML]: - """ - Create a custom page - - Args: - identifier: Identifier - - custom_html: Custom page HTML. - - name: Custom page name. - - type: Custom page type. - - app_count: Number of apps the custom page is assigned to. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._post( - f"/accounts/{identifier}/access/custom_pages", - body=await async_maybe_transform( - { - "custom_html": custom_html, - "name": name, - "type": type, - "app_count": app_count, - }, - custom_page_create_params.CustomPageCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CustomPageWithoutHTML]]._unwrapper, - ), - cast_to=cast(Type[Optional[CustomPageWithoutHTML]], ResultWrapper[CustomPageWithoutHTML]), - ) - - async def update( - self, - uuid: str, - *, - identifier: str, - custom_html: str, - name: str, - type: Literal["identity_denied", "forbidden"], - app_count: int | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CustomPageWithoutHTML]: - """ - Update a custom page - - Args: - identifier: Identifier - - uuid: UUID - - custom_html: Custom page HTML. - - name: Custom page name. - - type: Custom page type. - - app_count: Number of apps the custom page is assigned to. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - return await self._put( - f"/accounts/{identifier}/access/custom_pages/{uuid}", - body=await async_maybe_transform( - { - "custom_html": custom_html, - "name": name, - "type": type, - "app_count": app_count, - }, - custom_page_update_params.CustomPageUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CustomPageWithoutHTML]]._unwrapper, - ), - cast_to=cast(Type[Optional[CustomPageWithoutHTML]], ResultWrapper[CustomPageWithoutHTML]), - ) - - def list( - self, - identifier: str, - *, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[CustomPageWithoutHTML, AsyncSinglePage[CustomPageWithoutHTML]]: - """ - List custom pages - - Args: - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get_api_list( - f"/accounts/{identifier}/access/custom_pages", - page=AsyncSinglePage[CustomPageWithoutHTML], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=CustomPageWithoutHTML, - ) - - async def delete( - self, - uuid: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CustomPageDeleteResponse]: - """ - Delete a custom page - - Args: - identifier: Identifier - - uuid: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - return await self._delete( - f"/accounts/{identifier}/access/custom_pages/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CustomPageDeleteResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[CustomPageDeleteResponse]], ResultWrapper[CustomPageDeleteResponse]), - ) - - async def get( - self, - uuid: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CustomPage]: - """ - Fetches a custom page and also returns its HTML. - - Args: - identifier: Identifier - - uuid: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - return await self._get( - f"/accounts/{identifier}/access/custom_pages/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CustomPage]]._unwrapper, - ), - cast_to=cast(Type[Optional[CustomPage]], ResultWrapper[CustomPage]), - ) - - -class CustomPagesResourceWithRawResponse: - def __init__(self, custom_pages: CustomPagesResource) -> None: - self._custom_pages = custom_pages - - self.create = to_raw_response_wrapper( - custom_pages.create, - ) - self.update = to_raw_response_wrapper( - custom_pages.update, - ) - self.list = to_raw_response_wrapper( - custom_pages.list, - ) - self.delete = to_raw_response_wrapper( - custom_pages.delete, - ) - self.get = to_raw_response_wrapper( - custom_pages.get, - ) - - -class AsyncCustomPagesResourceWithRawResponse: - def __init__(self, custom_pages: AsyncCustomPagesResource) -> None: - self._custom_pages = custom_pages - - self.create = async_to_raw_response_wrapper( - custom_pages.create, - ) - self.update = async_to_raw_response_wrapper( - custom_pages.update, - ) - self.list = async_to_raw_response_wrapper( - custom_pages.list, - ) - self.delete = async_to_raw_response_wrapper( - custom_pages.delete, - ) - self.get = async_to_raw_response_wrapper( - custom_pages.get, - ) - - -class CustomPagesResourceWithStreamingResponse: - def __init__(self, custom_pages: CustomPagesResource) -> None: - self._custom_pages = custom_pages - - self.create = to_streamed_response_wrapper( - custom_pages.create, - ) - self.update = to_streamed_response_wrapper( - custom_pages.update, - ) - self.list = to_streamed_response_wrapper( - custom_pages.list, - ) - self.delete = to_streamed_response_wrapper( - custom_pages.delete, - ) - self.get = to_streamed_response_wrapper( - custom_pages.get, - ) - - -class AsyncCustomPagesResourceWithStreamingResponse: - def __init__(self, custom_pages: AsyncCustomPagesResource) -> None: - self._custom_pages = custom_pages - - self.create = async_to_streamed_response_wrapper( - custom_pages.create, - ) - self.update = async_to_streamed_response_wrapper( - custom_pages.update, - ) - self.list = async_to_streamed_response_wrapper( - custom_pages.list, - ) - self.delete = async_to_streamed_response_wrapper( - custom_pages.delete, - ) - self.get = async_to_streamed_response_wrapper( - custom_pages.get, - ) diff --git a/src/cloudflare/resources/zero_trust/access/groups.py b/src/cloudflare/resources/zero_trust/access/groups.py index 62bde18942b..74f6f4a066d 100644 --- a/src/cloudflare/resources/zero_trust/access/groups.py +++ b/src/cloudflare/resources/zero_trust/access/groups.py @@ -25,10 +25,9 @@ AsyncPaginator, make_request_options, ) -from ....types.zero_trust.access import group_create_params, group_update_params +from ....types.zero_trust.access import group_create_params from ....types.zero_trust.access_rule_param import AccessRuleParam from ....types.zero_trust.access.zero_trust_group import ZeroTrustGroup -from ....types.zero_trust.access.group_delete_response import GroupDeleteResponse __all__ = ["GroupsResource", "AsyncGroupsResource"] @@ -122,91 +121,6 @@ def create( cast_to=cast(Type[Optional[ZeroTrustGroup]], ResultWrapper[ZeroTrustGroup]), ) - def update( - self, - uuid: str, - *, - include: Iterable[AccessRuleParam], - name: str, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - exclude: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, - is_default: bool | NotGiven = NOT_GIVEN, - require: Iterable[AccessRuleParam] | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZeroTrustGroup]: - """ - Updates a configured Access group. - - Args: - uuid: UUID - - include: Rules evaluated with an OR logical operator. A user needs to meet only one of - the Include rules. - - name: The name of the Access group. - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - exclude: Rules evaluated with a NOT logical operator. To match a policy, a user cannot - meet any of the Exclude rules. - - is_default: Whether this is the default group - - require: Rules evaluated with an AND logical operator. To match a policy, a user must - meet all of the Require rules. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/groups/{uuid}", - body=maybe_transform( - { - "include": include, - "name": name, - "exclude": exclude, - "is_default": is_default, - "require": require, - }, - group_update_params.GroupUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ZeroTrustGroup]]._unwrapper, - ), - cast_to=cast(Type[Optional[ZeroTrustGroup]], ResultWrapper[ZeroTrustGroup]), - ) - def list( self, *, @@ -256,120 +170,6 @@ def list( model=ZeroTrustGroup, ) - def delete( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[GroupDeleteResponse]: - """ - Deletes an Access group. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/groups/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[GroupDeleteResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[GroupDeleteResponse]], ResultWrapper[GroupDeleteResponse]), - ) - - def get( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZeroTrustGroup]: - """ - Fetches a single Access group. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/groups/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ZeroTrustGroup]]._unwrapper, - ), - cast_to=cast(Type[Optional[ZeroTrustGroup]], ResultWrapper[ZeroTrustGroup]), - ) - class AsyncGroupsResource(AsyncAPIResource): @cached_property @@ -460,91 +260,6 @@ async def create( cast_to=cast(Type[Optional[ZeroTrustGroup]], ResultWrapper[ZeroTrustGroup]), ) - async def update( - self, - uuid: str, - *, - include: Iterable[AccessRuleParam], - name: str, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - exclude: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, - is_default: bool | NotGiven = NOT_GIVEN, - require: Iterable[AccessRuleParam] | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZeroTrustGroup]: - """ - Updates a configured Access group. - - Args: - uuid: UUID - - include: Rules evaluated with an OR logical operator. A user needs to meet only one of - the Include rules. - - name: The name of the Access group. - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - exclude: Rules evaluated with a NOT logical operator. To match a policy, a user cannot - meet any of the Exclude rules. - - is_default: Whether this is the default group - - require: Rules evaluated with an AND logical operator. To match a policy, a user must - meet all of the Require rules. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return await self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/groups/{uuid}", - body=await async_maybe_transform( - { - "include": include, - "name": name, - "exclude": exclude, - "is_default": is_default, - "require": require, - }, - group_update_params.GroupUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ZeroTrustGroup]]._unwrapper, - ), - cast_to=cast(Type[Optional[ZeroTrustGroup]], ResultWrapper[ZeroTrustGroup]), - ) - def list( self, *, @@ -594,120 +309,6 @@ def list( model=ZeroTrustGroup, ) - async def delete( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[GroupDeleteResponse]: - """ - Deletes an Access group. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return await self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/groups/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[GroupDeleteResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[GroupDeleteResponse]], ResultWrapper[GroupDeleteResponse]), - ) - - async def get( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZeroTrustGroup]: - """ - Fetches a single Access group. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return await self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/groups/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ZeroTrustGroup]]._unwrapper, - ), - cast_to=cast(Type[Optional[ZeroTrustGroup]], ResultWrapper[ZeroTrustGroup]), - ) - class GroupsResourceWithRawResponse: def __init__(self, groups: GroupsResource) -> None: @@ -716,18 +317,9 @@ def __init__(self, groups: GroupsResource) -> None: self.create = to_raw_response_wrapper( groups.create, ) - self.update = to_raw_response_wrapper( - groups.update, - ) self.list = to_raw_response_wrapper( groups.list, ) - self.delete = to_raw_response_wrapper( - groups.delete, - ) - self.get = to_raw_response_wrapper( - groups.get, - ) class AsyncGroupsResourceWithRawResponse: @@ -737,18 +329,9 @@ def __init__(self, groups: AsyncGroupsResource) -> None: self.create = async_to_raw_response_wrapper( groups.create, ) - self.update = async_to_raw_response_wrapper( - groups.update, - ) self.list = async_to_raw_response_wrapper( groups.list, ) - self.delete = async_to_raw_response_wrapper( - groups.delete, - ) - self.get = async_to_raw_response_wrapper( - groups.get, - ) class GroupsResourceWithStreamingResponse: @@ -758,18 +341,9 @@ def __init__(self, groups: GroupsResource) -> None: self.create = to_streamed_response_wrapper( groups.create, ) - self.update = to_streamed_response_wrapper( - groups.update, - ) self.list = to_streamed_response_wrapper( groups.list, ) - self.delete = to_streamed_response_wrapper( - groups.delete, - ) - self.get = to_streamed_response_wrapper( - groups.get, - ) class AsyncGroupsResourceWithStreamingResponse: @@ -779,15 +353,6 @@ def __init__(self, groups: AsyncGroupsResource) -> None: self.create = async_to_streamed_response_wrapper( groups.create, ) - self.update = async_to_streamed_response_wrapper( - groups.update, - ) self.list = async_to_streamed_response_wrapper( groups.list, ) - self.delete = async_to_streamed_response_wrapper( - groups.delete, - ) - self.get = async_to_streamed_response_wrapper( - groups.get, - ) diff --git a/src/cloudflare/resources/zero_trust/access/keys.py b/src/cloudflare/resources/zero_trust/access/keys.py deleted file mode 100644 index dcb6a69a3d2..00000000000 --- a/src/cloudflare/resources/zero_trust/access/keys.py +++ /dev/null @@ -1,387 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Any, Optional, cast - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zero_trust.access import key_update_params -from ....types.zero_trust.access.key_get_response import KeyGetResponse -from ....types.zero_trust.access.key_rotate_response import KeyRotateResponse -from ....types.zero_trust.access.key_update_response import KeyUpdateResponse - -__all__ = ["KeysResource", "AsyncKeysResource"] - - -class KeysResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> KeysResourceWithRawResponse: - return KeysResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> KeysResourceWithStreamingResponse: - return KeysResourceWithStreamingResponse(self) - - def update( - self, - identifier: str, - *, - key_rotation_interval_days: float, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[KeyUpdateResponse]: - """ - Updates the Access key rotation settings for an account. - - Args: - identifier: Identifier - - key_rotation_interval_days: The number of days between key rotations. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return cast( - Optional[KeyUpdateResponse], - self._put( - f"/accounts/{identifier}/access/keys", - body=maybe_transform( - {"key_rotation_interval_days": key_rotation_interval_days}, key_update_params.KeyUpdateParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[KeyUpdateResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[KeyUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - def get( - self, - identifier: str, - *, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[KeyGetResponse]: - """ - Gets the Access key rotation settings for an account. - - Args: - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return cast( - Optional[KeyGetResponse], - self._get( - f"/accounts/{identifier}/access/keys", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[KeyGetResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[KeyGetResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - def rotate( - self, - identifier: str, - *, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[KeyRotateResponse]: - """ - Perfoms a key rotation for an account. - - Args: - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return cast( - Optional[KeyRotateResponse], - self._post( - f"/accounts/{identifier}/access/keys/rotate", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[KeyRotateResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[KeyRotateResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - -class AsyncKeysResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncKeysResourceWithRawResponse: - return AsyncKeysResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncKeysResourceWithStreamingResponse: - return AsyncKeysResourceWithStreamingResponse(self) - - async def update( - self, - identifier: str, - *, - key_rotation_interval_days: float, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[KeyUpdateResponse]: - """ - Updates the Access key rotation settings for an account. - - Args: - identifier: Identifier - - key_rotation_interval_days: The number of days between key rotations. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return cast( - Optional[KeyUpdateResponse], - await self._put( - f"/accounts/{identifier}/access/keys", - body=await async_maybe_transform( - {"key_rotation_interval_days": key_rotation_interval_days}, key_update_params.KeyUpdateParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[KeyUpdateResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[KeyUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - async def get( - self, - identifier: str, - *, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[KeyGetResponse]: - """ - Gets the Access key rotation settings for an account. - - Args: - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return cast( - Optional[KeyGetResponse], - await self._get( - f"/accounts/{identifier}/access/keys", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[KeyGetResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[KeyGetResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - async def rotate( - self, - identifier: str, - *, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[KeyRotateResponse]: - """ - Perfoms a key rotation for an account. - - Args: - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return cast( - Optional[KeyRotateResponse], - await self._post( - f"/accounts/{identifier}/access/keys/rotate", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[KeyRotateResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[KeyRotateResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - -class KeysResourceWithRawResponse: - def __init__(self, keys: KeysResource) -> None: - self._keys = keys - - self.update = to_raw_response_wrapper( - keys.update, - ) - self.get = to_raw_response_wrapper( - keys.get, - ) - self.rotate = to_raw_response_wrapper( - keys.rotate, - ) - - -class AsyncKeysResourceWithRawResponse: - def __init__(self, keys: AsyncKeysResource) -> None: - self._keys = keys - - self.update = async_to_raw_response_wrapper( - keys.update, - ) - self.get = async_to_raw_response_wrapper( - keys.get, - ) - self.rotate = async_to_raw_response_wrapper( - keys.rotate, - ) - - -class KeysResourceWithStreamingResponse: - def __init__(self, keys: KeysResource) -> None: - self._keys = keys - - self.update = to_streamed_response_wrapper( - keys.update, - ) - self.get = to_streamed_response_wrapper( - keys.get, - ) - self.rotate = to_streamed_response_wrapper( - keys.rotate, - ) - - -class AsyncKeysResourceWithStreamingResponse: - def __init__(self, keys: AsyncKeysResource) -> None: - self._keys = keys - - self.update = async_to_streamed_response_wrapper( - keys.update, - ) - self.get = async_to_streamed_response_wrapper( - keys.get, - ) - self.rotate = async_to_streamed_response_wrapper( - keys.rotate, - ) diff --git a/src/cloudflare/resources/zero_trust/access/logs/__init__.py b/src/cloudflare/resources/zero_trust/access/logs/__init__.py deleted file mode 100644 index 7479c1fbef8..00000000000 --- a/src/cloudflare/resources/zero_trust/access/logs/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .logs import ( - LogsResource, - AsyncLogsResource, - LogsResourceWithRawResponse, - AsyncLogsResourceWithRawResponse, - LogsResourceWithStreamingResponse, - AsyncLogsResourceWithStreamingResponse, -) -from .access_requests import ( - AccessRequestsResource, - AsyncAccessRequestsResource, - AccessRequestsResourceWithRawResponse, - AsyncAccessRequestsResourceWithRawResponse, - AccessRequestsResourceWithStreamingResponse, - AsyncAccessRequestsResourceWithStreamingResponse, -) - -__all__ = [ - "AccessRequestsResource", - "AsyncAccessRequestsResource", - "AccessRequestsResourceWithRawResponse", - "AsyncAccessRequestsResourceWithRawResponse", - "AccessRequestsResourceWithStreamingResponse", - "AsyncAccessRequestsResourceWithStreamingResponse", - "LogsResource", - "AsyncLogsResource", - "LogsResourceWithRawResponse", - "AsyncLogsResourceWithRawResponse", - "LogsResourceWithStreamingResponse", - "AsyncLogsResourceWithStreamingResponse", -] diff --git a/src/cloudflare/resources/zero_trust/access/logs/access_requests.py b/src/cloudflare/resources/zero_trust/access/logs/access_requests.py deleted file mode 100644 index 8425be9c392..00000000000 --- a/src/cloudflare/resources/zero_trust/access/logs/access_requests.py +++ /dev/null @@ -1,158 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast - -import httpx - -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ....._wrappers import ResultWrapper -from ....._base_client import ( - make_request_options, -) -from .....types.zero_trust.access.logs.access_request_list_response import AccessRequestListResponse - -__all__ = ["AccessRequestsResource", "AsyncAccessRequestsResource"] - - -class AccessRequestsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> AccessRequestsResourceWithRawResponse: - return AccessRequestsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AccessRequestsResourceWithStreamingResponse: - return AccessRequestsResourceWithStreamingResponse(self) - - def list( - self, - identifier: str, - *, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AccessRequestListResponse]: - """ - Gets a list of Access authentication audit logs for an account. - - Args: - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get( - f"/accounts/{identifier}/access/logs/access_requests", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AccessRequestListResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[AccessRequestListResponse]], ResultWrapper[AccessRequestListResponse]), - ) - - -class AsyncAccessRequestsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncAccessRequestsResourceWithRawResponse: - return AsyncAccessRequestsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAccessRequestsResourceWithStreamingResponse: - return AsyncAccessRequestsResourceWithStreamingResponse(self) - - async def list( - self, - identifier: str, - *, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AccessRequestListResponse]: - """ - Gets a list of Access authentication audit logs for an account. - - Args: - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._get( - f"/accounts/{identifier}/access/logs/access_requests", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AccessRequestListResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[AccessRequestListResponse]], ResultWrapper[AccessRequestListResponse]), - ) - - -class AccessRequestsResourceWithRawResponse: - def __init__(self, access_requests: AccessRequestsResource) -> None: - self._access_requests = access_requests - - self.list = to_raw_response_wrapper( - access_requests.list, - ) - - -class AsyncAccessRequestsResourceWithRawResponse: - def __init__(self, access_requests: AsyncAccessRequestsResource) -> None: - self._access_requests = access_requests - - self.list = async_to_raw_response_wrapper( - access_requests.list, - ) - - -class AccessRequestsResourceWithStreamingResponse: - def __init__(self, access_requests: AccessRequestsResource) -> None: - self._access_requests = access_requests - - self.list = to_streamed_response_wrapper( - access_requests.list, - ) - - -class AsyncAccessRequestsResourceWithStreamingResponse: - def __init__(self, access_requests: AsyncAccessRequestsResource) -> None: - self._access_requests = access_requests - - self.list = async_to_streamed_response_wrapper( - access_requests.list, - ) diff --git a/src/cloudflare/resources/zero_trust/access/logs/logs.py b/src/cloudflare/resources/zero_trust/access/logs/logs.py deleted file mode 100644 index 39226d42917..00000000000 --- a/src/cloudflare/resources/zero_trust/access/logs/logs.py +++ /dev/null @@ -1,80 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from .access_requests import ( - AccessRequestsResource, - AsyncAccessRequestsResource, - AccessRequestsResourceWithRawResponse, - AsyncAccessRequestsResourceWithRawResponse, - AccessRequestsResourceWithStreamingResponse, - AsyncAccessRequestsResourceWithStreamingResponse, -) - -__all__ = ["LogsResource", "AsyncLogsResource"] - - -class LogsResource(SyncAPIResource): - @cached_property - def access_requests(self) -> AccessRequestsResource: - return AccessRequestsResource(self._client) - - @cached_property - def with_raw_response(self) -> LogsResourceWithRawResponse: - return LogsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> LogsResourceWithStreamingResponse: - return LogsResourceWithStreamingResponse(self) - - -class AsyncLogsResource(AsyncAPIResource): - @cached_property - def access_requests(self) -> AsyncAccessRequestsResource: - return AsyncAccessRequestsResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncLogsResourceWithRawResponse: - return AsyncLogsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncLogsResourceWithStreamingResponse: - return AsyncLogsResourceWithStreamingResponse(self) - - -class LogsResourceWithRawResponse: - def __init__(self, logs: LogsResource) -> None: - self._logs = logs - - @cached_property - def access_requests(self) -> AccessRequestsResourceWithRawResponse: - return AccessRequestsResourceWithRawResponse(self._logs.access_requests) - - -class AsyncLogsResourceWithRawResponse: - def __init__(self, logs: AsyncLogsResource) -> None: - self._logs = logs - - @cached_property - def access_requests(self) -> AsyncAccessRequestsResourceWithRawResponse: - return AsyncAccessRequestsResourceWithRawResponse(self._logs.access_requests) - - -class LogsResourceWithStreamingResponse: - def __init__(self, logs: LogsResource) -> None: - self._logs = logs - - @cached_property - def access_requests(self) -> AccessRequestsResourceWithStreamingResponse: - return AccessRequestsResourceWithStreamingResponse(self._logs.access_requests) - - -class AsyncLogsResourceWithStreamingResponse: - def __init__(self, logs: AsyncLogsResource) -> None: - self._logs = logs - - @cached_property - def access_requests(self) -> AsyncAccessRequestsResourceWithStreamingResponse: - return AsyncAccessRequestsResourceWithStreamingResponse(self._logs.access_requests) diff --git a/src/cloudflare/resources/zero_trust/access/service_tokens.py b/src/cloudflare/resources/zero_trust/access/service_tokens.py index 99c07117732..679b675fdaa 100644 --- a/src/cloudflare/resources/zero_trust/access/service_tokens.py +++ b/src/cloudflare/resources/zero_trust/access/service_tokens.py @@ -25,10 +25,9 @@ AsyncPaginator, make_request_options, ) -from ....types.zero_trust.access import service_token_create_params, service_token_update_params +from ....types.zero_trust.access import service_token_create_params from ....types.zero_trust.access.service_token import ServiceToken from ....types.zero_trust.access.service_token_create_response import ServiceTokenCreateResponse -from ....types.zero_trust.access.service_token_rotate_response import ServiceTokenRotateResponse __all__ = ["ServiceTokensResource", "AsyncServiceTokensResource"] @@ -112,78 +111,6 @@ def create( cast_to=cast(Type[Optional[ServiceTokenCreateResponse]], ResultWrapper[ServiceTokenCreateResponse]), ) - def update( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - duration: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ServiceToken]: - """ - Updates a configured service token. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - duration: The duration for how long the service token will be valid. Must be in the format - `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, m, h. The - default is 1 year in hours (8760h). - - name: The name of the service token. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens/{uuid}", - body=maybe_transform( - { - "duration": duration, - "name": name, - }, - service_token_update_params.ServiceTokenUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ServiceToken]]._unwrapper, - ), - cast_to=cast(Type[Optional[ServiceToken]], ResultWrapper[ServiceToken]), - ) - def list( self, *, @@ -233,208 +160,6 @@ def list( model=ServiceToken, ) - def delete( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ServiceToken]: - """ - Deletes a service token. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ServiceToken]]._unwrapper, - ), - cast_to=cast(Type[Optional[ServiceToken]], ResultWrapper[ServiceToken]), - ) - - def get( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ServiceToken]: - """ - Fetches a single service token. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ServiceToken]]._unwrapper, - ), - cast_to=cast(Type[Optional[ServiceToken]], ResultWrapper[ServiceToken]), - ) - - def refresh( - self, - uuid: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ServiceToken]: - """ - Refreshes the expiration of a service token. - - Args: - identifier: Identifier - - uuid: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - return self._post( - f"/accounts/{identifier}/access/service_tokens/{uuid}/refresh", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ServiceToken]]._unwrapper, - ), - cast_to=cast(Type[Optional[ServiceToken]], ResultWrapper[ServiceToken]), - ) - - def rotate( - self, - uuid: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ServiceTokenRotateResponse]: - """ - Generates a new Client Secret for a service token and revokes the old one. - - Args: - identifier: Identifier - - uuid: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - return self._post( - f"/accounts/{identifier}/access/service_tokens/{uuid}/rotate", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ServiceTokenRotateResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[ServiceTokenRotateResponse]], ResultWrapper[ServiceTokenRotateResponse]), - ) - class AsyncServiceTokensResource(AsyncAPIResource): @cached_property @@ -515,78 +240,6 @@ async def create( cast_to=cast(Type[Optional[ServiceTokenCreateResponse]], ResultWrapper[ServiceTokenCreateResponse]), ) - async def update( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - duration: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ServiceToken]: - """ - Updates a configured service token. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - duration: The duration for how long the service token will be valid. Must be in the format - `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, m, h. The - default is 1 year in hours (8760h). - - name: The name of the service token. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return await self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens/{uuid}", - body=await async_maybe_transform( - { - "duration": duration, - "name": name, - }, - service_token_update_params.ServiceTokenUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ServiceToken]]._unwrapper, - ), - cast_to=cast(Type[Optional[ServiceToken]], ResultWrapper[ServiceToken]), - ) - def list( self, *, @@ -636,208 +289,6 @@ def list( model=ServiceToken, ) - async def delete( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ServiceToken]: - """ - Deletes a service token. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return await self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ServiceToken]]._unwrapper, - ), - cast_to=cast(Type[Optional[ServiceToken]], ResultWrapper[ServiceToken]), - ) - - async def get( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ServiceToken]: - """ - Fetches a single service token. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return await self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ServiceToken]]._unwrapper, - ), - cast_to=cast(Type[Optional[ServiceToken]], ResultWrapper[ServiceToken]), - ) - - async def refresh( - self, - uuid: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ServiceToken]: - """ - Refreshes the expiration of a service token. - - Args: - identifier: Identifier - - uuid: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - return await self._post( - f"/accounts/{identifier}/access/service_tokens/{uuid}/refresh", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ServiceToken]]._unwrapper, - ), - cast_to=cast(Type[Optional[ServiceToken]], ResultWrapper[ServiceToken]), - ) - - async def rotate( - self, - uuid: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ServiceTokenRotateResponse]: - """ - Generates a new Client Secret for a service token and revokes the old one. - - Args: - identifier: Identifier - - uuid: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - return await self._post( - f"/accounts/{identifier}/access/service_tokens/{uuid}/rotate", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ServiceTokenRotateResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[ServiceTokenRotateResponse]], ResultWrapper[ServiceTokenRotateResponse]), - ) - class ServiceTokensResourceWithRawResponse: def __init__(self, service_tokens: ServiceTokensResource) -> None: @@ -846,24 +297,9 @@ def __init__(self, service_tokens: ServiceTokensResource) -> None: self.create = to_raw_response_wrapper( service_tokens.create, ) - self.update = to_raw_response_wrapper( - service_tokens.update, - ) self.list = to_raw_response_wrapper( service_tokens.list, ) - self.delete = to_raw_response_wrapper( - service_tokens.delete, - ) - self.get = to_raw_response_wrapper( - service_tokens.get, - ) - self.refresh = to_raw_response_wrapper( - service_tokens.refresh, - ) - self.rotate = to_raw_response_wrapper( - service_tokens.rotate, - ) class AsyncServiceTokensResourceWithRawResponse: @@ -873,24 +309,9 @@ def __init__(self, service_tokens: AsyncServiceTokensResource) -> None: self.create = async_to_raw_response_wrapper( service_tokens.create, ) - self.update = async_to_raw_response_wrapper( - service_tokens.update, - ) self.list = async_to_raw_response_wrapper( service_tokens.list, ) - self.delete = async_to_raw_response_wrapper( - service_tokens.delete, - ) - self.get = async_to_raw_response_wrapper( - service_tokens.get, - ) - self.refresh = async_to_raw_response_wrapper( - service_tokens.refresh, - ) - self.rotate = async_to_raw_response_wrapper( - service_tokens.rotate, - ) class ServiceTokensResourceWithStreamingResponse: @@ -900,24 +321,9 @@ def __init__(self, service_tokens: ServiceTokensResource) -> None: self.create = to_streamed_response_wrapper( service_tokens.create, ) - self.update = to_streamed_response_wrapper( - service_tokens.update, - ) self.list = to_streamed_response_wrapper( service_tokens.list, ) - self.delete = to_streamed_response_wrapper( - service_tokens.delete, - ) - self.get = to_streamed_response_wrapper( - service_tokens.get, - ) - self.refresh = to_streamed_response_wrapper( - service_tokens.refresh, - ) - self.rotate = to_streamed_response_wrapper( - service_tokens.rotate, - ) class AsyncServiceTokensResourceWithStreamingResponse: @@ -927,21 +333,6 @@ def __init__(self, service_tokens: AsyncServiceTokensResource) -> None: self.create = async_to_streamed_response_wrapper( service_tokens.create, ) - self.update = async_to_streamed_response_wrapper( - service_tokens.update, - ) self.list = async_to_streamed_response_wrapper( service_tokens.list, ) - self.delete = async_to_streamed_response_wrapper( - service_tokens.delete, - ) - self.get = async_to_streamed_response_wrapper( - service_tokens.get, - ) - self.refresh = async_to_streamed_response_wrapper( - service_tokens.refresh, - ) - self.rotate = async_to_streamed_response_wrapper( - service_tokens.rotate, - ) diff --git a/src/cloudflare/resources/zero_trust/access/tags.py b/src/cloudflare/resources/zero_trust/access/tags.py deleted file mode 100644 index d7ba373faf7..00000000000 --- a/src/cloudflare/resources/zero_trust/access/tags.py +++ /dev/null @@ -1,566 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ....pagination import SyncSinglePage, AsyncSinglePage -from ...._base_client import ( - AsyncPaginator, - make_request_options, -) -from ....types.zero_trust.access import tag_create_params, tag_update_params -from ....types.zero_trust.access.tag import Tag -from ....types.zero_trust.access.tag_delete_response import TagDeleteResponse - -__all__ = ["TagsResource", "AsyncTagsResource"] - - -class TagsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> TagsResourceWithRawResponse: - return TagsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> TagsResourceWithStreamingResponse: - return TagsResourceWithStreamingResponse(self) - - def create( - self, - identifier: str, - *, - name: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Tag]: - """ - Create a tag - - Args: - identifier: Identifier - - name: The name of the tag - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._post( - f"/accounts/{identifier}/access/tags", - body=maybe_transform({"name": name}, tag_create_params.TagCreateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Tag]]._unwrapper, - ), - cast_to=cast(Type[Optional[Tag]], ResultWrapper[Tag]), - ) - - def update( - self, - tag_name: str, - *, - identifier: str, - name: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Tag]: - """ - Update a tag - - Args: - identifier: Identifier - - tag_name: The name of the tag - - name: The name of the tag - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not tag_name: - raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") - return self._put( - f"/accounts/{identifier}/access/tags/{tag_name}", - body=maybe_transform({"name": name}, tag_update_params.TagUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Tag]]._unwrapper, - ), - cast_to=cast(Type[Optional[Tag]], ResultWrapper[Tag]), - ) - - def list( - self, - identifier: str, - *, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[Tag]: - """ - List tags - - Args: - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get_api_list( - f"/accounts/{identifier}/access/tags", - page=SyncSinglePage[Tag], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=Tag, - ) - - def delete( - self, - name: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[TagDeleteResponse]: - """ - Delete a tag - - Args: - identifier: Identifier - - name: The name of the tag - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not name: - raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") - return self._delete( - f"/accounts/{identifier}/access/tags/{name}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[TagDeleteResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[TagDeleteResponse]], ResultWrapper[TagDeleteResponse]), - ) - - def get( - self, - name: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Tag]: - """ - Get a tag - - Args: - identifier: Identifier - - name: The name of the tag - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not name: - raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") - return self._get( - f"/accounts/{identifier}/access/tags/{name}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Tag]]._unwrapper, - ), - cast_to=cast(Type[Optional[Tag]], ResultWrapper[Tag]), - ) - - -class AsyncTagsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncTagsResourceWithRawResponse: - return AsyncTagsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncTagsResourceWithStreamingResponse: - return AsyncTagsResourceWithStreamingResponse(self) - - async def create( - self, - identifier: str, - *, - name: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Tag]: - """ - Create a tag - - Args: - identifier: Identifier - - name: The name of the tag - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._post( - f"/accounts/{identifier}/access/tags", - body=await async_maybe_transform({"name": name}, tag_create_params.TagCreateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Tag]]._unwrapper, - ), - cast_to=cast(Type[Optional[Tag]], ResultWrapper[Tag]), - ) - - async def update( - self, - tag_name: str, - *, - identifier: str, - name: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Tag]: - """ - Update a tag - - Args: - identifier: Identifier - - tag_name: The name of the tag - - name: The name of the tag - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not tag_name: - raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") - return await self._put( - f"/accounts/{identifier}/access/tags/{tag_name}", - body=await async_maybe_transform({"name": name}, tag_update_params.TagUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Tag]]._unwrapper, - ), - cast_to=cast(Type[Optional[Tag]], ResultWrapper[Tag]), - ) - - def list( - self, - identifier: str, - *, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[Tag, AsyncSinglePage[Tag]]: - """ - List tags - - Args: - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get_api_list( - f"/accounts/{identifier}/access/tags", - page=AsyncSinglePage[Tag], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=Tag, - ) - - async def delete( - self, - name: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[TagDeleteResponse]: - """ - Delete a tag - - Args: - identifier: Identifier - - name: The name of the tag - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not name: - raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") - return await self._delete( - f"/accounts/{identifier}/access/tags/{name}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[TagDeleteResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[TagDeleteResponse]], ResultWrapper[TagDeleteResponse]), - ) - - async def get( - self, - name: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Tag]: - """ - Get a tag - - Args: - identifier: Identifier - - name: The name of the tag - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not name: - raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") - return await self._get( - f"/accounts/{identifier}/access/tags/{name}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Tag]]._unwrapper, - ), - cast_to=cast(Type[Optional[Tag]], ResultWrapper[Tag]), - ) - - -class TagsResourceWithRawResponse: - def __init__(self, tags: TagsResource) -> None: - self._tags = tags - - self.create = to_raw_response_wrapper( - tags.create, - ) - self.update = to_raw_response_wrapper( - tags.update, - ) - self.list = to_raw_response_wrapper( - tags.list, - ) - self.delete = to_raw_response_wrapper( - tags.delete, - ) - self.get = to_raw_response_wrapper( - tags.get, - ) - - -class AsyncTagsResourceWithRawResponse: - def __init__(self, tags: AsyncTagsResource) -> None: - self._tags = tags - - self.create = async_to_raw_response_wrapper( - tags.create, - ) - self.update = async_to_raw_response_wrapper( - tags.update, - ) - self.list = async_to_raw_response_wrapper( - tags.list, - ) - self.delete = async_to_raw_response_wrapper( - tags.delete, - ) - self.get = async_to_raw_response_wrapper( - tags.get, - ) - - -class TagsResourceWithStreamingResponse: - def __init__(self, tags: TagsResource) -> None: - self._tags = tags - - self.create = to_streamed_response_wrapper( - tags.create, - ) - self.update = to_streamed_response_wrapper( - tags.update, - ) - self.list = to_streamed_response_wrapper( - tags.list, - ) - self.delete = to_streamed_response_wrapper( - tags.delete, - ) - self.get = to_streamed_response_wrapper( - tags.get, - ) - - -class AsyncTagsResourceWithStreamingResponse: - def __init__(self, tags: AsyncTagsResource) -> None: - self._tags = tags - - self.create = async_to_streamed_response_wrapper( - tags.create, - ) - self.update = async_to_streamed_response_wrapper( - tags.update, - ) - self.list = async_to_streamed_response_wrapper( - tags.list, - ) - self.delete = async_to_streamed_response_wrapper( - tags.delete, - ) - self.get = async_to_streamed_response_wrapper( - tags.get, - ) diff --git a/src/cloudflare/resources/zero_trust/access/users/__init__.py b/src/cloudflare/resources/zero_trust/access/users/__init__.py deleted file mode 100644 index c5766c1427a..00000000000 --- a/src/cloudflare/resources/zero_trust/access/users/__init__.py +++ /dev/null @@ -1,61 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .users import ( - UsersResource, - AsyncUsersResource, - UsersResourceWithRawResponse, - AsyncUsersResourceWithRawResponse, - UsersResourceWithStreamingResponse, - AsyncUsersResourceWithStreamingResponse, -) -from .failed_logins import ( - FailedLoginsResource, - AsyncFailedLoginsResource, - FailedLoginsResourceWithRawResponse, - AsyncFailedLoginsResourceWithRawResponse, - FailedLoginsResourceWithStreamingResponse, - AsyncFailedLoginsResourceWithStreamingResponse, -) -from .active_sessions import ( - ActiveSessionsResource, - AsyncActiveSessionsResource, - ActiveSessionsResourceWithRawResponse, - AsyncActiveSessionsResourceWithRawResponse, - ActiveSessionsResourceWithStreamingResponse, - AsyncActiveSessionsResourceWithStreamingResponse, -) -from .last_seen_identity import ( - LastSeenIdentityResource, - AsyncLastSeenIdentityResource, - LastSeenIdentityResourceWithRawResponse, - AsyncLastSeenIdentityResourceWithRawResponse, - LastSeenIdentityResourceWithStreamingResponse, - AsyncLastSeenIdentityResourceWithStreamingResponse, -) - -__all__ = [ - "ActiveSessionsResource", - "AsyncActiveSessionsResource", - "ActiveSessionsResourceWithRawResponse", - "AsyncActiveSessionsResourceWithRawResponse", - "ActiveSessionsResourceWithStreamingResponse", - "AsyncActiveSessionsResourceWithStreamingResponse", - "LastSeenIdentityResource", - "AsyncLastSeenIdentityResource", - "LastSeenIdentityResourceWithRawResponse", - "AsyncLastSeenIdentityResourceWithRawResponse", - "LastSeenIdentityResourceWithStreamingResponse", - "AsyncLastSeenIdentityResourceWithStreamingResponse", - "FailedLoginsResource", - "AsyncFailedLoginsResource", - "FailedLoginsResourceWithRawResponse", - "AsyncFailedLoginsResourceWithRawResponse", - "FailedLoginsResourceWithStreamingResponse", - "AsyncFailedLoginsResourceWithStreamingResponse", - "UsersResource", - "AsyncUsersResource", - "UsersResourceWithRawResponse", - "AsyncUsersResourceWithRawResponse", - "UsersResourceWithStreamingResponse", - "AsyncUsersResourceWithStreamingResponse", -] diff --git a/src/cloudflare/resources/zero_trust/access/users/active_sessions.py b/src/cloudflare/resources/zero_trust/access/users/active_sessions.py deleted file mode 100644 index 0a39ccddb3d..00000000000 --- a/src/cloudflare/resources/zero_trust/access/users/active_sessions.py +++ /dev/null @@ -1,271 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast - -import httpx - -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ....._wrappers import ResultWrapper -from .....pagination import SyncSinglePage, AsyncSinglePage -from ....._base_client import ( - AsyncPaginator, - make_request_options, -) -from .....types.zero_trust.access.users.active_session_get_response import ActiveSessionGetResponse -from .....types.zero_trust.access.users.active_session_list_response import ActiveSessionListResponse - -__all__ = ["ActiveSessionsResource", "AsyncActiveSessionsResource"] - - -class ActiveSessionsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ActiveSessionsResourceWithRawResponse: - return ActiveSessionsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ActiveSessionsResourceWithStreamingResponse: - return ActiveSessionsResourceWithStreamingResponse(self) - - def list( - self, - id: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ActiveSessionListResponse]: - """ - Get active sessions for a single user. - - Args: - identifier: Identifier - - id: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._get_api_list( - f"/accounts/{identifier}/access/users/{id}/active_sessions", - page=SyncSinglePage[ActiveSessionListResponse], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=ActiveSessionListResponse, - ) - - def get( - self, - nonce: str, - *, - identifier: str, - id: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ActiveSessionGetResponse]: - """ - Get an active session for a single user. - - Args: - identifier: Identifier - - id: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - if not nonce: - raise ValueError(f"Expected a non-empty value for `nonce` but received {nonce!r}") - return self._get( - f"/accounts/{identifier}/access/users/{id}/active_sessions/{nonce}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ActiveSessionGetResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[ActiveSessionGetResponse]], ResultWrapper[ActiveSessionGetResponse]), - ) - - -class AsyncActiveSessionsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncActiveSessionsResourceWithRawResponse: - return AsyncActiveSessionsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncActiveSessionsResourceWithStreamingResponse: - return AsyncActiveSessionsResourceWithStreamingResponse(self) - - def list( - self, - id: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ActiveSessionListResponse, AsyncSinglePage[ActiveSessionListResponse]]: - """ - Get active sessions for a single user. - - Args: - identifier: Identifier - - id: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._get_api_list( - f"/accounts/{identifier}/access/users/{id}/active_sessions", - page=AsyncSinglePage[ActiveSessionListResponse], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=ActiveSessionListResponse, - ) - - async def get( - self, - nonce: str, - *, - identifier: str, - id: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ActiveSessionGetResponse]: - """ - Get an active session for a single user. - - Args: - identifier: Identifier - - id: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - if not nonce: - raise ValueError(f"Expected a non-empty value for `nonce` but received {nonce!r}") - return await self._get( - f"/accounts/{identifier}/access/users/{id}/active_sessions/{nonce}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ActiveSessionGetResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[ActiveSessionGetResponse]], ResultWrapper[ActiveSessionGetResponse]), - ) - - -class ActiveSessionsResourceWithRawResponse: - def __init__(self, active_sessions: ActiveSessionsResource) -> None: - self._active_sessions = active_sessions - - self.list = to_raw_response_wrapper( - active_sessions.list, - ) - self.get = to_raw_response_wrapper( - active_sessions.get, - ) - - -class AsyncActiveSessionsResourceWithRawResponse: - def __init__(self, active_sessions: AsyncActiveSessionsResource) -> None: - self._active_sessions = active_sessions - - self.list = async_to_raw_response_wrapper( - active_sessions.list, - ) - self.get = async_to_raw_response_wrapper( - active_sessions.get, - ) - - -class ActiveSessionsResourceWithStreamingResponse: - def __init__(self, active_sessions: ActiveSessionsResource) -> None: - self._active_sessions = active_sessions - - self.list = to_streamed_response_wrapper( - active_sessions.list, - ) - self.get = to_streamed_response_wrapper( - active_sessions.get, - ) - - -class AsyncActiveSessionsResourceWithStreamingResponse: - def __init__(self, active_sessions: AsyncActiveSessionsResource) -> None: - self._active_sessions = active_sessions - - self.list = async_to_streamed_response_wrapper( - active_sessions.list, - ) - self.get = async_to_streamed_response_wrapper( - active_sessions.get, - ) diff --git a/src/cloudflare/resources/zero_trust/access/users/failed_logins.py b/src/cloudflare/resources/zero_trust/access/users/failed_logins.py deleted file mode 100644 index 6b2b7d19f57..00000000000 --- a/src/cloudflare/resources/zero_trust/access/users/failed_logins.py +++ /dev/null @@ -1,161 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .....pagination import SyncSinglePage, AsyncSinglePage -from ....._base_client import ( - AsyncPaginator, - make_request_options, -) -from .....types.zero_trust.access.users.failed_login_list_response import FailedLoginListResponse - -__all__ = ["FailedLoginsResource", "AsyncFailedLoginsResource"] - - -class FailedLoginsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> FailedLoginsResourceWithRawResponse: - return FailedLoginsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> FailedLoginsResourceWithStreamingResponse: - return FailedLoginsResourceWithStreamingResponse(self) - - def list( - self, - id: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[FailedLoginListResponse]: - """ - Get all failed login attempts for a single user. - - Args: - identifier: Identifier - - id: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._get_api_list( - f"/accounts/{identifier}/access/users/{id}/failed_logins", - page=SyncSinglePage[FailedLoginListResponse], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=FailedLoginListResponse, - ) - - -class AsyncFailedLoginsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncFailedLoginsResourceWithRawResponse: - return AsyncFailedLoginsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncFailedLoginsResourceWithStreamingResponse: - return AsyncFailedLoginsResourceWithStreamingResponse(self) - - def list( - self, - id: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[FailedLoginListResponse, AsyncSinglePage[FailedLoginListResponse]]: - """ - Get all failed login attempts for a single user. - - Args: - identifier: Identifier - - id: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._get_api_list( - f"/accounts/{identifier}/access/users/{id}/failed_logins", - page=AsyncSinglePage[FailedLoginListResponse], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=FailedLoginListResponse, - ) - - -class FailedLoginsResourceWithRawResponse: - def __init__(self, failed_logins: FailedLoginsResource) -> None: - self._failed_logins = failed_logins - - self.list = to_raw_response_wrapper( - failed_logins.list, - ) - - -class AsyncFailedLoginsResourceWithRawResponse: - def __init__(self, failed_logins: AsyncFailedLoginsResource) -> None: - self._failed_logins = failed_logins - - self.list = async_to_raw_response_wrapper( - failed_logins.list, - ) - - -class FailedLoginsResourceWithStreamingResponse: - def __init__(self, failed_logins: FailedLoginsResource) -> None: - self._failed_logins = failed_logins - - self.list = to_streamed_response_wrapper( - failed_logins.list, - ) - - -class AsyncFailedLoginsResourceWithStreamingResponse: - def __init__(self, failed_logins: AsyncFailedLoginsResource) -> None: - self._failed_logins = failed_logins - - self.list = async_to_streamed_response_wrapper( - failed_logins.list, - ) diff --git a/src/cloudflare/resources/zero_trust/access/users/last_seen_identity.py b/src/cloudflare/resources/zero_trust/access/users/last_seen_identity.py deleted file mode 100644 index 4e913e2720c..00000000000 --- a/src/cloudflare/resources/zero_trust/access/users/last_seen_identity.py +++ /dev/null @@ -1,168 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast - -import httpx - -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ....._wrappers import ResultWrapper -from ....._base_client import ( - make_request_options, -) -from .....types.zero_trust.access.users.identity import Identity - -__all__ = ["LastSeenIdentityResource", "AsyncLastSeenIdentityResource"] - - -class LastSeenIdentityResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> LastSeenIdentityResourceWithRawResponse: - return LastSeenIdentityResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> LastSeenIdentityResourceWithStreamingResponse: - return LastSeenIdentityResourceWithStreamingResponse(self) - - def get( - self, - id: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Identity]: - """ - Get last seen identity for a single user. - - Args: - identifier: Identifier - - id: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._get( - f"/accounts/{identifier}/access/users/{id}/last_seen_identity", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Identity]]._unwrapper, - ), - cast_to=cast(Type[Optional[Identity]], ResultWrapper[Identity]), - ) - - -class AsyncLastSeenIdentityResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncLastSeenIdentityResourceWithRawResponse: - return AsyncLastSeenIdentityResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncLastSeenIdentityResourceWithStreamingResponse: - return AsyncLastSeenIdentityResourceWithStreamingResponse(self) - - async def get( - self, - id: str, - *, - identifier: str, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Identity]: - """ - Get last seen identity for a single user. - - Args: - identifier: Identifier - - id: UUID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return await self._get( - f"/accounts/{identifier}/access/users/{id}/last_seen_identity", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Identity]]._unwrapper, - ), - cast_to=cast(Type[Optional[Identity]], ResultWrapper[Identity]), - ) - - -class LastSeenIdentityResourceWithRawResponse: - def __init__(self, last_seen_identity: LastSeenIdentityResource) -> None: - self._last_seen_identity = last_seen_identity - - self.get = to_raw_response_wrapper( - last_seen_identity.get, - ) - - -class AsyncLastSeenIdentityResourceWithRawResponse: - def __init__(self, last_seen_identity: AsyncLastSeenIdentityResource) -> None: - self._last_seen_identity = last_seen_identity - - self.get = async_to_raw_response_wrapper( - last_seen_identity.get, - ) - - -class LastSeenIdentityResourceWithStreamingResponse: - def __init__(self, last_seen_identity: LastSeenIdentityResource) -> None: - self._last_seen_identity = last_seen_identity - - self.get = to_streamed_response_wrapper( - last_seen_identity.get, - ) - - -class AsyncLastSeenIdentityResourceWithStreamingResponse: - def __init__(self, last_seen_identity: AsyncLastSeenIdentityResource) -> None: - self._last_seen_identity = last_seen_identity - - self.get = async_to_streamed_response_wrapper( - last_seen_identity.get, - ) diff --git a/src/cloudflare/resources/zero_trust/access/users/users.py b/src/cloudflare/resources/zero_trust/access/users/users.py deleted file mode 100644 index 97bce1fa075..00000000000 --- a/src/cloudflare/resources/zero_trust/access/users/users.py +++ /dev/null @@ -1,247 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .failed_logins import ( - FailedLoginsResource, - AsyncFailedLoginsResource, - FailedLoginsResourceWithRawResponse, - AsyncFailedLoginsResourceWithRawResponse, - FailedLoginsResourceWithStreamingResponse, - AsyncFailedLoginsResourceWithStreamingResponse, -) -from .....pagination import SyncSinglePage, AsyncSinglePage -from .active_sessions import ( - ActiveSessionsResource, - AsyncActiveSessionsResource, - ActiveSessionsResourceWithRawResponse, - AsyncActiveSessionsResourceWithRawResponse, - ActiveSessionsResourceWithStreamingResponse, - AsyncActiveSessionsResourceWithStreamingResponse, -) -from ....._base_client import ( - AsyncPaginator, - make_request_options, -) -from .last_seen_identity import ( - LastSeenIdentityResource, - AsyncLastSeenIdentityResource, - LastSeenIdentityResourceWithRawResponse, - AsyncLastSeenIdentityResourceWithRawResponse, - LastSeenIdentityResourceWithStreamingResponse, - AsyncLastSeenIdentityResourceWithStreamingResponse, -) -from .....types.zero_trust.access.access_user import AccessUser - -__all__ = ["UsersResource", "AsyncUsersResource"] - - -class UsersResource(SyncAPIResource): - @cached_property - def active_sessions(self) -> ActiveSessionsResource: - return ActiveSessionsResource(self._client) - - @cached_property - def last_seen_identity(self) -> LastSeenIdentityResource: - return LastSeenIdentityResource(self._client) - - @cached_property - def failed_logins(self) -> FailedLoginsResource: - return FailedLoginsResource(self._client) - - @cached_property - def with_raw_response(self) -> UsersResourceWithRawResponse: - return UsersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> UsersResourceWithStreamingResponse: - return UsersResourceWithStreamingResponse(self) - - def list( - self, - identifier: str, - *, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[AccessUser]: - """ - Gets a list of users for an account. - - Args: - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get_api_list( - f"/accounts/{identifier}/access/users", - page=SyncSinglePage[AccessUser], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=AccessUser, - ) - - -class AsyncUsersResource(AsyncAPIResource): - @cached_property - def active_sessions(self) -> AsyncActiveSessionsResource: - return AsyncActiveSessionsResource(self._client) - - @cached_property - def last_seen_identity(self) -> AsyncLastSeenIdentityResource: - return AsyncLastSeenIdentityResource(self._client) - - @cached_property - def failed_logins(self) -> AsyncFailedLoginsResource: - return AsyncFailedLoginsResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncUsersResourceWithRawResponse: - return AsyncUsersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncUsersResourceWithStreamingResponse: - return AsyncUsersResourceWithStreamingResponse(self) - - def list( - self, - identifier: str, - *, - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AccessUser, AsyncSinglePage[AccessUser]]: - """ - Gets a list of users for an account. - - Args: - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get_api_list( - f"/accounts/{identifier}/access/users", - page=AsyncSinglePage[AccessUser], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=AccessUser, - ) - - -class UsersResourceWithRawResponse: - def __init__(self, users: UsersResource) -> None: - self._users = users - - self.list = to_raw_response_wrapper( - users.list, - ) - - @cached_property - def active_sessions(self) -> ActiveSessionsResourceWithRawResponse: - return ActiveSessionsResourceWithRawResponse(self._users.active_sessions) - - @cached_property - def last_seen_identity(self) -> LastSeenIdentityResourceWithRawResponse: - return LastSeenIdentityResourceWithRawResponse(self._users.last_seen_identity) - - @cached_property - def failed_logins(self) -> FailedLoginsResourceWithRawResponse: - return FailedLoginsResourceWithRawResponse(self._users.failed_logins) - - -class AsyncUsersResourceWithRawResponse: - def __init__(self, users: AsyncUsersResource) -> None: - self._users = users - - self.list = async_to_raw_response_wrapper( - users.list, - ) - - @cached_property - def active_sessions(self) -> AsyncActiveSessionsResourceWithRawResponse: - return AsyncActiveSessionsResourceWithRawResponse(self._users.active_sessions) - - @cached_property - def last_seen_identity(self) -> AsyncLastSeenIdentityResourceWithRawResponse: - return AsyncLastSeenIdentityResourceWithRawResponse(self._users.last_seen_identity) - - @cached_property - def failed_logins(self) -> AsyncFailedLoginsResourceWithRawResponse: - return AsyncFailedLoginsResourceWithRawResponse(self._users.failed_logins) - - -class UsersResourceWithStreamingResponse: - def __init__(self, users: UsersResource) -> None: - self._users = users - - self.list = to_streamed_response_wrapper( - users.list, - ) - - @cached_property - def active_sessions(self) -> ActiveSessionsResourceWithStreamingResponse: - return ActiveSessionsResourceWithStreamingResponse(self._users.active_sessions) - - @cached_property - def last_seen_identity(self) -> LastSeenIdentityResourceWithStreamingResponse: - return LastSeenIdentityResourceWithStreamingResponse(self._users.last_seen_identity) - - @cached_property - def failed_logins(self) -> FailedLoginsResourceWithStreamingResponse: - return FailedLoginsResourceWithStreamingResponse(self._users.failed_logins) - - -class AsyncUsersResourceWithStreamingResponse: - def __init__(self, users: AsyncUsersResource) -> None: - self._users = users - - self.list = async_to_streamed_response_wrapper( - users.list, - ) - - @cached_property - def active_sessions(self) -> AsyncActiveSessionsResourceWithStreamingResponse: - return AsyncActiveSessionsResourceWithStreamingResponse(self._users.active_sessions) - - @cached_property - def last_seen_identity(self) -> AsyncLastSeenIdentityResourceWithStreamingResponse: - return AsyncLastSeenIdentityResourceWithStreamingResponse(self._users.last_seen_identity) - - @cached_property - def failed_logins(self) -> AsyncFailedLoginsResourceWithStreamingResponse: - return AsyncFailedLoginsResourceWithStreamingResponse(self._users.failed_logins) diff --git a/src/cloudflare/resources/zero_trust/identity_providers.py b/src/cloudflare/resources/zero_trust/identity_providers.py index c07d0a4f1fb..22a66d860cd 100644 --- a/src/cloudflare/resources/zero_trust/identity_providers.py +++ b/src/cloudflare/resources/zero_trust/identity_providers.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast, overload +from typing import Any, Optional, cast, overload import httpx @@ -26,17 +26,12 @@ AsyncPaginator, make_request_options, ) -from ...types.zero_trust import ( - IdentityProviderType, - identity_provider_create_params, - identity_provider_update_params, -) +from ...types.zero_trust import IdentityProviderType, identity_provider_create_params from ...types.zero_trust.identity_provider import IdentityProvider from ...types.zero_trust.scim_config_param import ScimConfigParam from ...types.zero_trust.identity_provider_type import IdentityProviderType from ...types.zero_trust.generic_oauth_config_param import GenericOAuthConfigParam from ...types.zero_trust.identity_provider_list_response import IdentityProviderListResponse -from ...types.zero_trust.identity_provider_delete_response import IdentityProviderDeleteResponse __all__ = ["IdentityProvidersResource", "AsyncIdentityProvidersResource"] @@ -787,12 +782,72 @@ def create( ), ) + def list( + self, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncSinglePage[IdentityProviderListResponse]: + """ + Lists all configured identity providers. + + Args: + account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + + zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if account_id and zone_id: + raise ValueError("You cannot provide both account_id and zone_id") + + if account_id: + account_or_zone = "accounts" + account_or_zone_id = account_id + else: + if not zone_id: + raise ValueError("You must provide either account_id or zone_id") + + account_or_zone = "zones" + account_or_zone_id = zone_id + return self._get_api_list( + f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers", + page=SyncSinglePage[IdentityProviderListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=cast( + Any, IdentityProviderListResponse + ), # Union types cannot be passed in as arguments in the type system + ) + + +class AsyncIdentityProvidersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncIdentityProvidersResourceWithRawResponse: + return AsyncIdentityProvidersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncIdentityProvidersResourceWithStreamingResponse: + return AsyncIdentityProvidersResourceWithStreamingResponse(self) + @overload - def update( + async def create( self, - uuid: str, *, - config: identity_provider_update_params.AzureADConfig, + config: identity_provider_create_params.AzureADConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, @@ -806,11 +861,9 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IdentityProvider]: """ - Updates a configured identity provider. + Adds a new identity provider to Access. Args: - uuid: UUID - config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). @@ -839,11 +892,10 @@ def update( ... @overload - def update( + async def create( self, - uuid: str, *, - config: identity_provider_update_params.AccessCentrifyConfig, + config: identity_provider_create_params.AccessCentrifyConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, @@ -857,11 +909,9 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IdentityProvider]: """ - Updates a configured identity provider. + Adds a new identity provider to Access. Args: - uuid: UUID - config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). @@ -890,9 +940,8 @@ def update( ... @overload - def update( + async def create( self, - uuid: str, *, config: GenericOAuthConfigParam, name: str, @@ -908,11 +957,9 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IdentityProvider]: """ - Updates a configured identity provider. + Adds a new identity provider to Access. Args: - uuid: UUID - config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). @@ -941,9 +988,8 @@ def update( ... @overload - def update( + async def create( self, - uuid: str, *, config: GenericOAuthConfigParam, name: str, @@ -959,11 +1005,9 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IdentityProvider]: """ - Updates a configured identity provider. + Adds a new identity provider to Access. Args: - uuid: UUID - config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). @@ -992,11 +1036,10 @@ def update( ... @overload - def update( + async def create( self, - uuid: str, *, - config: identity_provider_update_params.AccessGoogleConfig, + config: identity_provider_create_params.AccessGoogleConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, @@ -1010,11 +1053,9 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IdentityProvider]: """ - Updates a configured identity provider. + Adds a new identity provider to Access. Args: - uuid: UUID - config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). @@ -1043,11 +1084,10 @@ def update( ... @overload - def update( + async def create( self, - uuid: str, *, - config: identity_provider_update_params.AccessGoogleAppsConfig, + config: identity_provider_create_params.AccessGoogleAppsConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, @@ -1061,11 +1101,9 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IdentityProvider]: """ - Updates a configured identity provider. + Adds a new identity provider to Access. Args: - uuid: UUID - config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). @@ -1094,9 +1132,8 @@ def update( ... @overload - def update( + async def create( self, - uuid: str, *, config: GenericOAuthConfigParam, name: str, @@ -1112,11 +1149,9 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IdentityProvider]: """ - Updates a configured identity provider. + Adds a new identity provider to Access. Args: - uuid: UUID - config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). @@ -1145,11 +1180,10 @@ def update( ... @overload - def update( + async def create( self, - uuid: str, *, - config: identity_provider_update_params.AccessOIDCConfig, + config: identity_provider_create_params.AccessOIDCConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, @@ -1163,11 +1197,9 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IdentityProvider]: """ - Updates a configured identity provider. + Adds a new identity provider to Access. Args: - uuid: UUID - config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). @@ -1196,11 +1228,10 @@ def update( ... @overload - def update( + async def create( self, - uuid: str, *, - config: identity_provider_update_params.AccessOktaConfig, + config: identity_provider_create_params.AccessOktaConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, @@ -1214,11 +1245,9 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IdentityProvider]: """ - Updates a configured identity provider. + Adds a new identity provider to Access. Args: - uuid: UUID - config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). @@ -1247,11 +1276,10 @@ def update( ... @overload - def update( + async def create( self, - uuid: str, *, - config: identity_provider_update_params.AccessOneloginConfig, + config: identity_provider_create_params.AccessOneloginConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, @@ -1265,11 +1293,9 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IdentityProvider]: """ - Updates a configured identity provider. + Adds a new identity provider to Access. Args: - uuid: UUID - config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). @@ -1298,11 +1324,10 @@ def update( ... @overload - def update( + async def create( self, - uuid: str, *, - config: identity_provider_update_params.AccessPingoneConfig, + config: identity_provider_create_params.AccessPingoneConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, @@ -1316,11 +1341,9 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IdentityProvider]: """ - Updates a configured identity provider. + Adds a new identity provider to Access. Args: - uuid: UUID - config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). @@ -1349,11 +1372,10 @@ def update( ... @overload - def update( + async def create( self, - uuid: str, *, - config: identity_provider_update_params.AccessSAMLConfig, + config: identity_provider_create_params.AccessSAMLConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, @@ -1367,11 +1389,9 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IdentityProvider]: """ - Updates a configured identity provider. + Adds a new identity provider to Access. Args: - uuid: UUID - config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). @@ -1400,9 +1420,8 @@ def update( ... @overload - def update( + async def create( self, - uuid: str, *, config: GenericOAuthConfigParam, name: str, @@ -1418,11 +1437,9 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IdentityProvider]: """ - Updates a configured identity provider. + Adds a new identity provider to Access. Args: - uuid: UUID - config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). @@ -1451,9 +1468,8 @@ def update( ... @overload - def update( + async def create( self, - uuid: str, *, config: object, name: str, @@ -1469,11 +1485,9 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IdentityProvider]: """ - Updates a configured identity provider. + Adds a new identity provider to Access. Args: - uuid: UUID - config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). @@ -1502,20 +1516,19 @@ def update( ... @required_args(["config", "name", "type"]) - def update( + async def create( self, - uuid: str, *, - config: identity_provider_update_params.AzureADConfig - | identity_provider_update_params.AccessCentrifyConfig + config: identity_provider_create_params.AzureADConfig + | identity_provider_create_params.AccessCentrifyConfig | GenericOAuthConfigParam - | identity_provider_update_params.AccessGoogleConfig - | identity_provider_update_params.AccessGoogleAppsConfig - | identity_provider_update_params.AccessOIDCConfig - | identity_provider_update_params.AccessOktaConfig - | identity_provider_update_params.AccessOneloginConfig - | identity_provider_update_params.AccessPingoneConfig - | identity_provider_update_params.AccessSAMLConfig + | identity_provider_create_params.AccessGoogleConfig + | identity_provider_create_params.AccessGoogleAppsConfig + | identity_provider_create_params.AccessOIDCConfig + | identity_provider_create_params.AccessOktaConfig + | identity_provider_create_params.AccessOneloginConfig + | identity_provider_create_params.AccessPingoneConfig + | identity_provider_create_params.AccessSAMLConfig | object, name: str, type: IdentityProviderType, @@ -1529,8 +1542,6 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IdentityProvider]: - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -1545,16 +1556,16 @@ def update( account_or_zone_id = zone_id return cast( Optional[IdentityProvider], - self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{uuid}", - body=maybe_transform( + await self._post( + f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers", + body=await async_maybe_transform( { "config": config, "name": name, "type": type, "scim_config": scim_config, }, - identity_provider_update_params.IdentityProviderUpdateParams, + identity_provider_create_params.IdentityProviderCreateParams, ), options=make_request_options( extra_headers=extra_headers, @@ -1580,7 +1591,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[IdentityProviderListResponse]: + ) -> AsyncPaginator[IdentityProviderListResponse, AsyncSinglePage[IdentityProviderListResponse]]: """ Lists all configured identity providers. @@ -1611,7 +1622,7 @@ def list( account_or_zone_id = zone_id return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers", - page=SyncSinglePage[IdentityProviderListResponse], + page=AsyncSinglePage[IdentityProviderListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1620,1904 +1631,50 @@ def list( ), # Union types cannot be passed in as arguments in the type system ) - def delete( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProviderDeleteResponse]: - """ - Deletes an identity provider from Access. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") +class IdentityProvidersResourceWithRawResponse: + def __init__(self, identity_providers: IdentityProvidersResource) -> None: + self._identity_providers = identity_providers - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[IdentityProviderDeleteResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[IdentityProviderDeleteResponse]], ResultWrapper[IdentityProviderDeleteResponse]), + self.create = to_raw_response_wrapper( + identity_providers.create, + ) + self.list = to_raw_response_wrapper( + identity_providers.list, ) - def get( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Fetches a configured identity provider. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - extra_query: Add additional query parameters to the request +class AsyncIdentityProvidersResourceWithRawResponse: + def __init__(self, identity_providers: AsyncIdentityProvidersResource) -> None: + self._identity_providers = identity_providers - extra_body: Add additional JSON properties to the request + self.create = async_to_raw_response_wrapper( + identity_providers.create, + ) + self.list = async_to_raw_response_wrapper( + identity_providers.list, + ) - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") +class IdentityProvidersResourceWithStreamingResponse: + def __init__(self, identity_providers: IdentityProvidersResource) -> None: + self._identity_providers = identity_providers - account_or_zone = "zones" - account_or_zone_id = zone_id - return cast( - Optional[IdentityProvider], - self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[IdentityProvider]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[IdentityProvider] - ), # Union types cannot be passed in as arguments in the type system - ), + self.create = to_streamed_response_wrapper( + identity_providers.create, + ) + self.list = to_streamed_response_wrapper( + identity_providers.list, ) -class AsyncIdentityProvidersResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncIdentityProvidersResourceWithRawResponse: - return AsyncIdentityProvidersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncIdentityProvidersResourceWithStreamingResponse: - return AsyncIdentityProvidersResourceWithStreamingResponse(self) - - @overload - async def create( - self, - *, - config: identity_provider_create_params.AzureADConfig, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Adds a new identity provider to Access. - - Args: - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - config: identity_provider_create_params.AccessCentrifyConfig, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Adds a new identity provider to Access. - - Args: - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - config: GenericOAuthConfigParam, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Adds a new identity provider to Access. - - Args: - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - config: GenericOAuthConfigParam, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Adds a new identity provider to Access. - - Args: - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - config: identity_provider_create_params.AccessGoogleConfig, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Adds a new identity provider to Access. - - Args: - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - config: identity_provider_create_params.AccessGoogleAppsConfig, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Adds a new identity provider to Access. - - Args: - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - config: GenericOAuthConfigParam, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Adds a new identity provider to Access. - - Args: - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - config: identity_provider_create_params.AccessOIDCConfig, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Adds a new identity provider to Access. - - Args: - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - config: identity_provider_create_params.AccessOktaConfig, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Adds a new identity provider to Access. - - Args: - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - config: identity_provider_create_params.AccessOneloginConfig, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Adds a new identity provider to Access. - - Args: - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - config: identity_provider_create_params.AccessPingoneConfig, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Adds a new identity provider to Access. - - Args: - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - config: identity_provider_create_params.AccessSAMLConfig, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Adds a new identity provider to Access. - - Args: - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - config: GenericOAuthConfigParam, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Adds a new identity provider to Access. - - Args: - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - config: object, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Adds a new identity provider to Access. - - Args: - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @required_args(["config", "name", "type"]) - async def create( - self, - *, - config: identity_provider_create_params.AzureADConfig - | identity_provider_create_params.AccessCentrifyConfig - | GenericOAuthConfigParam - | identity_provider_create_params.AccessGoogleConfig - | identity_provider_create_params.AccessGoogleAppsConfig - | identity_provider_create_params.AccessOIDCConfig - | identity_provider_create_params.AccessOktaConfig - | identity_provider_create_params.AccessOneloginConfig - | identity_provider_create_params.AccessPingoneConfig - | identity_provider_create_params.AccessSAMLConfig - | object, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return cast( - Optional[IdentityProvider], - await self._post( - f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers", - body=await async_maybe_transform( - { - "config": config, - "name": name, - "type": type, - "scim_config": scim_config, - }, - identity_provider_create_params.IdentityProviderCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[IdentityProvider]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[IdentityProvider] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - @overload - async def update( - self, - uuid: str, - *, - config: identity_provider_update_params.AzureADConfig, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Updates a configured identity provider. - - Args: - uuid: UUID - - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - uuid: str, - *, - config: identity_provider_update_params.AccessCentrifyConfig, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Updates a configured identity provider. - - Args: - uuid: UUID - - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - uuid: str, - *, - config: GenericOAuthConfigParam, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Updates a configured identity provider. - - Args: - uuid: UUID - - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - uuid: str, - *, - config: GenericOAuthConfigParam, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Updates a configured identity provider. - - Args: - uuid: UUID - - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - uuid: str, - *, - config: identity_provider_update_params.AccessGoogleConfig, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Updates a configured identity provider. - - Args: - uuid: UUID - - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - uuid: str, - *, - config: identity_provider_update_params.AccessGoogleAppsConfig, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Updates a configured identity provider. - - Args: - uuid: UUID - - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - uuid: str, - *, - config: GenericOAuthConfigParam, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Updates a configured identity provider. - - Args: - uuid: UUID - - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - uuid: str, - *, - config: identity_provider_update_params.AccessOIDCConfig, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Updates a configured identity provider. - - Args: - uuid: UUID - - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - uuid: str, - *, - config: identity_provider_update_params.AccessOktaConfig, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Updates a configured identity provider. - - Args: - uuid: UUID - - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - uuid: str, - *, - config: identity_provider_update_params.AccessOneloginConfig, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Updates a configured identity provider. - - Args: - uuid: UUID - - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - uuid: str, - *, - config: identity_provider_update_params.AccessPingoneConfig, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Updates a configured identity provider. - - Args: - uuid: UUID - - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - uuid: str, - *, - config: identity_provider_update_params.AccessSAMLConfig, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Updates a configured identity provider. - - Args: - uuid: UUID - - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - uuid: str, - *, - config: GenericOAuthConfigParam, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Updates a configured identity provider. - - Args: - uuid: UUID - - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - uuid: str, - *, - config: object, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Updates a configured identity provider. - - Args: - uuid: UUID - - config: The configuration parameters for the identity provider. To view the required - parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - name: The name of the identity provider, shown to users on the login page. - - type: The type of identity provider. To determine the value for a specific provider, - refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - scim_config: The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @required_args(["config", "name", "type"]) - async def update( - self, - uuid: str, - *, - config: identity_provider_update_params.AzureADConfig - | identity_provider_update_params.AccessCentrifyConfig - | GenericOAuthConfigParam - | identity_provider_update_params.AccessGoogleConfig - | identity_provider_update_params.AccessGoogleAppsConfig - | identity_provider_update_params.AccessOIDCConfig - | identity_provider_update_params.AccessOktaConfig - | identity_provider_update_params.AccessOneloginConfig - | identity_provider_update_params.AccessPingoneConfig - | identity_provider_update_params.AccessSAMLConfig - | object, - name: str, - type: IdentityProviderType, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return cast( - Optional[IdentityProvider], - await self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{uuid}", - body=await async_maybe_transform( - { - "config": config, - "name": name, - "type": type, - "scim_config": scim_config, - }, - identity_provider_update_params.IdentityProviderUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[IdentityProvider]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[IdentityProvider] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - def list( - self, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[IdentityProviderListResponse, AsyncSinglePage[IdentityProviderListResponse]]: - """ - Lists all configured identity providers. - - Args: - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._get_api_list( - f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers", - page=AsyncSinglePage[IdentityProviderListResponse], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=cast( - Any, IdentityProviderListResponse - ), # Union types cannot be passed in as arguments in the type system - ) - - async def delete( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProviderDeleteResponse]: - """ - Deletes an identity provider from Access. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return await self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[IdentityProviderDeleteResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[IdentityProviderDeleteResponse]], ResultWrapper[IdentityProviderDeleteResponse]), - ) - - async def get( - self, - uuid: str, - *, - account_id: str | NotGiven = NOT_GIVEN, - zone_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProvider]: - """ - Fetches a configured identity provider. - - Args: - uuid: UUID - - account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - - zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") - - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - if not zone_id: - raise ValueError("You must provide either account_id or zone_id") - - account_or_zone = "zones" - account_or_zone_id = zone_id - return cast( - Optional[IdentityProvider], - await self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{uuid}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[IdentityProvider]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[IdentityProvider] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - -class IdentityProvidersResourceWithRawResponse: - def __init__(self, identity_providers: IdentityProvidersResource) -> None: - self._identity_providers = identity_providers - - self.create = to_raw_response_wrapper( - identity_providers.create, - ) - self.update = to_raw_response_wrapper( - identity_providers.update, - ) - self.list = to_raw_response_wrapper( - identity_providers.list, - ) - self.delete = to_raw_response_wrapper( - identity_providers.delete, - ) - self.get = to_raw_response_wrapper( - identity_providers.get, - ) - - -class AsyncIdentityProvidersResourceWithRawResponse: - def __init__(self, identity_providers: AsyncIdentityProvidersResource) -> None: - self._identity_providers = identity_providers - - self.create = async_to_raw_response_wrapper( - identity_providers.create, - ) - self.update = async_to_raw_response_wrapper( - identity_providers.update, - ) - self.list = async_to_raw_response_wrapper( - identity_providers.list, - ) - self.delete = async_to_raw_response_wrapper( - identity_providers.delete, - ) - self.get = async_to_raw_response_wrapper( - identity_providers.get, - ) - - -class IdentityProvidersResourceWithStreamingResponse: - def __init__(self, identity_providers: IdentityProvidersResource) -> None: - self._identity_providers = identity_providers - - self.create = to_streamed_response_wrapper( - identity_providers.create, - ) - self.update = to_streamed_response_wrapper( - identity_providers.update, - ) - self.list = to_streamed_response_wrapper( - identity_providers.list, - ) - self.delete = to_streamed_response_wrapper( - identity_providers.delete, - ) - self.get = to_streamed_response_wrapper( - identity_providers.get, - ) - - -class AsyncIdentityProvidersResourceWithStreamingResponse: - def __init__(self, identity_providers: AsyncIdentityProvidersResource) -> None: - self._identity_providers = identity_providers +class AsyncIdentityProvidersResourceWithStreamingResponse: + def __init__(self, identity_providers: AsyncIdentityProvidersResource) -> None: + self._identity_providers = identity_providers self.create = async_to_streamed_response_wrapper( identity_providers.create, ) - self.update = async_to_streamed_response_wrapper( - identity_providers.update, - ) self.list = async_to_streamed_response_wrapper( identity_providers.list, ) - self.delete = async_to_streamed_response_wrapper( - identity_providers.delete, - ) - self.get = async_to_streamed_response_wrapper( - identity_providers.get, - ) diff --git a/src/cloudflare/resources/zero_trust/seats.py b/src/cloudflare/resources/zero_trust/seats.py deleted file mode 100644 index c1368cd0512..00000000000 --- a/src/cloudflare/resources/zero_trust/seats.py +++ /dev/null @@ -1,169 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Iterable, Optional, cast - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._wrappers import ResultWrapper -from ..._base_client import ( - make_request_options, -) -from ...types.zero_trust import seat_edit_params -from ...types.zero_trust.seat_edit_response import SeatEditResponse - -__all__ = ["SeatsResource", "AsyncSeatsResource"] - - -class SeatsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> SeatsResourceWithRawResponse: - return SeatsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> SeatsResourceWithStreamingResponse: - return SeatsResourceWithStreamingResponse(self) - - def edit( - self, - identifier: str, - *, - body: Iterable[seat_edit_params.Body], - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[SeatEditResponse]: - """ - Removes a user from a Zero Trust seat when both `access_seat` and `gateway_seat` - are set to false. - - Args: - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._patch( - f"/accounts/{identifier}/access/seats", - body=maybe_transform(body, seat_edit_params.SeatEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SeatEditResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[SeatEditResponse]], ResultWrapper[SeatEditResponse]), - ) - - -class AsyncSeatsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncSeatsResourceWithRawResponse: - return AsyncSeatsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncSeatsResourceWithStreamingResponse: - return AsyncSeatsResourceWithStreamingResponse(self) - - async def edit( - self, - identifier: str, - *, - body: Iterable[seat_edit_params.Body], - # 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[SeatEditResponse]: - """ - Removes a user from a Zero Trust seat when both `access_seat` and `gateway_seat` - are set to false. - - Args: - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._patch( - f"/accounts/{identifier}/access/seats", - body=await async_maybe_transform(body, seat_edit_params.SeatEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SeatEditResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[SeatEditResponse]], ResultWrapper[SeatEditResponse]), - ) - - -class SeatsResourceWithRawResponse: - def __init__(self, seats: SeatsResource) -> None: - self._seats = seats - - self.edit = to_raw_response_wrapper( - seats.edit, - ) - - -class AsyncSeatsResourceWithRawResponse: - def __init__(self, seats: AsyncSeatsResource) -> None: - self._seats = seats - - self.edit = async_to_raw_response_wrapper( - seats.edit, - ) - - -class SeatsResourceWithStreamingResponse: - def __init__(self, seats: SeatsResource) -> None: - self._seats = seats - - self.edit = to_streamed_response_wrapper( - seats.edit, - ) - - -class AsyncSeatsResourceWithStreamingResponse: - def __init__(self, seats: AsyncSeatsResource) -> None: - self._seats = seats - - self.edit = async_to_streamed_response_wrapper( - seats.edit, - ) diff --git a/src/cloudflare/resources/zero_trust/zero_trust.py b/src/cloudflare/resources/zero_trust/zero_trust.py index 63aefc65ac1..880f0f44ea4 100644 --- a/src/cloudflare/resources/zero_trust/zero_trust.py +++ b/src/cloudflare/resources/zero_trust/zero_trust.py @@ -18,14 +18,6 @@ DLPResourceWithStreamingResponse, AsyncDLPResourceWithStreamingResponse, ) -from .seats import ( - SeatsResource, - AsyncSeatsResource, - SeatsResourceWithRawResponse, - AsyncSeatsResourceWithRawResponse, - SeatsResourceWithStreamingResponse, - AsyncSeatsResourceWithStreamingResponse, -) from .access import ( AccessResource, AsyncAccessResource, @@ -125,10 +117,6 @@ def identity_providers(self) -> IdentityProvidersResource: def organizations(self) -> OrganizationsResource: return OrganizationsResource(self._client) - @cached_property - def seats(self) -> SeatsResource: - return SeatsResource(self._client) - @cached_property def access(self) -> AccessResource: return AccessResource(self._client) @@ -183,10 +171,6 @@ def identity_providers(self) -> AsyncIdentityProvidersResource: def organizations(self) -> AsyncOrganizationsResource: return AsyncOrganizationsResource(self._client) - @cached_property - def seats(self) -> AsyncSeatsResource: - return AsyncSeatsResource(self._client) - @cached_property def access(self) -> AsyncAccessResource: return AsyncAccessResource(self._client) @@ -244,10 +228,6 @@ def identity_providers(self) -> IdentityProvidersResourceWithRawResponse: def organizations(self) -> OrganizationsResourceWithRawResponse: return OrganizationsResourceWithRawResponse(self._zero_trust.organizations) - @cached_property - def seats(self) -> SeatsResourceWithRawResponse: - return SeatsResourceWithRawResponse(self._zero_trust.seats) - @cached_property def access(self) -> AccessResourceWithRawResponse: return AccessResourceWithRawResponse(self._zero_trust.access) @@ -297,10 +277,6 @@ def identity_providers(self) -> AsyncIdentityProvidersResourceWithRawResponse: def organizations(self) -> AsyncOrganizationsResourceWithRawResponse: return AsyncOrganizationsResourceWithRawResponse(self._zero_trust.organizations) - @cached_property - def seats(self) -> AsyncSeatsResourceWithRawResponse: - return AsyncSeatsResourceWithRawResponse(self._zero_trust.seats) - @cached_property def access(self) -> AsyncAccessResourceWithRawResponse: return AsyncAccessResourceWithRawResponse(self._zero_trust.access) @@ -350,10 +326,6 @@ def identity_providers(self) -> IdentityProvidersResourceWithStreamingResponse: def organizations(self) -> OrganizationsResourceWithStreamingResponse: return OrganizationsResourceWithStreamingResponse(self._zero_trust.organizations) - @cached_property - def seats(self) -> SeatsResourceWithStreamingResponse: - return SeatsResourceWithStreamingResponse(self._zero_trust.seats) - @cached_property def access(self) -> AccessResourceWithStreamingResponse: return AccessResourceWithStreamingResponse(self._zero_trust.access) @@ -403,10 +375,6 @@ def identity_providers(self) -> AsyncIdentityProvidersResourceWithStreamingRespo def organizations(self) -> AsyncOrganizationsResourceWithStreamingResponse: return AsyncOrganizationsResourceWithStreamingResponse(self._zero_trust.organizations) - @cached_property - def seats(self) -> AsyncSeatsResourceWithStreamingResponse: - return AsyncSeatsResourceWithStreamingResponse(self._zero_trust.seats) - @cached_property def access(self) -> AsyncAccessResourceWithStreamingResponse: return AsyncAccessResourceWithStreamingResponse(self._zero_trust.access) diff --git a/src/cloudflare/types/api_gateway/__init__.py b/src/cloudflare/types/api_gateway/__init__.py index 9b7ba5574de..15e921a339f 100644 --- a/src/cloudflare/types/api_gateway/__init__.py +++ b/src/cloudflare/types/api_gateway/__init__.py @@ -2,7 +2,6 @@ from __future__ import annotations -from .schema import Schema as Schema from .message import Message as Message from .api_shield import APIShield as APIShield from .configuration import Configuration as Configuration diff --git a/src/cloudflare/types/api_gateway/schema.py b/src/cloudflare/types/api_gateway/schema.py deleted file mode 100644 index 5b44bcf0853..00000000000 --- a/src/cloudflare/types/api_gateway/schema.py +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional - -from .message import Message -from ..._models import BaseModel - -__all__ = ["Schema"] - - -class Schema(BaseModel): - errors: Message - - messages: Message - - result: Union[Optional[str], Optional[object]] - - success: bool - """Whether the API call was successful""" diff --git a/src/cloudflare/types/cloudforce_one/request_delete_response.py b/src/cloudflare/types/cloudforce_one/request_delete_response.py index f6dca1edb3f..b7ed5ffbe10 100644 --- a/src/cloudflare/types/cloudforce_one/request_delete_response.py +++ b/src/cloudflare/types/cloudforce_one/request_delete_response.py @@ -1,7 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List +from typing_extensions import Literal + +from ..._models import BaseModel +from ..shared.response_info import ResponseInfo __all__ = ["RequestDeleteResponse"] -RequestDeleteResponse = Union[List[object], str, object] + +class RequestDeleteResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + success: Literal[True] + """Whether the API call was successful""" diff --git a/src/cloudflare/types/cloudforce_one/requests/message_delete_response.py b/src/cloudflare/types/cloudforce_one/requests/message_delete_response.py index eaadbea2ab5..a0d45a64036 100644 --- a/src/cloudflare/types/cloudforce_one/requests/message_delete_response.py +++ b/src/cloudflare/types/cloudforce_one/requests/message_delete_response.py @@ -1,7 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List +from typing_extensions import Literal + +from ...._models import BaseModel +from ...shared.response_info import ResponseInfo __all__ = ["MessageDeleteResponse"] -MessageDeleteResponse = Union[List[object], str, object] + +class MessageDeleteResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + success: Literal[True] + """Whether the API call was successful""" diff --git a/src/cloudflare/types/cloudforce_one/requests/priority_delete_response.py b/src/cloudflare/types/cloudforce_one/requests/priority_delete_response.py index 60bd9aae8bd..ee172239bfe 100644 --- a/src/cloudflare/types/cloudforce_one/requests/priority_delete_response.py +++ b/src/cloudflare/types/cloudforce_one/requests/priority_delete_response.py @@ -1,7 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List +from typing_extensions import Literal + +from ...._models import BaseModel +from ...shared.response_info import ResponseInfo __all__ = ["PriorityDeleteResponse"] -PriorityDeleteResponse = Union[List[object], str, object] + +class PriorityDeleteResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + success: Literal[True] + """Whether the API call was successful""" diff --git a/src/cloudflare/types/rulesets/phase_get_response.py b/src/cloudflare/types/rulesets/phase_get_response.py index d88c9679596..476a9254497 100644 --- a/src/cloudflare/types/rulesets/phase_get_response.py +++ b/src/cloudflare/types/rulesets/phase_get_response.py @@ -33,8 +33,6 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", - "RuleRulesetsDDoSDynamicRule", - "RuleRulesetsForceConnectionCloseRule", ] @@ -99,76 +97,6 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" -class RuleRulesetsDDoSDynamicRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["ddos_dynamic"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsForceConnectionCloseRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["force_connection_close"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - Rule = Annotated[ Union[ BlockRule, @@ -187,8 +115,6 @@ class RuleRulesetsForceConnectionCloseRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, - RuleRulesetsDDoSDynamicRule, - RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/phase_update_params.py b/src/cloudflare/types/rulesets/phase_update_params.py index 27f4398d8c9..d1e457901af 100644 --- a/src/cloudflare/types/rulesets/phase_update_params.py +++ b/src/cloudflare/types/rulesets/phase_update_params.py @@ -32,8 +32,6 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", - "RuleRulesetsDDoSDynamicRule", - "RuleRulesetsForceConnectionCloseRule", ] @@ -112,58 +110,6 @@ class RuleRulesetsLogCustomFieldRule(TypedDict, total=False): """The reference of the rule (the rule ID by default).""" -class RuleRulesetsDDoSDynamicRule(TypedDict, total=False): - id: str - """The unique ID of the rule.""" - - action: Literal["ddos_dynamic"] - """The action to perform when the rule matches.""" - - action_parameters: object - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: LoggingParam - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsForceConnectionCloseRule(TypedDict, total=False): - id: str - """The unique ID of the rule.""" - - action: Literal["force_connection_close"] - """The action to perform when the rule matches.""" - - action_parameters: object - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: LoggingParam - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - Rule = Union[ BlockRuleParam, ChallengeRuleParam, @@ -181,6 +127,4 @@ class RuleRulesetsForceConnectionCloseRule(TypedDict, total=False): SkipRuleParam, SetCacheSettingsRuleParam, RuleRulesetsLogCustomFieldRule, - RuleRulesetsDDoSDynamicRule, - RuleRulesetsForceConnectionCloseRule, ] diff --git a/src/cloudflare/types/rulesets/phase_update_response.py b/src/cloudflare/types/rulesets/phase_update_response.py index 3e00524ec11..a92b28cb216 100644 --- a/src/cloudflare/types/rulesets/phase_update_response.py +++ b/src/cloudflare/types/rulesets/phase_update_response.py @@ -33,8 +33,6 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", - "RuleRulesetsDDoSDynamicRule", - "RuleRulesetsForceConnectionCloseRule", ] @@ -99,76 +97,6 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" -class RuleRulesetsDDoSDynamicRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["ddos_dynamic"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsForceConnectionCloseRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["force_connection_close"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - Rule = Annotated[ Union[ BlockRule, @@ -187,8 +115,6 @@ class RuleRulesetsForceConnectionCloseRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, - RuleRulesetsDDoSDynamicRule, - RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/phases/version_get_response.py b/src/cloudflare/types/rulesets/phases/version_get_response.py index 3c7d7b05653..bf04a129360 100644 --- a/src/cloudflare/types/rulesets/phases/version_get_response.py +++ b/src/cloudflare/types/rulesets/phases/version_get_response.py @@ -33,8 +33,6 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", - "RuleRulesetsDDoSDynamicRule", - "RuleRulesetsForceConnectionCloseRule", ] @@ -99,76 +97,6 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" -class RuleRulesetsDDoSDynamicRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["ddos_dynamic"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsForceConnectionCloseRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["force_connection_close"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - Rule = Annotated[ Union[ BlockRule, @@ -187,8 +115,6 @@ class RuleRulesetsForceConnectionCloseRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, - RuleRulesetsDDoSDynamicRule, - RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/rule_create_params.py b/src/cloudflare/types/rulesets/rule_create_params.py index f027d1e1dc5..e08bad9f0e5 100644 --- a/src/cloudflare/types/rulesets/rule_create_params.py +++ b/src/cloudflare/types/rulesets/rule_create_params.py @@ -76,8 +76,6 @@ "RulesetsLogCustomFieldRuleActionParametersCookieField", "RulesetsLogCustomFieldRuleActionParametersRequestField", "RulesetsLogCustomFieldRuleActionParametersResponseField", - "RulesetsDDoSDynamicRule", - "RulesetsForceConnectionCloseRule", ] @@ -1207,70 +1205,6 @@ class RulesetsLogCustomFieldRuleActionParameters(TypedDict, total=False): """The response fields to log.""" -class RulesetsDDoSDynamicRule(TypedDict, total=False): - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - id: str - """The unique ID of the rule.""" - - action: Literal["ddos_dynamic"] - """The action to perform when the rule matches.""" - - action_parameters: object - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: LoggingParam - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - -class RulesetsForceConnectionCloseRule(TypedDict, total=False): - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - id: str - """The unique ID of the rule.""" - - action: Literal["force_connection_close"] - """The action to perform when the rule matches.""" - - action_parameters: object - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: LoggingParam - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - RuleCreateParams = Union[ BlockRule, ChallengeRule, @@ -1288,6 +1222,4 @@ class RulesetsForceConnectionCloseRule(TypedDict, total=False): SkipRule, SetCacheSettingsRule, RulesetsLogCustomFieldRule, - RulesetsDDoSDynamicRule, - RulesetsForceConnectionCloseRule, ] diff --git a/src/cloudflare/types/rulesets/rule_create_response.py b/src/cloudflare/types/rulesets/rule_create_response.py index 04e3457f902..9a729d3fbe1 100644 --- a/src/cloudflare/types/rulesets/rule_create_response.py +++ b/src/cloudflare/types/rulesets/rule_create_response.py @@ -33,8 +33,6 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", - "RuleRulesetsDDoSDynamicRule", - "RuleRulesetsForceConnectionCloseRule", ] @@ -99,76 +97,6 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" -class RuleRulesetsDDoSDynamicRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["ddos_dynamic"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsForceConnectionCloseRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["force_connection_close"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - Rule = Annotated[ Union[ BlockRule, @@ -187,8 +115,6 @@ class RuleRulesetsForceConnectionCloseRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, - RuleRulesetsDDoSDynamicRule, - RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/rule_delete_response.py b/src/cloudflare/types/rulesets/rule_delete_response.py index 25d801cd5aa..1b6810d585e 100644 --- a/src/cloudflare/types/rulesets/rule_delete_response.py +++ b/src/cloudflare/types/rulesets/rule_delete_response.py @@ -33,8 +33,6 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", - "RuleRulesetsDDoSDynamicRule", - "RuleRulesetsForceConnectionCloseRule", ] @@ -99,76 +97,6 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" -class RuleRulesetsDDoSDynamicRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["ddos_dynamic"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsForceConnectionCloseRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["force_connection_close"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - Rule = Annotated[ Union[ BlockRule, @@ -187,8 +115,6 @@ class RuleRulesetsForceConnectionCloseRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, - RuleRulesetsDDoSDynamicRule, - RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/rule_edit_params.py b/src/cloudflare/types/rulesets/rule_edit_params.py index 8382c7d8687..86c8418e7c8 100644 --- a/src/cloudflare/types/rulesets/rule_edit_params.py +++ b/src/cloudflare/types/rulesets/rule_edit_params.py @@ -76,8 +76,6 @@ "RulesetsLogCustomFieldRuleActionParametersCookieField", "RulesetsLogCustomFieldRuleActionParametersRequestField", "RulesetsLogCustomFieldRuleActionParametersResponseField", - "RulesetsDDoSDynamicRule", - "RulesetsForceConnectionCloseRule", ] @@ -1255,76 +1253,6 @@ class RulesetsLogCustomFieldRuleActionParameters(TypedDict, total=False): """The response fields to log.""" -class RulesetsDDoSDynamicRule(TypedDict, total=False): - ruleset_id: Required[str] - """The unique ID of the ruleset.""" - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - id: str - """The unique ID of the rule.""" - - action: Literal["ddos_dynamic"] - """The action to perform when the rule matches.""" - - action_parameters: object - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: LoggingParam - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - -class RulesetsForceConnectionCloseRule(TypedDict, total=False): - ruleset_id: Required[str] - """The unique ID of the ruleset.""" - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - id: str - """The unique ID of the rule.""" - - action: Literal["force_connection_close"] - """The action to perform when the rule matches.""" - - action_parameters: object - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: LoggingParam - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - RuleEditParams = Union[ BlockRule, ChallengeRule, @@ -1342,6 +1270,4 @@ class RulesetsForceConnectionCloseRule(TypedDict, total=False): SkipRule, SetCacheSettingsRule, RulesetsLogCustomFieldRule, - RulesetsDDoSDynamicRule, - RulesetsForceConnectionCloseRule, ] diff --git a/src/cloudflare/types/rulesets/rule_edit_response.py b/src/cloudflare/types/rulesets/rule_edit_response.py index 47dd4534324..3bf0100ef6f 100644 --- a/src/cloudflare/types/rulesets/rule_edit_response.py +++ b/src/cloudflare/types/rulesets/rule_edit_response.py @@ -33,8 +33,6 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", - "RuleRulesetsDDoSDynamicRule", - "RuleRulesetsForceConnectionCloseRule", ] @@ -99,76 +97,6 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" -class RuleRulesetsDDoSDynamicRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["ddos_dynamic"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsForceConnectionCloseRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["force_connection_close"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - Rule = Annotated[ Union[ BlockRule, @@ -187,8 +115,6 @@ class RuleRulesetsForceConnectionCloseRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, - RuleRulesetsDDoSDynamicRule, - RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/ruleset_create_params.py b/src/cloudflare/types/rulesets/ruleset_create_params.py index 4e372271bef..6d34a46fac5 100644 --- a/src/cloudflare/types/rulesets/ruleset_create_params.py +++ b/src/cloudflare/types/rulesets/ruleset_create_params.py @@ -32,8 +32,6 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", - "RuleRulesetsDDoSDynamicRule", - "RuleRulesetsForceConnectionCloseRule", ] @@ -112,58 +110,6 @@ class RuleRulesetsLogCustomFieldRule(TypedDict, total=False): """The reference of the rule (the rule ID by default).""" -class RuleRulesetsDDoSDynamicRule(TypedDict, total=False): - id: str - """The unique ID of the rule.""" - - action: Literal["ddos_dynamic"] - """The action to perform when the rule matches.""" - - action_parameters: object - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: LoggingParam - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsForceConnectionCloseRule(TypedDict, total=False): - id: str - """The unique ID of the rule.""" - - action: Literal["force_connection_close"] - """The action to perform when the rule matches.""" - - action_parameters: object - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: LoggingParam - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - Rule = Union[ BlockRuleParam, ChallengeRuleParam, @@ -181,6 +127,4 @@ class RuleRulesetsForceConnectionCloseRule(TypedDict, total=False): SkipRuleParam, SetCacheSettingsRuleParam, RuleRulesetsLogCustomFieldRule, - RuleRulesetsDDoSDynamicRule, - RuleRulesetsForceConnectionCloseRule, ] diff --git a/src/cloudflare/types/rulesets/ruleset_create_response.py b/src/cloudflare/types/rulesets/ruleset_create_response.py index bfeacd5afd4..f87b58ceec8 100644 --- a/src/cloudflare/types/rulesets/ruleset_create_response.py +++ b/src/cloudflare/types/rulesets/ruleset_create_response.py @@ -33,8 +33,6 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", - "RuleRulesetsDDoSDynamicRule", - "RuleRulesetsForceConnectionCloseRule", ] @@ -99,76 +97,6 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" -class RuleRulesetsDDoSDynamicRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["ddos_dynamic"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsForceConnectionCloseRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["force_connection_close"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - Rule = Annotated[ Union[ BlockRule, @@ -187,8 +115,6 @@ class RuleRulesetsForceConnectionCloseRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, - RuleRulesetsDDoSDynamicRule, - RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/ruleset_get_response.py b/src/cloudflare/types/rulesets/ruleset_get_response.py index 328ba42b25a..d5864df9b91 100644 --- a/src/cloudflare/types/rulesets/ruleset_get_response.py +++ b/src/cloudflare/types/rulesets/ruleset_get_response.py @@ -33,8 +33,6 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", - "RuleRulesetsDDoSDynamicRule", - "RuleRulesetsForceConnectionCloseRule", ] @@ -99,76 +97,6 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" -class RuleRulesetsDDoSDynamicRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["ddos_dynamic"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsForceConnectionCloseRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["force_connection_close"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - Rule = Annotated[ Union[ BlockRule, @@ -187,8 +115,6 @@ class RuleRulesetsForceConnectionCloseRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, - RuleRulesetsDDoSDynamicRule, - RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/ruleset_update_params.py b/src/cloudflare/types/rulesets/ruleset_update_params.py index e2ff9a9fcb8..ce723859ed9 100644 --- a/src/cloudflare/types/rulesets/ruleset_update_params.py +++ b/src/cloudflare/types/rulesets/ruleset_update_params.py @@ -32,8 +32,6 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", - "RuleRulesetsDDoSDynamicRule", - "RuleRulesetsForceConnectionCloseRule", ] @@ -112,58 +110,6 @@ class RuleRulesetsLogCustomFieldRule(TypedDict, total=False): """The reference of the rule (the rule ID by default).""" -class RuleRulesetsDDoSDynamicRule(TypedDict, total=False): - id: str - """The unique ID of the rule.""" - - action: Literal["ddos_dynamic"] - """The action to perform when the rule matches.""" - - action_parameters: object - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: LoggingParam - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsForceConnectionCloseRule(TypedDict, total=False): - id: str - """The unique ID of the rule.""" - - action: Literal["force_connection_close"] - """The action to perform when the rule matches.""" - - action_parameters: object - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: LoggingParam - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - Rule = Union[ BlockRuleParam, ChallengeRuleParam, @@ -181,6 +127,4 @@ class RuleRulesetsForceConnectionCloseRule(TypedDict, total=False): SkipRuleParam, SetCacheSettingsRuleParam, RuleRulesetsLogCustomFieldRule, - RuleRulesetsDDoSDynamicRule, - RuleRulesetsForceConnectionCloseRule, ] diff --git a/src/cloudflare/types/rulesets/ruleset_update_response.py b/src/cloudflare/types/rulesets/ruleset_update_response.py index 9fb84d0d26a..d2aaaa91d6f 100644 --- a/src/cloudflare/types/rulesets/ruleset_update_response.py +++ b/src/cloudflare/types/rulesets/ruleset_update_response.py @@ -33,8 +33,6 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", - "RuleRulesetsDDoSDynamicRule", - "RuleRulesetsForceConnectionCloseRule", ] @@ -99,76 +97,6 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" -class RuleRulesetsDDoSDynamicRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["ddos_dynamic"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsForceConnectionCloseRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["force_connection_close"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - Rule = Annotated[ Union[ BlockRule, @@ -187,8 +115,6 @@ class RuleRulesetsForceConnectionCloseRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, - RuleRulesetsDDoSDynamicRule, - RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/version_get_response.py b/src/cloudflare/types/rulesets/version_get_response.py index abb1cfae6c7..4d61f17e3ec 100644 --- a/src/cloudflare/types/rulesets/version_get_response.py +++ b/src/cloudflare/types/rulesets/version_get_response.py @@ -33,8 +33,6 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", - "RuleRulesetsDDoSDynamicRule", - "RuleRulesetsForceConnectionCloseRule", ] @@ -99,76 +97,6 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" -class RuleRulesetsDDoSDynamicRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["ddos_dynamic"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsForceConnectionCloseRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["force_connection_close"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - Rule = Annotated[ Union[ BlockRule, @@ -187,8 +115,6 @@ class RuleRulesetsForceConnectionCloseRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, - RuleRulesetsDDoSDynamicRule, - RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] 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 058c549bc29..62def70b1fd 100644 --- a/src/cloudflare/types/rulesets/versions/by_tag_get_response.py +++ b/src/cloudflare/types/rulesets/versions/by_tag_get_response.py @@ -33,8 +33,6 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", - "RuleRulesetsDDoSDynamicRule", - "RuleRulesetsForceConnectionCloseRule", ] @@ -99,76 +97,6 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" -class RuleRulesetsDDoSDynamicRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["ddos_dynamic"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsForceConnectionCloseRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["force_connection_close"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[Logging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - Rule = Annotated[ Union[ BlockRule, @@ -187,8 +115,6 @@ class RuleRulesetsForceConnectionCloseRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, - RuleRulesetsDDoSDynamicRule, - RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/zero_trust/__init__.py b/src/cloudflare/types/zero_trust/__init__.py index fe2de93ed13..2cd39fd22ee 100644 --- a/src/cloudflare/types/zero_trust/__init__.py +++ b/src/cloudflare/types/zero_trust/__init__.py @@ -2,7 +2,6 @@ from __future__ import annotations -from .seat import Seat as Seat from .device import Device as Device from .ip_rule import IPRule as IPRule from .azure_ad import AzureAD as AzureAD @@ -27,7 +26,6 @@ from .certificate_rule import CertificateRule as CertificateRule from .email_rule_param import EmailRuleParam as EmailRuleParam from .group_rule_param import GroupRuleParam as GroupRuleParam -from .seat_edit_params import SeatEditParams as SeatEditParams from .access_rule_param import AccessRuleParam as AccessRuleParam from .domain_rule_param import DomainRuleParam as DomainRuleParam from .gsuite_group_rule import GSuiteGroupRule as GSuiteGroupRule @@ -36,7 +34,6 @@ 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 -from .seat_edit_response import SeatEditResponse as SeatEditResponse from .service_token_rule import ServiceTokenRule as ServiceTokenRule from .tunnel_edit_params import TunnelEditParams as TunnelEditParams from .tunnel_list_params import TunnelListParams as TunnelListParams @@ -76,13 +73,11 @@ from .github_organization_rule_param import GitHubOrganizationRuleParam as GitHubOrganizationRuleParam from .identity_provider_create_params import IdentityProviderCreateParams as IdentityProviderCreateParams from .identity_provider_list_response import IdentityProviderListResponse as IdentityProviderListResponse -from .identity_provider_update_params import IdentityProviderUpdateParams as IdentityProviderUpdateParams from .access_device_posture_rule_param import AccessDevicePostureRuleParam as AccessDevicePostureRuleParam from .authentication_method_rule_param import AuthenticationMethodRuleParam as AuthenticationMethodRuleParam from .connectivity_setting_edit_params import ConnectivitySettingEditParams as ConnectivitySettingEditParams from .organization_revoke_users_params import OrganizationRevokeUsersParams as OrganizationRevokeUsersParams from .connectivity_setting_get_response import ConnectivitySettingGetResponse as ConnectivitySettingGetResponse -from .identity_provider_delete_response import IdentityProviderDeleteResponse as IdentityProviderDeleteResponse from .any_valid_service_token_rule_param import AnyValidServiceTokenRuleParam as AnyValidServiceTokenRuleParam from .connectivity_setting_edit_response import ConnectivitySettingEditResponse as ConnectivitySettingEditResponse from .organization_revoke_users_response import OrganizationRevokeUsersResponse as OrganizationRevokeUsersResponse diff --git a/src/cloudflare/types/zero_trust/access/__init__.py b/src/cloudflare/types/zero_trust/access/__init__.py index 8b8d5c829cf..2645e488cfc 100644 --- a/src/cloudflare/types/zero_trust/access/__init__.py +++ b/src/cloudflare/types/zero_trust/access/__init__.py @@ -2,12 +2,8 @@ from __future__ import annotations -from .tag import Tag as Tag -from .bookmark import Bookmark as Bookmark from .decision import Decision as Decision -from .access_user import AccessUser as AccessUser from .certificate import Certificate as Certificate -from .custom_page import CustomPage as CustomPage from .allowed_idps import AllowedIdPs as AllowedIdPs from .app_id_param import AppIDParam as AppIDParam from .cors_headers import CORSHeaders as CORSHeaders @@ -18,42 +14,22 @@ from .allowed_origins import AllowedOrigins as AllowedOrigins from .saas_app_source import SaaSAppSource as SaaSAppSource from .application_type import ApplicationType as ApplicationType -from .key_get_response import KeyGetResponse as KeyGetResponse from .zero_trust_group import ZeroTrustGroup as ZeroTrustGroup -from .key_update_params import KeyUpdateParams as KeyUpdateParams -from .tag_create_params import TagCreateParams as TagCreateParams -from .tag_update_params import TagUpdateParams as TagUpdateParams from .cors_headers_param import CORSHeadersParam as CORSHeadersParam from .group_create_params import GroupCreateParams as GroupCreateParams -from .group_update_params import GroupUpdateParams as GroupUpdateParams -from .key_rotate_response import KeyRotateResponse as KeyRotateResponse -from .key_update_response import KeyUpdateResponse as KeyUpdateResponse from .saml_saas_app_param import SAMLSaaSAppParam as SAMLSaaSAppParam from .self_hosted_domains import SelfHostedDomains as SelfHostedDomains -from .tag_delete_response import TagDeleteResponse as TagDeleteResponse from .associated_hostnames import AssociatedHostnames as AssociatedHostnames from .saas_app_name_format import SaaSAppNameFormat as SaaSAppNameFormat -from .group_delete_response import GroupDeleteResponse as GroupDeleteResponse from .saas_app_source_param import SaaSAppSourceParam as SaaSAppSourceParam -from .bookmark_create_params import BookmarkCreateParams as BookmarkCreateParams -from .bookmark_update_params import BookmarkUpdateParams as BookmarkUpdateParams from .saas_app_name_id_format import SaaSAppNameIDFormat as SaaSAppNameIDFormat from .application_get_response import ApplicationGetResponse as ApplicationGetResponse -from .bookmark_delete_response import BookmarkDeleteResponse as BookmarkDeleteResponse -from .custom_page_without_html import CustomPageWithoutHTML as CustomPageWithoutHTML from .application_create_params import ApplicationCreateParams as ApplicationCreateParams from .application_list_response import ApplicationListResponse as ApplicationListResponse from .application_update_params import ApplicationUpdateParams as ApplicationUpdateParams from .certificate_create_params import CertificateCreateParams as CertificateCreateParams -from .certificate_update_params import CertificateUpdateParams as CertificateUpdateParams -from .custom_page_create_params import CustomPageCreateParams as CustomPageCreateParams -from .custom_page_update_params import CustomPageUpdateParams as CustomPageUpdateParams from .application_create_response import ApplicationCreateResponse as ApplicationCreateResponse from .application_delete_response import ApplicationDeleteResponse as ApplicationDeleteResponse from .application_update_response import ApplicationUpdateResponse as ApplicationUpdateResponse -from .certificate_delete_response import CertificateDeleteResponse as CertificateDeleteResponse -from .custom_page_delete_response import CustomPageDeleteResponse as CustomPageDeleteResponse from .service_token_create_params import ServiceTokenCreateParams as ServiceTokenCreateParams -from .service_token_update_params import ServiceTokenUpdateParams as ServiceTokenUpdateParams from .service_token_create_response import ServiceTokenCreateResponse as ServiceTokenCreateResponse -from .service_token_rotate_response import ServiceTokenRotateResponse as ServiceTokenRotateResponse diff --git a/src/cloudflare/types/zero_trust/access/access_user.py b/src/cloudflare/types/zero_trust/access/access_user.py deleted file mode 100644 index 2430d721cf2..00000000000 --- a/src/cloudflare/types/zero_trust/access/access_user.py +++ /dev/null @@ -1,41 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from ...._models import BaseModel - -__all__ = ["AccessUser"] - - -class AccessUser(BaseModel): - id: Optional[str] = None - """UUID""" - - access_seat: Optional[bool] = None - """True if the user has authenticated with Cloudflare Access.""" - - active_device_count: Optional[float] = None - """The number of active devices registered to the user.""" - - created_at: Optional[datetime] = None - - email: Optional[str] = None - """The email of the user.""" - - gateway_seat: Optional[bool] = None - """True if the user has logged into the WARP client.""" - - last_successful_login: Optional[datetime] = None - """The time at which the user last successfully logged in.""" - - name: Optional[str] = None - """The name of the user.""" - - seat_uid: Optional[str] = None - """The unique API identifier for the Zero Trust seat.""" - - uid: Optional[str] = None - """The unique API identifier for the user.""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/applications/__init__.py b/src/cloudflare/types/zero_trust/access/applications/__init__.py index 206ec39071b..f34cf3dac26 100644 --- a/src/cloudflare/types/zero_trust/access/applications/__init__.py +++ b/src/cloudflare/types/zero_trust/access/applications/__init__.py @@ -4,16 +4,6 @@ from .ca import CA as CA from .approval_group import ApprovalGroup as ApprovalGroup -from .ca_get_response import CAGetResponse as CAGetResponse -from .ca_create_response import CACreateResponse as CACreateResponse -from .ca_delete_response import CADeleteResponse as CADeleteResponse -from .policy_get_response import PolicyGetResponse as PolicyGetResponse from .approval_group_param import ApprovalGroupParam as ApprovalGroupParam -from .policy_create_params import PolicyCreateParams as PolicyCreateParams -from .policy_list_response import PolicyListResponse as PolicyListResponse -from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams from .user_policy_check_geo import UserPolicyCheckGeo as UserPolicyCheckGeo -from .policy_create_response import PolicyCreateResponse as PolicyCreateResponse -from .policy_delete_response import PolicyDeleteResponse as PolicyDeleteResponse -from .policy_update_response import PolicyUpdateResponse as PolicyUpdateResponse from .user_policy_check_list_response import UserPolicyCheckListResponse as UserPolicyCheckListResponse diff --git a/src/cloudflare/types/zero_trust/access/applications/ca_create_response.py b/src/cloudflare/types/zero_trust/access/applications/ca_create_response.py deleted file mode 100644 index c0a4d7af889..00000000000 --- a/src/cloudflare/types/zero_trust/access/applications/ca_create_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional - -__all__ = ["CACreateResponse"] - -CACreateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/zero_trust/access/applications/ca_delete_response.py b/src/cloudflare/types/zero_trust/access/applications/ca_delete_response.py deleted file mode 100644 index 1067f82cd87..00000000000 --- a/src/cloudflare/types/zero_trust/access/applications/ca_delete_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ....._models import BaseModel - -__all__ = ["CADeleteResponse"] - - -class CADeleteResponse(BaseModel): - id: Optional[str] = None - """The ID of the CA.""" diff --git a/src/cloudflare/types/zero_trust/access/applications/ca_get_response.py b/src/cloudflare/types/zero_trust/access/applications/ca_get_response.py deleted file mode 100644 index 8a2b05ffa92..00000000000 --- a/src/cloudflare/types/zero_trust/access/applications/ca_get_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional - -__all__ = ["CAGetResponse"] - -CAGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/zero_trust/access/applications/policy_create_params.py b/src/cloudflare/types/zero_trust/access/applications/policy_create_params.py deleted file mode 100644 index 358425ac3f4..00000000000 --- a/src/cloudflare/types/zero_trust/access/applications/policy_create_params.py +++ /dev/null @@ -1,79 +0,0 @@ -# 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 Required, TypedDict - -from ..decision import Decision -from ...access_rule_param import AccessRuleParam -from .approval_group_param import ApprovalGroupParam - -__all__ = ["PolicyCreateParams"] - - -class PolicyCreateParams(TypedDict, total=False): - decision: Required[Decision] - """The action Access will take if a user matches this policy.""" - - include: Required[Iterable[AccessRuleParam]] - """Rules evaluated with an OR logical operator. - - A user needs to meet only one of the Include rules. - """ - - name: Required[str] - """The name of the Access policy.""" - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - approval_groups: Iterable[ApprovalGroupParam] - """Administrators who can approve a temporary authentication request.""" - - approval_required: bool - """ - Requires the user to request access from an administrator at the start of each - session. - """ - - exclude: Iterable[AccessRuleParam] - """Rules evaluated with a NOT logical operator. - - To match the policy, a user cannot meet any of the Exclude rules. - """ - - isolation_required: bool - """ - Require this application to be served in an isolated browser for users matching - this policy. 'Client Web Isolation' must be on for the account in order to use - this feature. - """ - - precedence: int - """The order of execution for this policy. - - Must be unique for each policy within an app. - """ - - purpose_justification_prompt: str - """A custom message that will appear on the purpose justification screen.""" - - purpose_justification_required: bool - """Require users to enter a justification when they log in to the application.""" - - require: Iterable[AccessRuleParam] - """Rules evaluated with an AND logical operator. - - To match the policy, a user must meet all of the Require rules. - """ - - session_duration: str - """The amount of time that tokens issued for the application will be valid. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. - """ diff --git a/src/cloudflare/types/zero_trust/access/applications/policy_create_response.py b/src/cloudflare/types/zero_trust/access/applications/policy_create_response.py deleted file mode 100644 index 4b8e4a6d329..00000000000 --- a/src/cloudflare/types/zero_trust/access/applications/policy_create_response.py +++ /dev/null @@ -1,73 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from ..decision import Decision -from ....._models import BaseModel -from ...access_rule import AccessRule -from .approval_group import ApprovalGroup - -__all__ = ["PolicyCreateResponse"] - - -class PolicyCreateResponse(BaseModel): - id: Optional[str] = None - """UUID""" - - approval_groups: Optional[List[ApprovalGroup]] = None - """Administrators who can approve a temporary authentication request.""" - - approval_required: Optional[bool] = None - """ - Requires the user to request access from an administrator at the start of each - session. - """ - - created_at: Optional[datetime] = None - - decision: Optional[Decision] = None - """The action Access will take if a user matches this policy.""" - - exclude: Optional[List[AccessRule]] = None - """Rules evaluated with a NOT logical operator. - - To match the policy, a user cannot meet any of the Exclude rules. - """ - - include: Optional[List[AccessRule]] = None - """Rules evaluated with an OR logical operator. - - A user needs to meet only one of the Include rules. - """ - - isolation_required: Optional[bool] = None - """ - Require this application to be served in an isolated browser for users matching - this policy. 'Client Web Isolation' must be on for the account in order to use - this feature. - """ - - name: Optional[str] = None - """The name of the Access policy.""" - - purpose_justification_prompt: Optional[str] = None - """A custom message that will appear on the purpose justification screen.""" - - purpose_justification_required: Optional[bool] = None - """Require users to enter a justification when they log in to the application.""" - - require: Optional[List[AccessRule]] = None - """Rules evaluated with an AND logical operator. - - To match the policy, a user must meet all of the Require rules. - """ - - session_duration: Optional[str] = None - """The amount of time that tokens issued for the application will be valid. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. - """ - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/applications/policy_delete_response.py b/src/cloudflare/types/zero_trust/access/applications/policy_delete_response.py deleted file mode 100644 index 1d70dce656a..00000000000 --- a/src/cloudflare/types/zero_trust/access/applications/policy_delete_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ....._models import BaseModel - -__all__ = ["PolicyDeleteResponse"] - - -class PolicyDeleteResponse(BaseModel): - id: Optional[str] = None - """UUID""" diff --git a/src/cloudflare/types/zero_trust/access/applications/policy_get_response.py b/src/cloudflare/types/zero_trust/access/applications/policy_get_response.py deleted file mode 100644 index 8f6eac8cf3f..00000000000 --- a/src/cloudflare/types/zero_trust/access/applications/policy_get_response.py +++ /dev/null @@ -1,73 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from ..decision import Decision -from ....._models import BaseModel -from ...access_rule import AccessRule -from .approval_group import ApprovalGroup - -__all__ = ["PolicyGetResponse"] - - -class PolicyGetResponse(BaseModel): - id: Optional[str] = None - """UUID""" - - approval_groups: Optional[List[ApprovalGroup]] = None - """Administrators who can approve a temporary authentication request.""" - - approval_required: Optional[bool] = None - """ - Requires the user to request access from an administrator at the start of each - session. - """ - - created_at: Optional[datetime] = None - - decision: Optional[Decision] = None - """The action Access will take if a user matches this policy.""" - - exclude: Optional[List[AccessRule]] = None - """Rules evaluated with a NOT logical operator. - - To match the policy, a user cannot meet any of the Exclude rules. - """ - - include: Optional[List[AccessRule]] = None - """Rules evaluated with an OR logical operator. - - A user needs to meet only one of the Include rules. - """ - - isolation_required: Optional[bool] = None - """ - Require this application to be served in an isolated browser for users matching - this policy. 'Client Web Isolation' must be on for the account in order to use - this feature. - """ - - name: Optional[str] = None - """The name of the Access policy.""" - - purpose_justification_prompt: Optional[str] = None - """A custom message that will appear on the purpose justification screen.""" - - purpose_justification_required: Optional[bool] = None - """Require users to enter a justification when they log in to the application.""" - - require: Optional[List[AccessRule]] = None - """Rules evaluated with an AND logical operator. - - To match the policy, a user must meet all of the Require rules. - """ - - session_duration: Optional[str] = None - """The amount of time that tokens issued for the application will be valid. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. - """ - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/applications/policy_list_response.py b/src/cloudflare/types/zero_trust/access/applications/policy_list_response.py deleted file mode 100644 index 176b10bf16d..00000000000 --- a/src/cloudflare/types/zero_trust/access/applications/policy_list_response.py +++ /dev/null @@ -1,73 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from ..decision import Decision -from ....._models import BaseModel -from ...access_rule import AccessRule -from .approval_group import ApprovalGroup - -__all__ = ["PolicyListResponse"] - - -class PolicyListResponse(BaseModel): - id: Optional[str] = None - """UUID""" - - approval_groups: Optional[List[ApprovalGroup]] = None - """Administrators who can approve a temporary authentication request.""" - - approval_required: Optional[bool] = None - """ - Requires the user to request access from an administrator at the start of each - session. - """ - - created_at: Optional[datetime] = None - - decision: Optional[Decision] = None - """The action Access will take if a user matches this policy.""" - - exclude: Optional[List[AccessRule]] = None - """Rules evaluated with a NOT logical operator. - - To match the policy, a user cannot meet any of the Exclude rules. - """ - - include: Optional[List[AccessRule]] = None - """Rules evaluated with an OR logical operator. - - A user needs to meet only one of the Include rules. - """ - - isolation_required: Optional[bool] = None - """ - Require this application to be served in an isolated browser for users matching - this policy. 'Client Web Isolation' must be on for the account in order to use - this feature. - """ - - name: Optional[str] = None - """The name of the Access policy.""" - - purpose_justification_prompt: Optional[str] = None - """A custom message that will appear on the purpose justification screen.""" - - purpose_justification_required: Optional[bool] = None - """Require users to enter a justification when they log in to the application.""" - - require: Optional[List[AccessRule]] = None - """Rules evaluated with an AND logical operator. - - To match the policy, a user must meet all of the Require rules. - """ - - session_duration: Optional[str] = None - """The amount of time that tokens issued for the application will be valid. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. - """ - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/applications/policy_update_params.py b/src/cloudflare/types/zero_trust/access/applications/policy_update_params.py deleted file mode 100644 index eab91a04759..00000000000 --- a/src/cloudflare/types/zero_trust/access/applications/policy_update_params.py +++ /dev/null @@ -1,82 +0,0 @@ -# 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 Required, TypedDict - -from ..decision import Decision -from ...access_rule_param import AccessRuleParam -from .approval_group_param import ApprovalGroupParam - -__all__ = ["PolicyUpdateParams"] - - -class PolicyUpdateParams(TypedDict, total=False): - uuid1: Required[str] - """UUID""" - - decision: Required[Decision] - """The action Access will take if a user matches this policy.""" - - include: Required[Iterable[AccessRuleParam]] - """Rules evaluated with an OR logical operator. - - A user needs to meet only one of the Include rules. - """ - - name: Required[str] - """The name of the Access policy.""" - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - approval_groups: Iterable[ApprovalGroupParam] - """Administrators who can approve a temporary authentication request.""" - - approval_required: bool - """ - Requires the user to request access from an administrator at the start of each - session. - """ - - exclude: Iterable[AccessRuleParam] - """Rules evaluated with a NOT logical operator. - - To match the policy, a user cannot meet any of the Exclude rules. - """ - - isolation_required: bool - """ - Require this application to be served in an isolated browser for users matching - this policy. 'Client Web Isolation' must be on for the account in order to use - this feature. - """ - - precedence: int - """The order of execution for this policy. - - Must be unique for each policy within an app. - """ - - purpose_justification_prompt: str - """A custom message that will appear on the purpose justification screen.""" - - purpose_justification_required: bool - """Require users to enter a justification when they log in to the application.""" - - require: Iterable[AccessRuleParam] - """Rules evaluated with an AND logical operator. - - To match the policy, a user must meet all of the Require rules. - """ - - session_duration: str - """The amount of time that tokens issued for the application will be valid. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. - """ diff --git a/src/cloudflare/types/zero_trust/access/applications/policy_update_response.py b/src/cloudflare/types/zero_trust/access/applications/policy_update_response.py deleted file mode 100644 index b5c91e2230c..00000000000 --- a/src/cloudflare/types/zero_trust/access/applications/policy_update_response.py +++ /dev/null @@ -1,73 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from ..decision import Decision -from ....._models import BaseModel -from ...access_rule import AccessRule -from .approval_group import ApprovalGroup - -__all__ = ["PolicyUpdateResponse"] - - -class PolicyUpdateResponse(BaseModel): - id: Optional[str] = None - """UUID""" - - approval_groups: Optional[List[ApprovalGroup]] = None - """Administrators who can approve a temporary authentication request.""" - - approval_required: Optional[bool] = None - """ - Requires the user to request access from an administrator at the start of each - session. - """ - - created_at: Optional[datetime] = None - - decision: Optional[Decision] = None - """The action Access will take if a user matches this policy.""" - - exclude: Optional[List[AccessRule]] = None - """Rules evaluated with a NOT logical operator. - - To match the policy, a user cannot meet any of the Exclude rules. - """ - - include: Optional[List[AccessRule]] = None - """Rules evaluated with an OR logical operator. - - A user needs to meet only one of the Include rules. - """ - - isolation_required: Optional[bool] = None - """ - Require this application to be served in an isolated browser for users matching - this policy. 'Client Web Isolation' must be on for the account in order to use - this feature. - """ - - name: Optional[str] = None - """The name of the Access policy.""" - - purpose_justification_prompt: Optional[str] = None - """A custom message that will appear on the purpose justification screen.""" - - purpose_justification_required: Optional[bool] = None - """Require users to enter a justification when they log in to the application.""" - - require: Optional[List[AccessRule]] = None - """Rules evaluated with an AND logical operator. - - To match the policy, a user must meet all of the Require rules. - """ - - session_duration: Optional[str] = None - """The amount of time that tokens issued for the application will be valid. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. - """ - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/bookmark.py b/src/cloudflare/types/zero_trust/access/bookmark.py deleted file mode 100644 index 5d20f8b964c..00000000000 --- a/src/cloudflare/types/zero_trust/access/bookmark.py +++ /dev/null @@ -1,29 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from ...._models import BaseModel - -__all__ = ["Bookmark"] - - -class Bookmark(BaseModel): - id: Optional[str] = None - """The unique identifier for the Bookmark application.""" - - app_launcher_visible: Optional[bool] = None - """Displays the application in the App Launcher.""" - - created_at: Optional[datetime] = None - - domain: Optional[str] = None - """The domain of the Bookmark application.""" - - logo_url: Optional[str] = None - """The image URL for the logo shown in the App Launcher dashboard.""" - - name: Optional[str] = None - """The name of the Bookmark application.""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/bookmark_create_params.py b/src/cloudflare/types/zero_trust/access/bookmark_create_params.py deleted file mode 100644 index 4680f846d12..00000000000 --- a/src/cloudflare/types/zero_trust/access/bookmark_create_params.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["BookmarkCreateParams"] - - -class BookmarkCreateParams(TypedDict, total=False): - identifier: Required[str] - - body: Required[object] diff --git a/src/cloudflare/types/zero_trust/access/bookmark_delete_response.py b/src/cloudflare/types/zero_trust/access/bookmark_delete_response.py deleted file mode 100644 index 93d03aba051..00000000000 --- a/src/cloudflare/types/zero_trust/access/bookmark_delete_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["BookmarkDeleteResponse"] - - -class BookmarkDeleteResponse(BaseModel): - id: Optional[str] = None - """UUID""" diff --git a/src/cloudflare/types/zero_trust/access/bookmark_update_params.py b/src/cloudflare/types/zero_trust/access/bookmark_update_params.py deleted file mode 100644 index 58286a723f3..00000000000 --- a/src/cloudflare/types/zero_trust/access/bookmark_update_params.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["BookmarkUpdateParams"] - - -class BookmarkUpdateParams(TypedDict, total=False): - identifier: Required[str] - - body: Required[object] diff --git a/src/cloudflare/types/zero_trust/access/certificate_delete_response.py b/src/cloudflare/types/zero_trust/access/certificate_delete_response.py deleted file mode 100644 index 01177266648..00000000000 --- a/src/cloudflare/types/zero_trust/access/certificate_delete_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["CertificateDeleteResponse"] - - -class CertificateDeleteResponse(BaseModel): - id: Optional[str] = None - """UUID""" diff --git a/src/cloudflare/types/zero_trust/access/certificate_update_params.py b/src/cloudflare/types/zero_trust/access/certificate_update_params.py deleted file mode 100644 index e546c333f21..00000000000 --- a/src/cloudflare/types/zero_trust/access/certificate_update_params.py +++ /dev/null @@ -1,24 +0,0 @@ -# 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 Required, TypedDict - -from .associated_hostnames import AssociatedHostnames - -__all__ = ["CertificateUpdateParams"] - - -class CertificateUpdateParams(TypedDict, total=False): - associated_hostnames: Required[List[AssociatedHostnames]] - """The hostnames of the applications that will use this certificate.""" - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - name: str - """The name of the certificate.""" diff --git a/src/cloudflare/types/zero_trust/access/custom_page.py b/src/cloudflare/types/zero_trust/access/custom_page.py deleted file mode 100644 index 4593071d37a..00000000000 --- a/src/cloudflare/types/zero_trust/access/custom_page.py +++ /dev/null @@ -1,30 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["CustomPage"] - - -class CustomPage(BaseModel): - custom_html: str - """Custom page HTML.""" - - name: str - """Custom page name.""" - - type: Literal["identity_denied", "forbidden"] - """Custom page type.""" - - app_count: Optional[int] = None - """Number of apps the custom page is assigned to.""" - - created_at: Optional[datetime] = None - - uid: Optional[str] = None - """UUID""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/custom_page_create_params.py b/src/cloudflare/types/zero_trust/access/custom_page_create_params.py deleted file mode 100644 index f1890d141b8..00000000000 --- a/src/cloudflare/types/zero_trust/access/custom_page_create_params.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["CustomPageCreateParams"] - - -class CustomPageCreateParams(TypedDict, total=False): - custom_html: Required[str] - """Custom page HTML.""" - - name: Required[str] - """Custom page name.""" - - type: Required[Literal["identity_denied", "forbidden"]] - """Custom page type.""" - - app_count: int - """Number of apps the custom page is assigned to.""" diff --git a/src/cloudflare/types/zero_trust/access/custom_page_delete_response.py b/src/cloudflare/types/zero_trust/access/custom_page_delete_response.py deleted file mode 100644 index bb6e38bee3b..00000000000 --- a/src/cloudflare/types/zero_trust/access/custom_page_delete_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["CustomPageDeleteResponse"] - - -class CustomPageDeleteResponse(BaseModel): - id: Optional[str] = None - """UUID""" diff --git a/src/cloudflare/types/zero_trust/access/custom_page_update_params.py b/src/cloudflare/types/zero_trust/access/custom_page_update_params.py deleted file mode 100644 index 71c52739e3f..00000000000 --- a/src/cloudflare/types/zero_trust/access/custom_page_update_params.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["CustomPageUpdateParams"] - - -class CustomPageUpdateParams(TypedDict, total=False): - identifier: Required[str] - """Identifier""" - - custom_html: Required[str] - """Custom page HTML.""" - - name: Required[str] - """Custom page name.""" - - type: Required[Literal["identity_denied", "forbidden"]] - """Custom page type.""" - - app_count: int - """Number of apps the custom page is assigned to.""" diff --git a/src/cloudflare/types/zero_trust/access/custom_page_without_html.py b/src/cloudflare/types/zero_trust/access/custom_page_without_html.py deleted file mode 100644 index d0aecfa61f5..00000000000 --- a/src/cloudflare/types/zero_trust/access/custom_page_without_html.py +++ /dev/null @@ -1,27 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["CustomPageWithoutHTML"] - - -class CustomPageWithoutHTML(BaseModel): - name: str - """Custom page name.""" - - type: Literal["identity_denied", "forbidden"] - """Custom page type.""" - - app_count: Optional[int] = None - """Number of apps the custom page is assigned to.""" - - created_at: Optional[datetime] = None - - uid: Optional[str] = None - """UUID""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/group_delete_response.py b/src/cloudflare/types/zero_trust/access/group_delete_response.py deleted file mode 100644 index 4f17b96b793..00000000000 --- a/src/cloudflare/types/zero_trust/access/group_delete_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["GroupDeleteResponse"] - - -class GroupDeleteResponse(BaseModel): - id: Optional[str] = None - """UUID""" diff --git a/src/cloudflare/types/zero_trust/access/group_update_params.py b/src/cloudflare/types/zero_trust/access/group_update_params.py deleted file mode 100644 index 68672edb40e..00000000000 --- a/src/cloudflare/types/zero_trust/access/group_update_params.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 Required, TypedDict - -from ..access_rule_param import AccessRuleParam - -__all__ = ["GroupUpdateParams"] - - -class GroupUpdateParams(TypedDict, total=False): - include: Required[Iterable[AccessRuleParam]] - """Rules evaluated with an OR logical operator. - - A user needs to meet only one of the Include rules. - """ - - name: Required[str] - """The name of the Access group.""" - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - exclude: Iterable[AccessRuleParam] - """Rules evaluated with a NOT logical operator. - - To match a policy, a user cannot meet any of the Exclude rules. - """ - - is_default: bool - """Whether this is the default group""" - - require: Iterable[AccessRuleParam] - """Rules evaluated with an AND logical operator. - - To match a policy, a user must meet all of the Require rules. - """ diff --git a/src/cloudflare/types/zero_trust/access/key_get_response.py b/src/cloudflare/types/zero_trust/access/key_get_response.py deleted file mode 100644 index 79cfd988d58..00000000000 --- a/src/cloudflare/types/zero_trust/access/key_get_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["KeyGetResponse"] - -KeyGetResponse = Union[str, object] diff --git a/src/cloudflare/types/zero_trust/access/key_rotate_response.py b/src/cloudflare/types/zero_trust/access/key_rotate_response.py deleted file mode 100644 index 1ababd82b3c..00000000000 --- a/src/cloudflare/types/zero_trust/access/key_rotate_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["KeyRotateResponse"] - -KeyRotateResponse = Union[str, object] diff --git a/src/cloudflare/types/zero_trust/access/key_update_params.py b/src/cloudflare/types/zero_trust/access/key_update_params.py deleted file mode 100644 index 2c0f1d6ec45..00000000000 --- a/src/cloudflare/types/zero_trust/access/key_update_params.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["KeyUpdateParams"] - - -class KeyUpdateParams(TypedDict, total=False): - key_rotation_interval_days: Required[float] - """The number of days between key rotations.""" diff --git a/src/cloudflare/types/zero_trust/access/key_update_response.py b/src/cloudflare/types/zero_trust/access/key_update_response.py deleted file mode 100644 index a63396635f6..00000000000 --- a/src/cloudflare/types/zero_trust/access/key_update_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["KeyUpdateResponse"] - -KeyUpdateResponse = Union[str, object] diff --git a/src/cloudflare/types/zero_trust/access/logs/__init__.py b/src/cloudflare/types/zero_trust/access/logs/__init__.py index 8044ec713b3..f8ee8b14b1c 100644 --- a/src/cloudflare/types/zero_trust/access/logs/__init__.py +++ b/src/cloudflare/types/zero_trust/access/logs/__init__.py @@ -1,6 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .access_requests import AccessRequests as AccessRequests -from .access_request_list_response import AccessRequestListResponse as AccessRequestListResponse diff --git a/src/cloudflare/types/zero_trust/access/logs/access_request_list_response.py b/src/cloudflare/types/zero_trust/access/logs/access_request_list_response.py deleted file mode 100644 index b48a60046d9..00000000000 --- a/src/cloudflare/types/zero_trust/access/logs/access_request_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .access_requests import AccessRequests - -__all__ = ["AccessRequestListResponse"] - -AccessRequestListResponse = List[AccessRequests] diff --git a/src/cloudflare/types/zero_trust/access/service_token_rotate_response.py b/src/cloudflare/types/zero_trust/access/service_token_rotate_response.py deleted file mode 100644 index b4a74bcfc69..00000000000 --- a/src/cloudflare/types/zero_trust/access/service_token_rotate_response.py +++ /dev/null @@ -1,40 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from ...._models import BaseModel - -__all__ = ["ServiceTokenRotateResponse"] - - -class ServiceTokenRotateResponse(BaseModel): - id: Optional[str] = None - """The ID of the service token.""" - - client_id: Optional[str] = None - """The Client ID for the service token. - - Access will check for this value in the `CF-Access-Client-ID` request header. - """ - - client_secret: Optional[str] = None - """The Client Secret for the service token. - - Access will check for this value in the `CF-Access-Client-Secret` request - header. - """ - - created_at: Optional[datetime] = None - - duration: Optional[str] = None - """The duration for how long the service token will be valid. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. The default is 1 year in hours (8760h). - """ - - name: Optional[str] = None - """The name of the service token.""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/service_token_update_params.py b/src/cloudflare/types/zero_trust/access/service_token_update_params.py deleted file mode 100644 index 93dc5d1c5bc..00000000000 --- a/src/cloudflare/types/zero_trust/access/service_token_update_params.py +++ /dev/null @@ -1,25 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["ServiceTokenUpdateParams"] - - -class ServiceTokenUpdateParams(TypedDict, total=False): - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - duration: str - """The duration for how long the service token will be valid. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. The default is 1 year in hours (8760h). - """ - - name: str - """The name of the service token.""" diff --git a/src/cloudflare/types/zero_trust/access/tag.py b/src/cloudflare/types/zero_trust/access/tag.py deleted file mode 100644 index bf386015544..00000000000 --- a/src/cloudflare/types/zero_trust/access/tag.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from ...._models import BaseModel - -__all__ = ["Tag"] - - -class Tag(BaseModel): - name: str - """The name of the tag""" - - app_count: Optional[int] = None - """The number of applications that have this tag""" - - created_at: Optional[datetime] = None - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/tag_create_params.py b/src/cloudflare/types/zero_trust/access/tag_create_params.py deleted file mode 100644 index d73f4a9177b..00000000000 --- a/src/cloudflare/types/zero_trust/access/tag_create_params.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["TagCreateParams"] - - -class TagCreateParams(TypedDict, total=False): - name: Required[str] - """The name of the tag""" diff --git a/src/cloudflare/types/zero_trust/access/tag_delete_response.py b/src/cloudflare/types/zero_trust/access/tag_delete_response.py deleted file mode 100644 index 8ffb88e56bf..00000000000 --- a/src/cloudflare/types/zero_trust/access/tag_delete_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["TagDeleteResponse"] - - -class TagDeleteResponse(BaseModel): - name: Optional[str] = None - """The name of the tag""" diff --git a/src/cloudflare/types/zero_trust/access/tag_update_params.py b/src/cloudflare/types/zero_trust/access/tag_update_params.py deleted file mode 100644 index 8c7cbb096cb..00000000000 --- a/src/cloudflare/types/zero_trust/access/tag_update_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["TagUpdateParams"] - - -class TagUpdateParams(TypedDict, total=False): - identifier: Required[str] - """Identifier""" - - name: Required[str] - """The name of the tag""" diff --git a/src/cloudflare/types/zero_trust/access/users/__init__.py b/src/cloudflare/types/zero_trust/access/users/__init__.py index 5f23decf1fe..f8ee8b14b1c 100644 --- a/src/cloudflare/types/zero_trust/access/users/__init__.py +++ b/src/cloudflare/types/zero_trust/access/users/__init__.py @@ -1,8 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .identity import Identity as Identity -from .failed_login_list_response import FailedLoginListResponse as FailedLoginListResponse -from .active_session_get_response import ActiveSessionGetResponse as ActiveSessionGetResponse -from .active_session_list_response import ActiveSessionListResponse as ActiveSessionListResponse diff --git a/src/cloudflare/types/zero_trust/access/users/active_session_get_response.py b/src/cloudflare/types/zero_trust/access/users/active_session_get_response.py deleted file mode 100644 index 2414f09a55c..00000000000 --- a/src/cloudflare/types/zero_trust/access/users/active_session_get_response.py +++ /dev/null @@ -1,98 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, Optional - -from pydantic import Field as FieldInfo - -from ....._models import BaseModel -from ..applications.user_policy_check_geo import UserPolicyCheckGeo - -__all__ = ["ActiveSessionGetResponse", "DeviceSessions", "DevicePosture", "DevicePostureCheck", "IdP", "MTLSAuth"] - - -class DeviceSessions(BaseModel): - last_authenticated: Optional[float] = None - - -class DevicePostureCheck(BaseModel): - exists: Optional[bool] = None - - path: Optional[str] = None - - -class DevicePosture(BaseModel): - id: Optional[str] = None - - check: Optional[DevicePostureCheck] = None - - data: Optional[object] = None - - description: Optional[str] = None - - error: Optional[str] = None - - rule_name: Optional[str] = None - - success: Optional[bool] = None - - timestamp: Optional[str] = None - - type: Optional[str] = None - - -class IdP(BaseModel): - id: Optional[str] = None - - type: Optional[str] = None - - -class MTLSAuth(BaseModel): - auth_status: Optional[str] = None - - cert_issuer_dn: Optional[str] = None - - cert_issuer_ski: Optional[str] = None - - cert_presented: Optional[bool] = None - - cert_serial: Optional[str] = None - - -class ActiveSessionGetResponse(BaseModel): - account_id: Optional[str] = None - - auth_status: Optional[str] = None - - common_name: Optional[str] = None - - device_id: Optional[str] = None - - device_sessions: Optional[Dict[str, DeviceSessions]] = None - - device_posture: Optional[Dict[str, DevicePosture]] = FieldInfo(alias="devicePosture", default=None) - - email: Optional[str] = None - - geo: Optional[UserPolicyCheckGeo] = None - - iat: Optional[float] = None - - idp: Optional[IdP] = None - - ip: Optional[str] = None - - is_gateway: Optional[bool] = None - - is_warp: Optional[bool] = None - - is_active: Optional[bool] = FieldInfo(alias="isActive", default=None) - - mtls_auth: Optional[MTLSAuth] = None - - service_token_id: Optional[str] = None - - service_token_status: Optional[bool] = None - - user_uuid: Optional[str] = None - - version: Optional[float] = None diff --git a/src/cloudflare/types/zero_trust/access/users/active_session_list_response.py b/src/cloudflare/types/zero_trust/access/users/active_session_list_response.py deleted file mode 100644 index ac0f4059a81..00000000000 --- a/src/cloudflare/types/zero_trust/access/users/active_session_list_response.py +++ /dev/null @@ -1,37 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, Optional - -from ....._models import BaseModel - -__all__ = ["ActiveSessionListResponse", "Metadata", "MetadataApps"] - - -class MetadataApps(BaseModel): - hostname: Optional[str] = None - - name: Optional[str] = None - - type: Optional[str] = None - - uid: Optional[str] = None - - -class Metadata(BaseModel): - apps: Optional[Dict[str, MetadataApps]] = None - - expires: Optional[int] = None - - iat: Optional[int] = None - - nonce: Optional[str] = None - - ttl: Optional[int] = None - - -class ActiveSessionListResponse(BaseModel): - expiration: Optional[int] = None - - metadata: Optional[Metadata] = None - - name: Optional[str] = None diff --git a/src/cloudflare/types/zero_trust/access/users/failed_login_list_response.py b/src/cloudflare/types/zero_trust/access/users/failed_login_list_response.py deleted file mode 100644 index 358f7afc443..00000000000 --- a/src/cloudflare/types/zero_trust/access/users/failed_login_list_response.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ....._models import BaseModel - -__all__ = ["FailedLoginListResponse"] - - -class FailedLoginListResponse(BaseModel): - expiration: Optional[int] = None - - metadata: Optional[object] = None diff --git a/src/cloudflare/types/zero_trust/access/users/identity.py b/src/cloudflare/types/zero_trust/access/users/identity.py deleted file mode 100644 index 52f27fee6c2..00000000000 --- a/src/cloudflare/types/zero_trust/access/users/identity.py +++ /dev/null @@ -1,96 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, Optional - -from pydantic import Field as FieldInfo - -from ....._models import BaseModel -from ..applications.user_policy_check_geo import UserPolicyCheckGeo - -__all__ = ["Identity", "DeviceSessions", "DevicePosture", "DevicePostureCheck", "IdP", "MTLSAuth"] - - -class DeviceSessions(BaseModel): - last_authenticated: Optional[float] = None - - -class DevicePostureCheck(BaseModel): - exists: Optional[bool] = None - - path: Optional[str] = None - - -class DevicePosture(BaseModel): - id: Optional[str] = None - - check: Optional[DevicePostureCheck] = None - - data: Optional[object] = None - - description: Optional[str] = None - - error: Optional[str] = None - - rule_name: Optional[str] = None - - success: Optional[bool] = None - - timestamp: Optional[str] = None - - type: Optional[str] = None - - -class IdP(BaseModel): - id: Optional[str] = None - - type: Optional[str] = None - - -class MTLSAuth(BaseModel): - auth_status: Optional[str] = None - - cert_issuer_dn: Optional[str] = None - - cert_issuer_ski: Optional[str] = None - - cert_presented: Optional[bool] = None - - cert_serial: Optional[str] = None - - -class Identity(BaseModel): - account_id: Optional[str] = None - - auth_status: Optional[str] = None - - common_name: Optional[str] = None - - device_id: Optional[str] = None - - device_sessions: Optional[Dict[str, DeviceSessions]] = None - - device_posture: Optional[Dict[str, DevicePosture]] = FieldInfo(alias="devicePosture", default=None) - - email: Optional[str] = None - - geo: Optional[UserPolicyCheckGeo] = None - - iat: Optional[float] = None - - idp: Optional[IdP] = None - - ip: Optional[str] = None - - is_gateway: Optional[bool] = None - - is_warp: Optional[bool] = None - - mtls_auth: Optional[MTLSAuth] = None - - service_token_id: Optional[str] = None - - service_token_status: Optional[bool] = None - - user_uuid: Optional[str] = None - - version: Optional[float] = None diff --git a/src/cloudflare/types/zero_trust/identity_provider_delete_response.py b/src/cloudflare/types/zero_trust/identity_provider_delete_response.py deleted file mode 100644 index 4c84ce5d197..00000000000 --- a/src/cloudflare/types/zero_trust/identity_provider_delete_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["IdentityProviderDeleteResponse"] - - -class IdentityProviderDeleteResponse(BaseModel): - id: Optional[str] = None - """UUID""" diff --git a/src/cloudflare/types/zero_trust/identity_provider_update_params.py b/src/cloudflare/types/zero_trust/identity_provider_update_params.py deleted file mode 100644 index 9667f9f04ba..00000000000 --- a/src/cloudflare/types/zero_trust/identity_provider_update_params.py +++ /dev/null @@ -1,697 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, TypedDict - -from .scim_config_param import ScimConfigParam -from .identity_provider_type import IdentityProviderType -from .generic_oauth_config_param import GenericOAuthConfigParam - -__all__ = [ - "IdentityProviderUpdateParams", - "AzureAD", - "AzureADConfig", - "AccessCentrify", - "AccessCentrifyConfig", - "AccessFacebook", - "AccessGitHub", - "AccessGoogle", - "AccessGoogleConfig", - "AccessGoogleApps", - "AccessGoogleAppsConfig", - "AccessLinkedin", - "AccessOIDC", - "AccessOIDCConfig", - "AccessOkta", - "AccessOktaConfig", - "AccessOnelogin", - "AccessOneloginConfig", - "AccessPingone", - "AccessPingoneConfig", - "AccessSAML", - "AccessSAMLConfig", - "AccessSAMLConfigHeaderAttribute", - "AccessYandex", - "AccessOnetimepin", -] - - -class AzureAD(TypedDict, total=False): - config: Required[AzureADConfig] - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: Required[str] - """The name of the identity provider, shown to users on the login page.""" - - type: Required[IdentityProviderType] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - scim_config: ScimConfigParam - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AzureADConfig(TypedDict, total=False): - claims: List[str] - """Custom claims""" - - client_id: str - """Your OAuth Client ID""" - - client_secret: str - """Your OAuth Client Secret""" - - conditional_access_enabled: bool - """Should Cloudflare try to load authentication contexts from your account""" - - directory_id: str - """Your Azure directory uuid""" - - email_claim_name: str - """The claim name for email in the id_token response.""" - - prompt: Literal["login", "select_account", "none"] - """Indicates the type of user interaction that is required. - - prompt=login forces the user to enter their credentials on that request, - negating single-sign on. prompt=none is the opposite. It ensures that the user - isn't presented with any interactive prompt. If the request can't be completed - silently by using single-sign on, the Microsoft identity platform returns an - interaction_required error. prompt=select_account interrupts single sign-on - providing account selection experience listing all the accounts either in - session or any remembered account or an option to choose to use a different - account altogether. - """ - - support_groups: bool - """Should Cloudflare try to load groups from your account""" - - -class AccessCentrify(TypedDict, total=False): - config: Required[AccessCentrifyConfig] - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: Required[str] - """The name of the identity provider, shown to users on the login page.""" - - type: Required[IdentityProviderType] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - scim_config: ScimConfigParam - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessCentrifyConfig(TypedDict, total=False): - centrify_account: str - """Your centrify account url""" - - centrify_app_id: str - """Your centrify app id""" - - claims: List[str] - """Custom claims""" - - client_id: str - """Your OAuth Client ID""" - - client_secret: str - """Your OAuth Client Secret""" - - email_claim_name: str - """The claim name for email in the id_token response.""" - - -class AccessFacebook(TypedDict, total=False): - config: Required[GenericOAuthConfigParam] - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: Required[str] - """The name of the identity provider, shown to users on the login page.""" - - type: Required[IdentityProviderType] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - scim_config: ScimConfigParam - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessGitHub(TypedDict, total=False): - config: Required[GenericOAuthConfigParam] - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: Required[str] - """The name of the identity provider, shown to users on the login page.""" - - type: Required[IdentityProviderType] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - scim_config: ScimConfigParam - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessGoogle(TypedDict, total=False): - config: Required[AccessGoogleConfig] - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: Required[str] - """The name of the identity provider, shown to users on the login page.""" - - type: Required[IdentityProviderType] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - scim_config: ScimConfigParam - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessGoogleConfig(TypedDict, total=False): - claims: List[str] - """Custom claims""" - - client_id: str - """Your OAuth Client ID""" - - client_secret: str - """Your OAuth Client Secret""" - - email_claim_name: str - """The claim name for email in the id_token response.""" - - -class AccessGoogleApps(TypedDict, total=False): - config: Required[AccessGoogleAppsConfig] - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: Required[str] - """The name of the identity provider, shown to users on the login page.""" - - type: Required[IdentityProviderType] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - scim_config: ScimConfigParam - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessGoogleAppsConfig(TypedDict, total=False): - apps_domain: str - """Your companies TLD""" - - claims: List[str] - """Custom claims""" - - client_id: str - """Your OAuth Client ID""" - - client_secret: str - """Your OAuth Client Secret""" - - email_claim_name: str - """The claim name for email in the id_token response.""" - - -class AccessLinkedin(TypedDict, total=False): - config: Required[GenericOAuthConfigParam] - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: Required[str] - """The name of the identity provider, shown to users on the login page.""" - - type: Required[IdentityProviderType] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - scim_config: ScimConfigParam - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessOIDC(TypedDict, total=False): - config: Required[AccessOIDCConfig] - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: Required[str] - """The name of the identity provider, shown to users on the login page.""" - - type: Required[IdentityProviderType] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - scim_config: ScimConfigParam - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessOIDCConfig(TypedDict, total=False): - auth_url: str - """The authorization_endpoint URL of your IdP""" - - certs_url: str - """The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens""" - - claims: List[str] - """Custom claims""" - - client_id: str - """Your OAuth Client ID""" - - client_secret: str - """Your OAuth Client Secret""" - - email_claim_name: str - """The claim name for email in the id_token response.""" - - scopes: List[str] - """OAuth scopes""" - - token_url: str - """The token_endpoint URL of your IdP""" - - -class AccessOkta(TypedDict, total=False): - config: Required[AccessOktaConfig] - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: Required[str] - """The name of the identity provider, shown to users on the login page.""" - - type: Required[IdentityProviderType] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - scim_config: ScimConfigParam - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessOktaConfig(TypedDict, total=False): - authorization_server_id: str - """Your okta authorization server id""" - - claims: List[str] - """Custom claims""" - - client_id: str - """Your OAuth Client ID""" - - client_secret: str - """Your OAuth Client Secret""" - - email_claim_name: str - """The claim name for email in the id_token response.""" - - okta_account: str - """Your okta account url""" - - -class AccessOnelogin(TypedDict, total=False): - config: Required[AccessOneloginConfig] - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: Required[str] - """The name of the identity provider, shown to users on the login page.""" - - type: Required[IdentityProviderType] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - scim_config: ScimConfigParam - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessOneloginConfig(TypedDict, total=False): - claims: List[str] - """Custom claims""" - - client_id: str - """Your OAuth Client ID""" - - client_secret: str - """Your OAuth Client Secret""" - - email_claim_name: str - """The claim name for email in the id_token response.""" - - onelogin_account: str - """Your OneLogin account url""" - - -class AccessPingone(TypedDict, total=False): - config: Required[AccessPingoneConfig] - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: Required[str] - """The name of the identity provider, shown to users on the login page.""" - - type: Required[IdentityProviderType] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - scim_config: ScimConfigParam - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessPingoneConfig(TypedDict, total=False): - claims: List[str] - """Custom claims""" - - client_id: str - """Your OAuth Client ID""" - - client_secret: str - """Your OAuth Client Secret""" - - email_claim_name: str - """The claim name for email in the id_token response.""" - - ping_env_id: str - """Your PingOne environment identifier""" - - -class AccessSAML(TypedDict, total=False): - config: Required[AccessSAMLConfig] - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: Required[str] - """The name of the identity provider, shown to users on the login page.""" - - type: Required[IdentityProviderType] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - scim_config: ScimConfigParam - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessSAMLConfigHeaderAttribute(TypedDict, total=False): - attribute_name: str - """attribute name from the IDP""" - - header_name: str - """header that will be added on the request to the origin""" - - -class AccessSAMLConfig(TypedDict, total=False): - attributes: List[str] - """ - A list of SAML attribute names that will be added to your signed JWT token and - can be used in SAML policy rules. - """ - - email_attribute_name: str - """The attribute name for email in the SAML response.""" - - header_attributes: Iterable[AccessSAMLConfigHeaderAttribute] - """ - Add a list of attribute names that will be returned in the response header from - the Access callback. - """ - - idp_public_certs: List[str] - """X509 certificate to verify the signature in the SAML authentication response""" - - issuer_url: str - """IdP Entity ID or Issuer URL""" - - sign_request: bool - """Sign the SAML authentication request with Access credentials. - - To verify the signature, use the public key from the Access certs endpoints. - """ - - sso_target_url: str - """URL to send the SAML authentication requests to""" - - -class AccessYandex(TypedDict, total=False): - config: Required[GenericOAuthConfigParam] - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: Required[str] - """The name of the identity provider, shown to users on the login page.""" - - type: Required[IdentityProviderType] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - scim_config: ScimConfigParam - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessOnetimepin(TypedDict, total=False): - config: Required[object] - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: Required[str] - """The name of the identity provider, shown to users on the login page.""" - - type: Required[IdentityProviderType] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" - - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - - scim_config: ScimConfigParam - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -IdentityProviderUpdateParams = Union[ - AzureAD, - AccessCentrify, - AccessFacebook, - AccessGitHub, - AccessGoogle, - AccessGoogleApps, - AccessLinkedin, - AccessOIDC, - AccessOkta, - AccessOnelogin, - AccessPingone, - AccessSAML, - AccessYandex, - AccessOnetimepin, -] diff --git a/src/cloudflare/types/zero_trust/seat.py b/src/cloudflare/types/zero_trust/seat.py deleted file mode 100644 index bf56403a543..00000000000 --- a/src/cloudflare/types/zero_trust/seat.py +++ /dev/null @@ -1,23 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from ..._models import BaseModel - -__all__ = ["Seat"] - - -class Seat(BaseModel): - access_seat: Optional[bool] = None - """True if the seat is part of Access.""" - - created_at: Optional[datetime] = None - - gateway_seat: Optional[bool] = None - """True if the seat is part of Gateway.""" - - seat_uid: Optional[str] = None - """Identifier""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/seat_edit_params.py b/src/cloudflare/types/zero_trust/seat_edit_params.py deleted file mode 100644 index e385a5e44d9..00000000000 --- a/src/cloudflare/types/zero_trust/seat_edit_params.py +++ /dev/null @@ -1,20 +0,0 @@ -# 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 Required, TypedDict - -__all__ = ["SeatEditParams", "Body"] - - -class SeatEditParams(TypedDict, total=False): - body: Required[Iterable[Body]] - - -class Body(TypedDict, total=False): - access_seat: Required[bool] - """True if the seat is part of Access.""" - - gateway_seat: Required[bool] - """True if the seat is part of Gateway.""" diff --git a/src/cloudflare/types/zero_trust/seat_edit_response.py b/src/cloudflare/types/zero_trust/seat_edit_response.py deleted file mode 100644 index a29d3feb33b..00000000000 --- a/src/cloudflare/types/zero_trust/seat_edit_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .seat import Seat - -__all__ = ["SeatEditResponse"] - -SeatEditResponse = List[Seat] diff --git a/tests/api_resources/cloudforce_one/requests/test_message.py b/tests/api_resources/cloudforce_one/requests/test_message.py index cae9250892e..e804d3ab846 100644 --- a/tests/api_resources/cloudforce_one/requests/test_message.py +++ b/tests/api_resources/cloudforce_one/requests/test_message.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -28,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Message, message, path=["response"]) + assert_matches_type(Optional[Message], message, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: @@ -37,7 +37,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: account_identifier="023e105f4ecef8ad9ca31a8372d0c353", content="Can you elaborate on the type of DoS that occurred?", ) - assert_matches_type(Message, message, path=["response"]) + assert_matches_type(Optional[Message], message, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: @@ -49,7 +49,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = response.parse() - assert_matches_type(Message, message, path=["response"]) + assert_matches_type(Optional[Message], message, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: @@ -61,7 +61,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = response.parse() - assert_matches_type(Message, message, path=["response"]) + assert_matches_type(Optional[Message], message, path=["response"]) assert cast(Any, response.is_closed) is True @@ -86,7 +86,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_identifier="023e105f4ecef8ad9ca31a8372d0c353", request_identifier="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(Message, message, path=["response"]) + assert_matches_type(Optional[Message], message, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: @@ -100,7 +100,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: summary="DoS attack", tlp="clear", ) - assert_matches_type(Message, message, path=["response"]) + assert_matches_type(Optional[Message], message, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: @@ -113,7 +113,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = response.parse() - assert_matches_type(Message, message, path=["response"]) + assert_matches_type(Optional[Message], message, path=["response"]) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: @@ -126,7 +126,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = response.parse() - assert_matches_type(Message, message, path=["response"]) + assert_matches_type(Optional[Message], message, path=["response"]) assert cast(Any, response.is_closed) is True @@ -207,7 +207,7 @@ def test_method_get(self, client: Cloudflare) -> None: page=0, per_page=10, ) - assert_matches_type(MessageGetResponse, message, path=["response"]) + assert_matches_type(Optional[MessageGetResponse], message, path=["response"]) @parametrize def test_method_get_with_all_params(self, client: Cloudflare) -> None: @@ -221,7 +221,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: sort_by="created", sort_order="asc", ) - assert_matches_type(MessageGetResponse, message, path=["response"]) + assert_matches_type(Optional[MessageGetResponse], message, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -235,7 +235,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = response.parse() - assert_matches_type(MessageGetResponse, message, path=["response"]) + assert_matches_type(Optional[MessageGetResponse], message, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -249,7 +249,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = response.parse() - assert_matches_type(MessageGetResponse, message, path=["response"]) + assert_matches_type(Optional[MessageGetResponse], message, path=["response"]) assert cast(Any, response.is_closed) is True @@ -281,7 +281,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Message, message, path=["response"]) + assert_matches_type(Optional[Message], message, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -290,7 +290,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare account_identifier="023e105f4ecef8ad9ca31a8372d0c353", content="Can you elaborate on the type of DoS that occurred?", ) - assert_matches_type(Message, message, path=["response"]) + assert_matches_type(Optional[Message], message, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @@ -302,7 +302,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = await response.parse() - assert_matches_type(Message, message, path=["response"]) + assert_matches_type(Optional[Message], message, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: @@ -314,7 +314,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = await response.parse() - assert_matches_type(Message, message, path=["response"]) + assert_matches_type(Optional[Message], message, path=["response"]) assert cast(Any, response.is_closed) is True @@ -339,7 +339,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_identifier="023e105f4ecef8ad9ca31a8372d0c353", request_identifier="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(Message, message, path=["response"]) + assert_matches_type(Optional[Message], message, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -353,7 +353,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare summary="DoS attack", tlp="clear", ) - assert_matches_type(Message, message, path=["response"]) + assert_matches_type(Optional[Message], message, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @@ -366,7 +366,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = await response.parse() - assert_matches_type(Message, message, path=["response"]) + assert_matches_type(Optional[Message], message, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: @@ -379,7 +379,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = await response.parse() - assert_matches_type(Message, message, path=["response"]) + assert_matches_type(Optional[Message], message, path=["response"]) assert cast(Any, response.is_closed) is True @@ -460,7 +460,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: page=0, per_page=10, ) - assert_matches_type(MessageGetResponse, message, path=["response"]) + assert_matches_type(Optional[MessageGetResponse], message, path=["response"]) @parametrize async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -474,7 +474,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - sort_by="created", sort_order="asc", ) - assert_matches_type(MessageGetResponse, message, path=["response"]) + assert_matches_type(Optional[MessageGetResponse], message, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -488,7 +488,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = await response.parse() - assert_matches_type(MessageGetResponse, message, path=["response"]) + assert_matches_type(Optional[MessageGetResponse], message, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -502,7 +502,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = await response.parse() - assert_matches_type(MessageGetResponse, message, path=["response"]) + assert_matches_type(Optional[MessageGetResponse], message, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloudforce_one/requests/test_priority.py b/tests/api_resources/cloudforce_one/requests/test_priority.py index 46276ab9dcf..012e01b34cf 100644 --- a/tests/api_resources/cloudforce_one/requests/test_priority.py +++ b/tests/api_resources/cloudforce_one/requests/test_priority.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -30,7 +30,7 @@ def test_method_create(self, client: Cloudflare) -> None: requirement="DoS attacks carried out by CVEs", tlp="clear", ) - assert_matches_type(Priority, priority, path=["response"]) + assert_matches_type(Optional[Priority], priority, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: @@ -45,7 +45,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(Priority, priority, path=["response"]) + assert_matches_type(Optional[Priority], priority, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: @@ -60,7 +60,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(Priority, priority, path=["response"]) + assert_matches_type(Optional[Priority], priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -85,7 +85,7 @@ def test_method_update(self, client: Cloudflare) -> None: requirement="DoS attacks carried out by CVEs", tlp="clear", ) - assert_matches_type(Item, priority, path=["response"]) + assert_matches_type(Optional[Item], priority, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: @@ -101,7 +101,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(Item, priority, path=["response"]) + assert_matches_type(Optional[Item], priority, path=["response"]) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: @@ -117,7 +117,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(Item, priority, path=["response"]) + assert_matches_type(Optional[Item], priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -197,7 +197,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Item, priority, path=["response"]) + assert_matches_type(Optional[Item], priority, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -209,7 +209,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(Item, priority, path=["response"]) + assert_matches_type(Optional[Item], priority, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -221,7 +221,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(Item, priority, path=["response"]) + assert_matches_type(Optional[Item], priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -244,7 +244,7 @@ def test_method_quota(self, client: Cloudflare) -> None: priority = client.cloudforce_one.requests.priority.quota( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Quota, priority, path=["response"]) + assert_matches_type(Optional[Quota], priority, path=["response"]) @parametrize def test_raw_response_quota(self, client: Cloudflare) -> None: @@ -255,7 +255,7 @@ def test_raw_response_quota(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(Quota, priority, path=["response"]) + assert_matches_type(Optional[Quota], priority, path=["response"]) @parametrize def test_streaming_response_quota(self, client: Cloudflare) -> None: @@ -266,7 +266,7 @@ def test_streaming_response_quota(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(Quota, priority, path=["response"]) + assert_matches_type(Optional[Quota], priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -290,7 +290,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: requirement="DoS attacks carried out by CVEs", tlp="clear", ) - assert_matches_type(Priority, priority, path=["response"]) + assert_matches_type(Optional[Priority], priority, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @@ -305,7 +305,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(Priority, priority, path=["response"]) + assert_matches_type(Optional[Priority], priority, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: @@ -320,7 +320,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(Priority, priority, path=["response"]) + assert_matches_type(Optional[Priority], priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -345,7 +345,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: requirement="DoS attacks carried out by CVEs", tlp="clear", ) - assert_matches_type(Item, priority, path=["response"]) + assert_matches_type(Optional[Item], priority, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @@ -361,7 +361,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(Item, priority, path=["response"]) + assert_matches_type(Optional[Item], priority, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: @@ -377,7 +377,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(Item, priority, path=["response"]) + assert_matches_type(Optional[Item], priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -457,7 +457,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Item, priority, path=["response"]) + assert_matches_type(Optional[Item], priority, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -469,7 +469,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(Item, priority, path=["response"]) + assert_matches_type(Optional[Item], priority, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -481,7 +481,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(Item, priority, path=["response"]) + assert_matches_type(Optional[Item], priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -504,7 +504,7 @@ async def test_method_quota(self, async_client: AsyncCloudflare) -> None: priority = await async_client.cloudforce_one.requests.priority.quota( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Quota, priority, path=["response"]) + assert_matches_type(Optional[Quota], priority, path=["response"]) @parametrize async def test_raw_response_quota(self, async_client: AsyncCloudflare) -> None: @@ -515,7 +515,7 @@ async def test_raw_response_quota(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(Quota, priority, path=["response"]) + assert_matches_type(Optional[Quota], priority, path=["response"]) @parametrize async def test_streaming_response_quota(self, async_client: AsyncCloudflare) -> None: @@ -526,7 +526,7 @@ async def test_streaming_response_quota(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(Quota, priority, path=["response"]) + assert_matches_type(Optional[Quota], priority, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloudforce_one/test_requests.py b/tests/api_resources/cloudforce_one/test_requests.py index 327ae61c1bb..9e43e1a22b2 100644 --- a/tests/api_resources/cloudforce_one/test_requests.py +++ b/tests/api_resources/cloudforce_one/test_requests.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -31,7 +31,7 @@ def test_method_create(self, client: Cloudflare) -> None: request = client.cloudforce_one.requests.create( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: @@ -43,7 +43,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: summary="DoS attack", tlp="clear", ) - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: @@ -54,7 +54,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: @@ -65,7 +65,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -82,7 +82,7 @@ def test_method_update(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: @@ -95,7 +95,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: summary="DoS attack", tlp="clear", ) - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: @@ -107,7 +107,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: @@ -119,7 +119,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -253,7 +253,7 @@ def test_method_constants(self, client: Cloudflare) -> None: request = client.cloudforce_one.requests.constants( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RequestConstants, request, path=["response"]) + assert_matches_type(Optional[RequestConstants], request, path=["response"]) @parametrize def test_raw_response_constants(self, client: Cloudflare) -> None: @@ -264,7 +264,7 @@ def test_raw_response_constants(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(RequestConstants, request, path=["response"]) + assert_matches_type(Optional[RequestConstants], request, path=["response"]) @parametrize def test_streaming_response_constants(self, client: Cloudflare) -> None: @@ -275,7 +275,7 @@ def test_streaming_response_constants(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(RequestConstants, request, path=["response"]) + assert_matches_type(Optional[RequestConstants], request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -292,7 +292,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -304,7 +304,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -316,7 +316,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -339,7 +339,7 @@ def test_method_quota(self, client: Cloudflare) -> None: request = client.cloudforce_one.requests.quota( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Quota, request, path=["response"]) + assert_matches_type(Optional[Quota], request, path=["response"]) @parametrize def test_raw_response_quota(self, client: Cloudflare) -> None: @@ -350,7 +350,7 @@ def test_raw_response_quota(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Quota, request, path=["response"]) + assert_matches_type(Optional[Quota], request, path=["response"]) @parametrize def test_streaming_response_quota(self, client: Cloudflare) -> None: @@ -361,7 +361,7 @@ def test_streaming_response_quota(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Quota, request, path=["response"]) + assert_matches_type(Optional[Quota], request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -377,7 +377,7 @@ def test_method_types(self, client: Cloudflare) -> None: request = client.cloudforce_one.requests.types( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RequestTypes, request, path=["response"]) + assert_matches_type(Optional[RequestTypes], request, path=["response"]) @parametrize def test_raw_response_types(self, client: Cloudflare) -> None: @@ -388,7 +388,7 @@ def test_raw_response_types(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(RequestTypes, request, path=["response"]) + assert_matches_type(Optional[RequestTypes], request, path=["response"]) @parametrize def test_streaming_response_types(self, client: Cloudflare) -> None: @@ -399,7 +399,7 @@ def test_streaming_response_types(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(RequestTypes, request, path=["response"]) + assert_matches_type(Optional[RequestTypes], request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -419,7 +419,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: request = await async_client.cloudforce_one.requests.create( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -431,7 +431,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare summary="DoS attack", tlp="clear", ) - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @@ -442,7 +442,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: @@ -453,7 +453,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -470,7 +470,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -483,7 +483,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare summary="DoS attack", tlp="clear", ) - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @@ -495,7 +495,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: @@ -507,7 +507,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -641,7 +641,7 @@ async def test_method_constants(self, async_client: AsyncCloudflare) -> None: request = await async_client.cloudforce_one.requests.constants( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RequestConstants, request, path=["response"]) + assert_matches_type(Optional[RequestConstants], request, path=["response"]) @parametrize async def test_raw_response_constants(self, async_client: AsyncCloudflare) -> None: @@ -652,7 +652,7 @@ async def test_raw_response_constants(self, async_client: AsyncCloudflare) -> No assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(RequestConstants, request, path=["response"]) + assert_matches_type(Optional[RequestConstants], request, path=["response"]) @parametrize async def test_streaming_response_constants(self, async_client: AsyncCloudflare) -> None: @@ -663,7 +663,7 @@ async def test_streaming_response_constants(self, async_client: AsyncCloudflare) assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(RequestConstants, request, path=["response"]) + assert_matches_type(Optional[RequestConstants], request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -680,7 +680,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -692,7 +692,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -704,7 +704,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Item, request, path=["response"]) + assert_matches_type(Optional[Item], request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -727,7 +727,7 @@ async def test_method_quota(self, async_client: AsyncCloudflare) -> None: request = await async_client.cloudforce_one.requests.quota( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Quota, request, path=["response"]) + assert_matches_type(Optional[Quota], request, path=["response"]) @parametrize async def test_raw_response_quota(self, async_client: AsyncCloudflare) -> None: @@ -738,7 +738,7 @@ async def test_raw_response_quota(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Quota, request, path=["response"]) + assert_matches_type(Optional[Quota], request, path=["response"]) @parametrize async def test_streaming_response_quota(self, async_client: AsyncCloudflare) -> None: @@ -749,7 +749,7 @@ async def test_streaming_response_quota(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Quota, request, path=["response"]) + assert_matches_type(Optional[Quota], request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -765,7 +765,7 @@ async def test_method_types(self, async_client: AsyncCloudflare) -> None: request = await async_client.cloudforce_one.requests.types( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RequestTypes, request, path=["response"]) + assert_matches_type(Optional[RequestTypes], request, path=["response"]) @parametrize async def test_raw_response_types(self, async_client: AsyncCloudflare) -> None: @@ -776,7 +776,7 @@ async def test_raw_response_types(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(RequestTypes, request, path=["response"]) + assert_matches_type(Optional[RequestTypes], request, path=["response"]) @parametrize async def test_streaming_response_types(self, async_client: AsyncCloudflare) -> None: @@ -787,7 +787,7 @@ async def test_streaming_response_types(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(RequestTypes, request, path=["response"]) + assert_matches_type(Optional[RequestTypes], request, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/intel/test_whois.py b/tests/api_resources/intel/test_whois.py index 215bb9b2e3f..c8f0f4035df 100644 --- a/tests/api_resources/intel/test_whois.py +++ b/tests/api_resources/intel/test_whois.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -22,7 +22,7 @@ def test_method_get(self, client: Cloudflare) -> None: whois = client.intel.whois.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WhoisGetResponse, whois, path=["response"]) + assert_matches_type(Optional[WhoisGetResponse], whois, path=["response"]) @parametrize def test_method_get_with_all_params(self, client: Cloudflare) -> None: @@ -30,7 +30,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", domain="string", ) - assert_matches_type(WhoisGetResponse, whois, path=["response"]) + assert_matches_type(Optional[WhoisGetResponse], whois, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -41,7 +41,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" whois = response.parse() - assert_matches_type(WhoisGetResponse, whois, path=["response"]) + assert_matches_type(Optional[WhoisGetResponse], whois, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -52,7 +52,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" whois = response.parse() - assert_matches_type(WhoisGetResponse, whois, path=["response"]) + assert_matches_type(Optional[WhoisGetResponse], whois, path=["response"]) assert cast(Any, response.is_closed) is True @@ -72,7 +72,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: whois = await async_client.intel.whois.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WhoisGetResponse, whois, path=["response"]) + assert_matches_type(Optional[WhoisGetResponse], whois, path=["response"]) @parametrize async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -80,7 +80,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="023e105f4ecef8ad9ca31a8372d0c353", domain="string", ) - assert_matches_type(WhoisGetResponse, whois, path=["response"]) + assert_matches_type(Optional[WhoisGetResponse], whois, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -91,7 +91,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" whois = await response.parse() - assert_matches_type(WhoisGetResponse, whois, path=["response"]) + assert_matches_type(Optional[WhoisGetResponse], whois, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -102,7 +102,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" whois = await response.parse() - assert_matches_type(WhoisGetResponse, whois, path=["response"]) + assert_matches_type(Optional[WhoisGetResponse], whois, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/rulesets/test_rules.py b/tests/api_resources/rulesets/test_rules.py index b457e152f24..1496d433303 100644 --- a/tests/api_resources/rulesets/test_rules.py +++ b/tests/api_resources/rulesets/test_rules.py @@ -1394,156 +1394,6 @@ def test_path_params_create_overload_16(self, client: Cloudflare) -> None: account_id="string", ) - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_create_overload_17(self, client: Cloudflare) -> None: - rule = client.rulesets.rules.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - assert_matches_type(RuleCreateResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_create_with_all_params_overload_17(self, client: Cloudflare) -> None: - rule = client.rulesets.rules.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - id="3a03d665bac047339bb530ecb439a90d", - action="ddos_dynamic", - action_parameters={}, - description="Performs a specific action according to a set of internal guidelines defined by Cloudflare.", - enabled=True, - expression="ip.src ne 1.1.1.1", - logging={"enabled": True}, - ref="my_ref", - ) - assert_matches_type(RuleCreateResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_create_overload_17(self, client: Cloudflare) -> None: - response = client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(RuleCreateResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_create_overload_17(self, client: Cloudflare) -> None: - with client.rulesets.rules.with_streaming_response.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = response.parse() - assert_matches_type(RuleCreateResponse, rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_create_overload_17(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): - client.rulesets.rules.with_raw_response.create( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_create_overload_18(self, client: Cloudflare) -> None: - rule = client.rulesets.rules.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - assert_matches_type(RuleCreateResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_create_with_all_params_overload_18(self, client: Cloudflare) -> None: - rule = client.rulesets.rules.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - id="3a03d665bac047339bb530ecb439a90d", - action="force_connection_close", - action_parameters={}, - description="Closes ongoing HTTP connections. This action does not block a request, but it forces the client to reconnect. For HTTP/2 and HTTP/3 connections, the connection will be closed even if it breaks other requests running on the same connection.", - enabled=True, - expression="ip.src ne 1.1.1.1", - logging={"enabled": True}, - ref="my_ref", - ) - assert_matches_type(RuleCreateResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_create_overload_18(self, client: Cloudflare) -> None: - response = client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(RuleCreateResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_create_overload_18(self, client: Cloudflare) -> None: - with client.rulesets.rules.with_streaming_response.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = response.parse() - assert_matches_type(RuleCreateResponse, rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_create_overload_18(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): - client.rulesets.rules.with_raw_response.create( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_delete(self, client: Cloudflare) -> None: @@ -3222,184 +3072,6 @@ def test_path_params_edit_overload_16(self, client: Cloudflare) -> None: account_id="string", ) - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_edit_overload_17(self, client: Cloudflare) -> None: - rule = client.rulesets.rules.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - assert_matches_type(RuleEditResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_edit_with_all_params_overload_17(self, client: Cloudflare) -> None: - rule = client.rulesets.rules.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - id="3a03d665bac047339bb530ecb439a90d", - action="ddos_dynamic", - action_parameters={}, - description="Performs a specific action according to a set of internal guidelines defined by Cloudflare.", - enabled=True, - expression="ip.src ne 1.1.1.1", - logging={"enabled": True}, - ref="my_ref", - ) - assert_matches_type(RuleEditResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_edit_overload_17(self, client: Cloudflare) -> None: - response = client.rulesets.rules.with_raw_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(RuleEditResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_edit_overload_17(self, client: Cloudflare) -> None: - with client.rulesets.rules.with_streaming_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = response.parse() - assert_matches_type(RuleEditResponse, rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_edit_overload_17(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( - "", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_edit_overload_18(self, client: Cloudflare) -> None: - rule = client.rulesets.rules.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - assert_matches_type(RuleEditResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_edit_with_all_params_overload_18(self, client: Cloudflare) -> None: - rule = client.rulesets.rules.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - id="3a03d665bac047339bb530ecb439a90d", - action="force_connection_close", - action_parameters={}, - description="Closes ongoing HTTP connections. This action does not block a request, but it forces the client to reconnect. For HTTP/2 and HTTP/3 connections, the connection will be closed even if it breaks other requests running on the same connection.", - enabled=True, - expression="ip.src ne 1.1.1.1", - logging={"enabled": True}, - ref="my_ref", - ) - assert_matches_type(RuleEditResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_edit_overload_18(self, client: Cloudflare) -> None: - response = client.rulesets.rules.with_raw_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(RuleEditResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_edit_overload_18(self, client: Cloudflare) -> None: - with client.rulesets.rules.with_streaming_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = response.parse() - assert_matches_type(RuleEditResponse, rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_edit_overload_18(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( - "", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - class TestAsyncRules: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -4637,165 +4309,11 @@ async def test_method_create_with_all_params_overload_15(self, async_client: Asy }, "origin_cache_control": True, "origin_error_page_passthru": True, - "read_timeout": 900, - "respect_strong_etags": True, - "serve_stale": {"disable_stale_while_updating": True}, - }, - description="Set cache settings when the hostname address is not example.com", - enabled=True, - expression="ip.src ne 1.1.1.1", - logging={"enabled": True}, - ref="my_ref", - ) - assert_matches_type(RuleCreateResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_create_overload_15(self, async_client: AsyncCloudflare) -> None: - response = await async_client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = await response.parse() - assert_matches_type(RuleCreateResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_create_overload_15(self, async_client: AsyncCloudflare) -> None: - async with async_client.rulesets.rules.with_streaming_response.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = await response.parse() - assert_matches_type(RuleCreateResponse, rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_create_overload_15(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.create( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_overload_16(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - assert_matches_type(RuleCreateResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_with_all_params_overload_16(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - id="3a03d665bac047339bb530ecb439a90d", - action="log_custom_field", - action_parameters={ - "cookie_fields": [{"name": "cookie_name_1"}], - "request_fields": [{"name": "http_request_header_name_1_in_lower_case"}], - "response_fields": [{"name": "http_response_header_name_1_in_lower_case"}], + "read_timeout": 900, + "respect_strong_etags": True, + "serve_stale": {"disable_stale_while_updating": True}, }, - description="Log custom field when the IP address is not 1.1.1.1", - enabled=True, - expression="ip.src ne 1.1.1.1", - logging={"enabled": True}, - ref="my_ref", - ) - assert_matches_type(RuleCreateResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_create_overload_16(self, async_client: AsyncCloudflare) -> None: - response = await async_client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = await response.parse() - assert_matches_type(RuleCreateResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_create_overload_16(self, async_client: AsyncCloudflare) -> None: - async with async_client.rulesets.rules.with_streaming_response.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = await response.parse() - assert_matches_type(RuleCreateResponse, rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_create_overload_16(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.create( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_overload_17(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - assert_matches_type(RuleCreateResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_with_all_params_overload_17(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - id="3a03d665bac047339bb530ecb439a90d", - action="ddos_dynamic", - action_parameters={}, - description="Performs a specific action according to a set of internal guidelines defined by Cloudflare.", + description="Set cache settings when the hostname address is not example.com", enabled=True, expression="ip.src ne 1.1.1.1", logging={"enabled": True}, @@ -4805,7 +4323,7 @@ async def test_method_create_with_all_params_overload_17(self, async_client: Asy @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_create_overload_17(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_create_overload_15(self, async_client: AsyncCloudflare) -> None: response = await async_client.rulesets.rules.with_raw_response.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -4818,7 +4336,7 @@ async def test_raw_response_create_overload_17(self, async_client: AsyncCloudfla @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_create_overload_17(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_create_overload_15(self, async_client: AsyncCloudflare) -> None: async with async_client.rulesets.rules.with_streaming_response.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -4833,7 +4351,7 @@ async def test_streaming_response_create_overload_17(self, async_client: AsyncCl @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_create_overload_17(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_create_overload_15(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): await async_client.rulesets.rules.with_raw_response.create( "", @@ -4854,7 +4372,7 @@ async def test_path_params_create_overload_17(self, async_client: AsyncCloudflar @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_create_overload_18(self, async_client: AsyncCloudflare) -> None: + async def test_method_create_overload_16(self, async_client: AsyncCloudflare) -> None: rule = await async_client.rulesets.rules.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -4863,14 +4381,18 @@ async def test_method_create_overload_18(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_create_with_all_params_overload_18(self, async_client: AsyncCloudflare) -> None: + async def test_method_create_with_all_params_overload_16(self, async_client: AsyncCloudflare) -> None: rule = await async_client.rulesets.rules.create( "2f2feab2026849078ba485f918791bdc", account_id="string", id="3a03d665bac047339bb530ecb439a90d", - action="force_connection_close", - action_parameters={}, - description="Closes ongoing HTTP connections. This action does not block a request, but it forces the client to reconnect. For HTTP/2 and HTTP/3 connections, the connection will be closed even if it breaks other requests running on the same connection.", + action="log_custom_field", + action_parameters={ + "cookie_fields": [{"name": "cookie_name_1"}], + "request_fields": [{"name": "http_request_header_name_1_in_lower_case"}], + "response_fields": [{"name": "http_response_header_name_1_in_lower_case"}], + }, + description="Log custom field when the IP address is not 1.1.1.1", enabled=True, expression="ip.src ne 1.1.1.1", logging={"enabled": True}, @@ -4880,7 +4402,7 @@ async def test_method_create_with_all_params_overload_18(self, async_client: Asy @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_create_overload_18(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_create_overload_16(self, async_client: AsyncCloudflare) -> None: response = await async_client.rulesets.rules.with_raw_response.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -4893,7 +4415,7 @@ async def test_raw_response_create_overload_18(self, async_client: AsyncCloudfla @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_create_overload_18(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_create_overload_16(self, async_client: AsyncCloudflare) -> None: async with async_client.rulesets.rules.with_streaming_response.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -4908,7 +4430,7 @@ async def test_streaming_response_create_overload_18(self, async_client: AsyncCl @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_create_overload_18(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_create_overload_16(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): await async_client.rulesets.rules.with_raw_response.create( "", @@ -6604,181 +6126,3 @@ async def test_path_params_edit_overload_16(self, async_client: AsyncCloudflare) ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_edit_overload_17(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - assert_matches_type(RuleEditResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_edit_with_all_params_overload_17(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - id="3a03d665bac047339bb530ecb439a90d", - action="ddos_dynamic", - action_parameters={}, - description="Performs a specific action according to a set of internal guidelines defined by Cloudflare.", - enabled=True, - expression="ip.src ne 1.1.1.1", - logging={"enabled": True}, - ref="my_ref", - ) - assert_matches_type(RuleEditResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_edit_overload_17(self, async_client: AsyncCloudflare) -> None: - response = await async_client.rulesets.rules.with_raw_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = await response.parse() - assert_matches_type(RuleEditResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_edit_overload_17(self, async_client: AsyncCloudflare) -> None: - async with async_client.rulesets.rules.with_streaming_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = await response.parse() - assert_matches_type(RuleEditResponse, rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_edit_overload_17(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.edit( - "", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_edit_overload_18(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - assert_matches_type(RuleEditResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_edit_with_all_params_overload_18(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - id="3a03d665bac047339bb530ecb439a90d", - action="force_connection_close", - action_parameters={}, - description="Closes ongoing HTTP connections. This action does not block a request, but it forces the client to reconnect. For HTTP/2 and HTTP/3 connections, the connection will be closed even if it breaks other requests running on the same connection.", - enabled=True, - expression="ip.src ne 1.1.1.1", - logging={"enabled": True}, - ref="my_ref", - ) - assert_matches_type(RuleEditResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_edit_overload_18(self, async_client: AsyncCloudflare) -> None: - response = await async_client.rulesets.rules.with_raw_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = await response.parse() - assert_matches_type(RuleEditResponse, rule, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_edit_overload_18(self, async_client: AsyncCloudflare) -> None: - async with async_client.rulesets.rules.with_streaming_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = await response.parse() - assert_matches_type(RuleEditResponse, rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_edit_overload_18(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.edit( - "", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.edit( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", - account_id="string", - ) diff --git a/tests/api_resources/zero_trust/access/applications/test_cas.py b/tests/api_resources/zero_trust/access/applications/test_cas.py index 745e334fc35..e80d89059db 100644 --- a/tests/api_resources/zero_trust/access/applications/test_cas.py +++ b/tests/api_resources/zero_trust/access/applications/test_cas.py @@ -3,14 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access.applications import CA, CAGetResponse, CACreateResponse, CADeleteResponse +from cloudflare.types.zero_trust.access.applications import CA base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -18,73 +18,6 @@ class TestCAs: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - ca = client.zero_trust.access.applications.cas.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[CACreateResponse], ca, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: - ca = client.zero_trust.access.applications.cas.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[CACreateResponse], ca, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.zero_trust.access.applications.cas.with_raw_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ca = response.parse() - assert_matches_type(Optional[CACreateResponse], ca, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.zero_trust.access.applications.cas.with_streaming_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ca = response.parse() - assert_matches_type(Optional[CACreateResponse], ca, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.applications.cas.with_raw_response.create( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.applications.cas.with_raw_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.applications.cas.with_raw_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_list(self, client: Cloudflare) -> None: @@ -140,211 +73,10 @@ def test_path_params_list(self, client: Cloudflare) -> None: account_id="string", ) - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - ca = client.zero_trust.access.applications.cas.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[CADeleteResponse], ca, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_delete_with_all_params(self, client: Cloudflare) -> None: - ca = client.zero_trust.access.applications.cas.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[CADeleteResponse], ca, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.zero_trust.access.applications.cas.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ca = response.parse() - assert_matches_type(Optional[CADeleteResponse], ca, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.zero_trust.access.applications.cas.with_streaming_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ca = response.parse() - assert_matches_type(Optional[CADeleteResponse], ca, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.applications.cas.with_raw_response.delete( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.applications.cas.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.applications.cas.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - ca = client.zero_trust.access.applications.cas.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[CAGetResponse], ca, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_get_with_all_params(self, client: Cloudflare) -> None: - ca = client.zero_trust.access.applications.cas.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[CAGetResponse], ca, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zero_trust.access.applications.cas.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ca = response.parse() - assert_matches_type(Optional[CAGetResponse], ca, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zero_trust.access.applications.cas.with_streaming_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ca = response.parse() - assert_matches_type(Optional[CAGetResponse], ca, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.applications.cas.with_raw_response.get( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.applications.cas.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.applications.cas.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - class TestAsyncCAs: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - ca = await async_client.zero_trust.access.applications.cas.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[CACreateResponse], ca, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - ca = await async_client.zero_trust.access.applications.cas.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[CACreateResponse], ca, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.applications.cas.with_raw_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ca = await response.parse() - assert_matches_type(Optional[CACreateResponse], ca, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.applications.cas.with_streaming_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ca = await response.parse() - assert_matches_type(Optional[CACreateResponse], ca, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.applications.cas.with_raw_response.create( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.applications.cas.with_raw_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.applications.cas.with_raw_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: @@ -399,137 +131,3 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.access.applications.cas.with_raw_response.list( account_id="string", ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - ca = await async_client.zero_trust.access.applications.cas.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[CADeleteResponse], ca, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare) -> None: - ca = await async_client.zero_trust.access.applications.cas.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[CADeleteResponse], ca, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.applications.cas.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ca = await response.parse() - assert_matches_type(Optional[CADeleteResponse], ca, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.applications.cas.with_streaming_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ca = await response.parse() - assert_matches_type(Optional[CADeleteResponse], ca, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.applications.cas.with_raw_response.delete( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.applications.cas.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.applications.cas.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - ca = await async_client.zero_trust.access.applications.cas.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[CAGetResponse], ca, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: - ca = await async_client.zero_trust.access.applications.cas.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[CAGetResponse], ca, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.applications.cas.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ca = await response.parse() - assert_matches_type(Optional[CAGetResponse], ca, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.applications.cas.with_streaming_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ca = await response.parse() - assert_matches_type(Optional[CAGetResponse], ca, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.applications.cas.with_raw_response.get( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.applications.cas.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.applications.cas.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) diff --git a/tests/api_resources/zero_trust/access/applications/test_policies.py b/tests/api_resources/zero_trust/access/applications/test_policies.py deleted file mode 100644 index b00514954fd..00000000000 --- a/tests/api_resources/zero_trust/access/applications/test_policies.py +++ /dev/null @@ -1,1105 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access.applications import ( - PolicyGetResponse, - PolicyListResponse, - PolicyCreateResponse, - PolicyDeleteResponse, - PolicyUpdateResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestPolicies: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - policy = client.zero_trust.access.applications.policies.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: - policy = client.zero_trust.access.applications.policies.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - approval_groups=[ - { - "approvals_needed": 1, - "email_addresses": ["test1@cloudflare.com", "test2@cloudflare.com"], - "email_list_uuid": "string", - }, - { - "approvals_needed": 3, - "email_addresses": ["test@cloudflare.com", "test2@cloudflare.com"], - "email_list_uuid": "597147a1-976b-4ef2-9af0-81d5d007fc34", - }, - ], - approval_required=True, - exclude=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - isolation_required=False, - precedence=0, - purpose_justification_prompt="Please enter a justification for entering this protected domain.", - purpose_justification_required=True, - require=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - session_duration="24h", - ) - assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.zero_trust.access.applications.policies.with_raw_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - policy = response.parse() - assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.zero_trust.access.applications.policies.with_streaming_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - policy = response.parse() - assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.applications.policies.with_raw_response.create( - "", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.applications.policies.with_raw_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.applications.policies.with_raw_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - policy = client.zero_trust.access.applications.policies.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: - policy = client.zero_trust.access.applications.policies.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - approval_groups=[ - { - "approvals_needed": 1, - "email_addresses": ["test1@cloudflare.com", "test2@cloudflare.com"], - "email_list_uuid": "string", - }, - { - "approvals_needed": 3, - "email_addresses": ["test@cloudflare.com", "test2@cloudflare.com"], - "email_list_uuid": "597147a1-976b-4ef2-9af0-81d5d007fc34", - }, - ], - approval_required=True, - exclude=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - isolation_required=False, - precedence=0, - purpose_justification_prompt="Please enter a justification for entering this protected domain.", - purpose_justification_required=True, - require=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - session_duration="24h", - ) - assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.zero_trust.access.applications.policies.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - policy = response.parse() - assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.zero_trust.access.applications.policies.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - policy = response.parse() - assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid1` but received ''"): - client.zero_trust.access.applications.policies.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.applications.policies.with_raw_response.update( - "", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.applications.policies.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.applications.policies.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - policy = client.zero_trust.access.applications.policies.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(SyncSinglePage[PolicyListResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_list_with_all_params(self, client: Cloudflare) -> None: - policy = client.zero_trust.access.applications.policies.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(SyncSinglePage[PolicyListResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.zero_trust.access.applications.policies.with_raw_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - policy = response.parse() - assert_matches_type(SyncSinglePage[PolicyListResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.zero_trust.access.applications.policies.with_streaming_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - policy = response.parse() - assert_matches_type(SyncSinglePage[PolicyListResponse], policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.applications.policies.with_raw_response.list( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.applications.policies.with_raw_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.applications.policies.with_raw_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - policy = client.zero_trust.access.applications.policies.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_delete_with_all_params(self, client: Cloudflare) -> None: - policy = client.zero_trust.access.applications.policies.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.zero_trust.access.applications.policies.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - policy = response.parse() - assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.zero_trust.access.applications.policies.with_streaming_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - policy = response.parse() - assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid1` but received ''"): - client.zero_trust.access.applications.policies.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.applications.policies.with_raw_response.delete( - "", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.applications.policies.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.applications.policies.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - policy = client.zero_trust.access.applications.policies.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_get_with_all_params(self, client: Cloudflare) -> None: - policy = client.zero_trust.access.applications.policies.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zero_trust.access.applications.policies.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - policy = response.parse() - assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zero_trust.access.applications.policies.with_streaming_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - policy = response.parse() - assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid1` but received ''"): - client.zero_trust.access.applications.policies.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.applications.policies.with_raw_response.get( - "", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.applications.policies.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.applications.policies.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - -class TestAsyncPolicies: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - policy = await async_client.zero_trust.access.applications.policies.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - policy = await async_client.zero_trust.access.applications.policies.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - approval_groups=[ - { - "approvals_needed": 1, - "email_addresses": ["test1@cloudflare.com", "test2@cloudflare.com"], - "email_list_uuid": "string", - }, - { - "approvals_needed": 3, - "email_addresses": ["test@cloudflare.com", "test2@cloudflare.com"], - "email_list_uuid": "597147a1-976b-4ef2-9af0-81d5d007fc34", - }, - ], - approval_required=True, - exclude=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - isolation_required=False, - precedence=0, - purpose_justification_prompt="Please enter a justification for entering this protected domain.", - purpose_justification_required=True, - require=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - session_duration="24h", - ) - assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.applications.policies.with_raw_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - policy = await response.parse() - assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.applications.policies.with_streaming_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - policy = await response.parse() - assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.applications.policies.with_raw_response.create( - "", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.applications.policies.with_raw_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.applications.policies.with_raw_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - policy = await async_client.zero_trust.access.applications.policies.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - policy = await async_client.zero_trust.access.applications.policies.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - approval_groups=[ - { - "approvals_needed": 1, - "email_addresses": ["test1@cloudflare.com", "test2@cloudflare.com"], - "email_list_uuid": "string", - }, - { - "approvals_needed": 3, - "email_addresses": ["test@cloudflare.com", "test2@cloudflare.com"], - "email_list_uuid": "597147a1-976b-4ef2-9af0-81d5d007fc34", - }, - ], - approval_required=True, - exclude=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - isolation_required=False, - precedence=0, - purpose_justification_prompt="Please enter a justification for entering this protected domain.", - purpose_justification_required=True, - require=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - session_duration="24h", - ) - assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.applications.policies.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - policy = await response.parse() - assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.applications.policies.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - policy = await response.parse() - assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid1` but received ''"): - await async_client.zero_trust.access.applications.policies.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.applications.policies.with_raw_response.update( - "", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.applications.policies.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.applications.policies.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - decision="allow", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - policy = await async_client.zero_trust.access.applications.policies.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(AsyncSinglePage[PolicyListResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: - policy = await async_client.zero_trust.access.applications.policies.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(AsyncSinglePage[PolicyListResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.applications.policies.with_raw_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - policy = await response.parse() - assert_matches_type(AsyncSinglePage[PolicyListResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.applications.policies.with_streaming_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - policy = await response.parse() - assert_matches_type(AsyncSinglePage[PolicyListResponse], policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.applications.policies.with_raw_response.list( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.applications.policies.with_raw_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.applications.policies.with_raw_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - policy = await async_client.zero_trust.access.applications.policies.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare) -> None: - policy = await async_client.zero_trust.access.applications.policies.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.applications.policies.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - policy = await response.parse() - assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.applications.policies.with_streaming_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - policy = await response.parse() - assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid1` but received ''"): - await async_client.zero_trust.access.applications.policies.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.applications.policies.with_raw_response.delete( - "", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.applications.policies.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.applications.policies.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - policy = await async_client.zero_trust.access.applications.policies.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: - policy = await async_client.zero_trust.access.applications.policies.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.applications.policies.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - policy = await response.parse() - assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.applications.policies.with_streaming_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - policy = await response.parse() - assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid1` but received ''"): - await async_client.zero_trust.access.applications.policies.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.applications.policies.with_raw_response.get( - "", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.applications.policies.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.applications.policies.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) diff --git a/tests/api_resources/zero_trust/access/logs/__init__.py b/tests/api_resources/zero_trust/access/logs/__init__.py deleted file mode 100644 index fd8019a9a1a..00000000000 --- a/tests/api_resources/zero_trust/access/logs/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/zero_trust/access/logs/test_access_requests.py b/tests/api_resources/zero_trust/access/logs/test_access_requests.py deleted file mode 100644 index 6e0b18db5a3..00000000000 --- a/tests/api_resources/zero_trust/access/logs/test_access_requests.py +++ /dev/null @@ -1,98 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.access.logs import AccessRequestListResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAccessRequests: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - access_request = client.zero_trust.access.logs.access_requests.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[AccessRequestListResponse], access_request, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.zero_trust.access.logs.access_requests.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - access_request = response.parse() - assert_matches_type(Optional[AccessRequestListResponse], access_request, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.zero_trust.access.logs.access_requests.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - access_request = response.parse() - assert_matches_type(Optional[AccessRequestListResponse], access_request, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.logs.access_requests.with_raw_response.list( - "", - ) - - -class TestAsyncAccessRequests: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - access_request = await async_client.zero_trust.access.logs.access_requests.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[AccessRequestListResponse], access_request, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.logs.access_requests.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - access_request = await response.parse() - assert_matches_type(Optional[AccessRequestListResponse], access_request, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.logs.access_requests.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - access_request = await response.parse() - assert_matches_type(Optional[AccessRequestListResponse], access_request, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.logs.access_requests.with_raw_response.list( - "", - ) diff --git a/tests/api_resources/zero_trust/access/test_bookmarks.py b/tests/api_resources/zero_trust/access/test_bookmarks.py deleted file mode 100644 index f063d8abf85..00000000000 --- a/tests/api_resources/zero_trust/access/test_bookmarks.py +++ /dev/null @@ -1,506 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access import ( - Bookmark, - BookmarkDeleteResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestBookmarks: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - bookmark = client.zero_trust.access.bookmarks.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - body={}, - ) - assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.zero_trust.access.bookmarks.with_raw_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - body={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookmark = response.parse() - assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.zero_trust.access.bookmarks.with_streaming_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - bookmark = response.parse() - assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.bookmarks.with_raw_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - body={}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.bookmarks.with_raw_response.create( - "", - identifier="699d98642c564d2e855e9661899b7252", - body={}, - ) - - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - bookmark = client.zero_trust.access.bookmarks.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - body={}, - ) - assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.zero_trust.access.bookmarks.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - body={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookmark = response.parse() - assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) - - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.zero_trust.access.bookmarks.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - bookmark = response.parse() - assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.bookmarks.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - body={}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.bookmarks.with_raw_response.update( - "", - identifier="699d98642c564d2e855e9661899b7252", - body={}, - ) - - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - bookmark = client.zero_trust.access.bookmarks.list( - "699d98642c564d2e855e9661899b7252", - ) - assert_matches_type(SyncSinglePage[Bookmark], bookmark, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.zero_trust.access.bookmarks.with_raw_response.list( - "699d98642c564d2e855e9661899b7252", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookmark = response.parse() - assert_matches_type(SyncSinglePage[Bookmark], bookmark, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.zero_trust.access.bookmarks.with_streaming_response.list( - "699d98642c564d2e855e9661899b7252", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - bookmark = response.parse() - assert_matches_type(SyncSinglePage[Bookmark], bookmark, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.bookmarks.with_raw_response.list( - "", - ) - - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - bookmark = client.zero_trust.access.bookmarks.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - ) - assert_matches_type(Optional[BookmarkDeleteResponse], bookmark, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.zero_trust.access.bookmarks.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookmark = response.parse() - assert_matches_type(Optional[BookmarkDeleteResponse], bookmark, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.zero_trust.access.bookmarks.with_streaming_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - bookmark = response.parse() - assert_matches_type(Optional[BookmarkDeleteResponse], bookmark, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.bookmarks.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.bookmarks.with_raw_response.delete( - "", - identifier="699d98642c564d2e855e9661899b7252", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - bookmark = client.zero_trust.access.bookmarks.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - ) - assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zero_trust.access.bookmarks.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookmark = response.parse() - assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zero_trust.access.bookmarks.with_streaming_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - bookmark = response.parse() - assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.bookmarks.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.bookmarks.with_raw_response.get( - "", - identifier="699d98642c564d2e855e9661899b7252", - ) - - -class TestAsyncBookmarks: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - bookmark = await async_client.zero_trust.access.bookmarks.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - body={}, - ) - assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.bookmarks.with_raw_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - body={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookmark = await response.parse() - assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.bookmarks.with_streaming_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - bookmark = await response.parse() - assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.bookmarks.with_raw_response.create( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - body={}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.bookmarks.with_raw_response.create( - "", - identifier="699d98642c564d2e855e9661899b7252", - body={}, - ) - - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - bookmark = await async_client.zero_trust.access.bookmarks.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - body={}, - ) - assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) - - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.bookmarks.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - body={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookmark = await response.parse() - assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) - - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.bookmarks.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - bookmark = await response.parse() - assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.bookmarks.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - body={}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.bookmarks.with_raw_response.update( - "", - identifier="699d98642c564d2e855e9661899b7252", - body={}, - ) - - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - bookmark = await async_client.zero_trust.access.bookmarks.list( - "699d98642c564d2e855e9661899b7252", - ) - assert_matches_type(AsyncSinglePage[Bookmark], bookmark, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.bookmarks.with_raw_response.list( - "699d98642c564d2e855e9661899b7252", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookmark = await response.parse() - assert_matches_type(AsyncSinglePage[Bookmark], bookmark, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.bookmarks.with_streaming_response.list( - "699d98642c564d2e855e9661899b7252", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - bookmark = await response.parse() - assert_matches_type(AsyncSinglePage[Bookmark], bookmark, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.bookmarks.with_raw_response.list( - "", - ) - - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - bookmark = await async_client.zero_trust.access.bookmarks.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - ) - assert_matches_type(Optional[BookmarkDeleteResponse], bookmark, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.bookmarks.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookmark = await response.parse() - assert_matches_type(Optional[BookmarkDeleteResponse], bookmark, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.bookmarks.with_streaming_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - bookmark = await response.parse() - assert_matches_type(Optional[BookmarkDeleteResponse], bookmark, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.bookmarks.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.bookmarks.with_raw_response.delete( - "", - identifier="699d98642c564d2e855e9661899b7252", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - bookmark = await async_client.zero_trust.access.bookmarks.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - ) - assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.bookmarks.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookmark = await response.parse() - assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.bookmarks.with_streaming_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - bookmark = await response.parse() - assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.bookmarks.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.bookmarks.with_raw_response.get( - "", - identifier="699d98642c564d2e855e9661899b7252", - ) diff --git a/tests/api_resources/zero_trust/access/test_certificates.py b/tests/api_resources/zero_trust/access/test_certificates.py index 14d5566332c..feb21df3ea5 100644 --- a/tests/api_resources/zero_trust/access/test_certificates.py +++ b/tests/api_resources/zero_trust/access/test_certificates.py @@ -10,10 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access import ( - Certificate, - CertificateDeleteResponse, -) +from cloudflare.types.zero_trust.access import Certificate base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -89,81 +86,6 @@ def test_path_params_create(self, client: Cloudflare) -> None: account_id="string", ) - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - certificate = client.zero_trust.access.certificates.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - associated_hostnames=["admin.example.com", "admin.example.com", "admin.example.com"], - account_id="string", - ) - assert_matches_type(Optional[Certificate], certificate, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: - certificate = client.zero_trust.access.certificates.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - associated_hostnames=["admin.example.com", "admin.example.com", "admin.example.com"], - account_id="string", - name="Allow devs", - ) - assert_matches_type(Optional[Certificate], certificate, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.zero_trust.access.certificates.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - associated_hostnames=["admin.example.com", "admin.example.com", "admin.example.com"], - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - certificate = response.parse() - assert_matches_type(Optional[Certificate], certificate, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.zero_trust.access.certificates.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - associated_hostnames=["admin.example.com", "admin.example.com", "admin.example.com"], - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - certificate = response.parse() - assert_matches_type(Optional[Certificate], certificate, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.certificates.with_raw_response.update( - "", - associated_hostnames=["admin.example.com", "admin.example.com", "admin.example.com"], - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.certificates.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - associated_hostnames=["admin.example.com", "admin.example.com", "admin.example.com"], - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.certificates.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - associated_hostnames=["admin.example.com", "admin.example.com", "admin.example.com"], - account_id="string", - ) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_list(self, client: Cloudflare) -> None: @@ -219,140 +141,6 @@ def test_path_params_list(self, client: Cloudflare) -> None: account_id="string", ) - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - certificate = client.zero_trust.access.certificates.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_delete_with_all_params(self, client: Cloudflare) -> None: - certificate = client.zero_trust.access.certificates.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.zero_trust.access.certificates.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - certificate = response.parse() - assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.zero_trust.access.certificates.with_streaming_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - certificate = response.parse() - assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.certificates.with_raw_response.delete( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.certificates.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.certificates.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - certificate = client.zero_trust.access.certificates.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[Certificate], certificate, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_get_with_all_params(self, client: Cloudflare) -> None: - certificate = client.zero_trust.access.certificates.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[Certificate], certificate, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zero_trust.access.certificates.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - certificate = response.parse() - assert_matches_type(Optional[Certificate], certificate, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zero_trust.access.certificates.with_streaming_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - certificate = response.parse() - assert_matches_type(Optional[Certificate], certificate, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.certificates.with_raw_response.get( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.certificates.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.certificates.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - class TestAsyncCertificates: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -425,81 +213,6 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: account_id="string", ) - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - certificate = await async_client.zero_trust.access.certificates.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - associated_hostnames=["admin.example.com", "admin.example.com", "admin.example.com"], - account_id="string", - ) - assert_matches_type(Optional[Certificate], certificate, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - certificate = await async_client.zero_trust.access.certificates.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - associated_hostnames=["admin.example.com", "admin.example.com", "admin.example.com"], - account_id="string", - name="Allow devs", - ) - assert_matches_type(Optional[Certificate], certificate, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.certificates.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - associated_hostnames=["admin.example.com", "admin.example.com", "admin.example.com"], - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - certificate = await response.parse() - assert_matches_type(Optional[Certificate], certificate, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.certificates.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - associated_hostnames=["admin.example.com", "admin.example.com", "admin.example.com"], - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - certificate = await response.parse() - assert_matches_type(Optional[Certificate], certificate, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.certificates.with_raw_response.update( - "", - associated_hostnames=["admin.example.com", "admin.example.com", "admin.example.com"], - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.certificates.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - associated_hostnames=["admin.example.com", "admin.example.com", "admin.example.com"], - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.certificates.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - associated_hostnames=["admin.example.com", "admin.example.com", "admin.example.com"], - account_id="string", - ) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: @@ -554,137 +267,3 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.access.certificates.with_raw_response.list( account_id="string", ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - certificate = await async_client.zero_trust.access.certificates.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare) -> None: - certificate = await async_client.zero_trust.access.certificates.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.certificates.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - certificate = await response.parse() - assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.certificates.with_streaming_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - certificate = await response.parse() - assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.certificates.with_raw_response.delete( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.certificates.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.certificates.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - certificate = await async_client.zero_trust.access.certificates.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[Certificate], certificate, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: - certificate = await async_client.zero_trust.access.certificates.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[Certificate], certificate, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.certificates.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - certificate = await response.parse() - assert_matches_type(Optional[Certificate], certificate, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.certificates.with_streaming_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - certificate = await response.parse() - assert_matches_type(Optional[Certificate], certificate, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.certificates.with_raw_response.get( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.certificates.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.certificates.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) diff --git a/tests/api_resources/zero_trust/access/test_custom_pages.py b/tests/api_resources/zero_trust/access/test_custom_pages.py deleted file mode 100644 index 7c84edab1bc..00000000000 --- a/tests/api_resources/zero_trust/access/test_custom_pages.py +++ /dev/null @@ -1,567 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access import ( - CustomPage, - CustomPageWithoutHTML, - CustomPageDeleteResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestCustomPages: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - custom_page = client.zero_trust.access.custom_pages.create( - "023e105f4ecef8ad9ca31a8372d0c353", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - ) - assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: - custom_page = client.zero_trust.access.custom_pages.create( - "023e105f4ecef8ad9ca31a8372d0c353", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - app_count=0, - ) - assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.zero_trust.access.custom_pages.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - custom_page = response.parse() - assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.zero_trust.access.custom_pages.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - custom_page = response.parse() - assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.custom_pages.with_raw_response.create( - "", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - ) - - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - custom_page = client.zero_trust.access.custom_pages.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - ) - assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) - - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: - custom_page = client.zero_trust.access.custom_pages.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - app_count=0, - ) - assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.zero_trust.access.custom_pages.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - custom_page = response.parse() - assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) - - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.zero_trust.access.custom_pages.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - custom_page = response.parse() - assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.custom_pages.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.custom_pages.with_raw_response.update( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - ) - - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - custom_page = client.zero_trust.access.custom_pages.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SyncSinglePage[CustomPageWithoutHTML], custom_page, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.zero_trust.access.custom_pages.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - custom_page = response.parse() - assert_matches_type(SyncSinglePage[CustomPageWithoutHTML], custom_page, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.zero_trust.access.custom_pages.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - custom_page = response.parse() - assert_matches_type(SyncSinglePage[CustomPageWithoutHTML], custom_page, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.custom_pages.with_raw_response.list( - "", - ) - - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - custom_page = client.zero_trust.access.custom_pages.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[CustomPageDeleteResponse], custom_page, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.zero_trust.access.custom_pages.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - custom_page = response.parse() - assert_matches_type(Optional[CustomPageDeleteResponse], custom_page, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.zero_trust.access.custom_pages.with_streaming_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - custom_page = response.parse() - assert_matches_type(Optional[CustomPageDeleteResponse], custom_page, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.custom_pages.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.custom_pages.with_raw_response.delete( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - custom_page = client.zero_trust.access.custom_pages.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[CustomPage], custom_page, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zero_trust.access.custom_pages.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - custom_page = response.parse() - assert_matches_type(Optional[CustomPage], custom_page, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zero_trust.access.custom_pages.with_streaming_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - custom_page = response.parse() - assert_matches_type(Optional[CustomPage], custom_page, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.custom_pages.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.custom_pages.with_raw_response.get( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncCustomPages: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - custom_page = await async_client.zero_trust.access.custom_pages.create( - "023e105f4ecef8ad9ca31a8372d0c353", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - ) - assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - custom_page = await async_client.zero_trust.access.custom_pages.create( - "023e105f4ecef8ad9ca31a8372d0c353", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - app_count=0, - ) - assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.custom_pages.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - custom_page = await response.parse() - assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.custom_pages.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - custom_page = await response.parse() - assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.custom_pages.with_raw_response.create( - "", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - ) - - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - custom_page = await async_client.zero_trust.access.custom_pages.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - ) - assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) - - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - custom_page = await async_client.zero_trust.access.custom_pages.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - app_count=0, - ) - assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) - - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.custom_pages.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - custom_page = await response.parse() - assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) - - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.custom_pages.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - custom_page = await response.parse() - assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.custom_pages.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.custom_pages.with_raw_response.update( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - custom_html="

Access Denied

", - name="string", - type="identity_denied", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - custom_page = await async_client.zero_trust.access.custom_pages.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(AsyncSinglePage[CustomPageWithoutHTML], custom_page, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.custom_pages.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - custom_page = await response.parse() - assert_matches_type(AsyncSinglePage[CustomPageWithoutHTML], custom_page, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.custom_pages.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - custom_page = await response.parse() - assert_matches_type(AsyncSinglePage[CustomPageWithoutHTML], custom_page, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.custom_pages.with_raw_response.list( - "", - ) - - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - custom_page = await async_client.zero_trust.access.custom_pages.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[CustomPageDeleteResponse], custom_page, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.custom_pages.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - custom_page = await response.parse() - assert_matches_type(Optional[CustomPageDeleteResponse], custom_page, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.custom_pages.with_streaming_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - custom_page = await response.parse() - assert_matches_type(Optional[CustomPageDeleteResponse], custom_page, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.custom_pages.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.custom_pages.with_raw_response.delete( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - custom_page = await async_client.zero_trust.access.custom_pages.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[CustomPage], custom_page, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.custom_pages.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - custom_page = await response.parse() - assert_matches_type(Optional[CustomPage], custom_page, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.custom_pages.with_streaming_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - custom_page = await response.parse() - assert_matches_type(Optional[CustomPage], custom_page, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.custom_pages.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.custom_pages.with_raw_response.get( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/zero_trust/access/test_groups.py b/tests/api_resources/zero_trust/access/test_groups.py index f7be2db9428..757c6dd633a 100644 --- a/tests/api_resources/zero_trust/access/test_groups.py +++ b/tests/api_resources/zero_trust/access/test_groups.py @@ -10,10 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access import ( - ZeroTrustGroup, - GroupDeleteResponse, -) +from cloudflare.types.zero_trust.access import ZeroTrustGroup base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -123,126 +120,6 @@ def test_path_params_create(self, client: Cloudflare) -> None: account_id="string", ) - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - group = client.zero_trust.access.groups.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: - group = client.zero_trust.access.groups.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - exclude=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - is_default=True, - require=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - ) - assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.zero_trust.access.groups.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - group = response.parse() - assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.zero_trust.access.groups.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - group = response.parse() - assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.groups.with_raw_response.update( - "", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.groups.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.groups.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_list(self, client: Cloudflare) -> None: @@ -298,140 +175,6 @@ def test_path_params_list(self, client: Cloudflare) -> None: account_id="string", ) - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - group = client.zero_trust.access.groups.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[GroupDeleteResponse], group, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_delete_with_all_params(self, client: Cloudflare) -> None: - group = client.zero_trust.access.groups.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[GroupDeleteResponse], group, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.zero_trust.access.groups.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - group = response.parse() - assert_matches_type(Optional[GroupDeleteResponse], group, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.zero_trust.access.groups.with_streaming_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - group = response.parse() - assert_matches_type(Optional[GroupDeleteResponse], group, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.groups.with_raw_response.delete( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.groups.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.groups.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - group = client.zero_trust.access.groups.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_get_with_all_params(self, client: Cloudflare) -> None: - group = client.zero_trust.access.groups.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zero_trust.access.groups.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - group = response.parse() - assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zero_trust.access.groups.with_streaming_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - group = response.parse() - assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.groups.with_raw_response.get( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.groups.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.groups.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - class TestAsyncGroups: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -538,126 +281,6 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: account_id="string", ) - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - group = await async_client.zero_trust.access.groups.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - group = await async_client.zero_trust.access.groups.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - exclude=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - is_default=True, - require=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - ) - assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.groups.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - group = await response.parse() - assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.groups.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - group = await response.parse() - assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.groups.with_raw_response.update( - "", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.groups.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.groups.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[ - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - {"email": {"email": "test@example.com"}}, - ], - name="Allow devs", - account_id="string", - ) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: @@ -712,137 +335,3 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.access.groups.with_raw_response.list( account_id="string", ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - group = await async_client.zero_trust.access.groups.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[GroupDeleteResponse], group, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare) -> None: - group = await async_client.zero_trust.access.groups.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[GroupDeleteResponse], group, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.groups.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - group = await response.parse() - assert_matches_type(Optional[GroupDeleteResponse], group, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.groups.with_streaming_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - group = await response.parse() - assert_matches_type(Optional[GroupDeleteResponse], group, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.groups.with_raw_response.delete( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.groups.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.groups.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - group = await async_client.zero_trust.access.groups.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: - group = await async_client.zero_trust.access.groups.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.groups.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - group = await response.parse() - assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.groups.with_streaming_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - group = await response.parse() - assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.groups.with_raw_response.get( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.groups.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.groups.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) diff --git a/tests/api_resources/zero_trust/access/test_keys.py b/tests/api_resources/zero_trust/access/test_keys.py deleted file mode 100644 index ccb5129562c..00000000000 --- a/tests/api_resources/zero_trust/access/test_keys.py +++ /dev/null @@ -1,258 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.access import KeyGetResponse, KeyRotateResponse, KeyUpdateResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestKeys: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - key = client.zero_trust.access.keys.update( - "023e105f4ecef8ad9ca31a8372d0c353", - key_rotation_interval_days=30, - ) - assert_matches_type(Optional[KeyUpdateResponse], key, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.zero_trust.access.keys.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - key_rotation_interval_days=30, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - key = response.parse() - assert_matches_type(Optional[KeyUpdateResponse], key, path=["response"]) - - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.zero_trust.access.keys.with_streaming_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - key_rotation_interval_days=30, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - key = response.parse() - assert_matches_type(Optional[KeyUpdateResponse], key, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.keys.with_raw_response.update( - "", - key_rotation_interval_days=30, - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - key = client.zero_trust.access.keys.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zero_trust.access.keys.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - key = response.parse() - assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zero_trust.access.keys.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - key = response.parse() - assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.keys.with_raw_response.get( - "", - ) - - @parametrize - def test_method_rotate(self, client: Cloudflare) -> None: - key = client.zero_trust.access.keys.rotate( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[KeyRotateResponse], key, path=["response"]) - - @parametrize - def test_raw_response_rotate(self, client: Cloudflare) -> None: - response = client.zero_trust.access.keys.with_raw_response.rotate( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - key = response.parse() - assert_matches_type(Optional[KeyRotateResponse], key, path=["response"]) - - @parametrize - def test_streaming_response_rotate(self, client: Cloudflare) -> None: - with client.zero_trust.access.keys.with_streaming_response.rotate( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - key = response.parse() - assert_matches_type(Optional[KeyRotateResponse], key, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_rotate(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.keys.with_raw_response.rotate( - "", - ) - - -class TestAsyncKeys: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - key = await async_client.zero_trust.access.keys.update( - "023e105f4ecef8ad9ca31a8372d0c353", - key_rotation_interval_days=30, - ) - assert_matches_type(Optional[KeyUpdateResponse], key, path=["response"]) - - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.keys.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - key_rotation_interval_days=30, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - key = await response.parse() - assert_matches_type(Optional[KeyUpdateResponse], key, path=["response"]) - - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.keys.with_streaming_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - key_rotation_interval_days=30, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - key = await response.parse() - assert_matches_type(Optional[KeyUpdateResponse], key, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.keys.with_raw_response.update( - "", - key_rotation_interval_days=30, - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - key = await async_client.zero_trust.access.keys.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.keys.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - key = await response.parse() - assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.keys.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - key = await response.parse() - assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.keys.with_raw_response.get( - "", - ) - - @parametrize - async def test_method_rotate(self, async_client: AsyncCloudflare) -> None: - key = await async_client.zero_trust.access.keys.rotate( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[KeyRotateResponse], key, path=["response"]) - - @parametrize - async def test_raw_response_rotate(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.keys.with_raw_response.rotate( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - key = await response.parse() - assert_matches_type(Optional[KeyRotateResponse], key, path=["response"]) - - @parametrize - async def test_streaming_response_rotate(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.keys.with_streaming_response.rotate( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - key = await response.parse() - assert_matches_type(Optional[KeyRotateResponse], key, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_rotate(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.keys.with_raw_response.rotate( - "", - ) diff --git a/tests/api_resources/zero_trust/access/test_service_tokens.py b/tests/api_resources/zero_trust/access/test_service_tokens.py index 61c913a70aa..dd32841ccab 100644 --- a/tests/api_resources/zero_trust/access/test_service_tokens.py +++ b/tests/api_resources/zero_trust/access/test_service_tokens.py @@ -10,11 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access import ( - ServiceToken, - ServiceTokenCreateResponse, - ServiceTokenRotateResponse, -) +from cloudflare.types.zero_trust.access import ServiceToken, ServiceTokenCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -84,75 +80,6 @@ def test_path_params_create(self, client: Cloudflare) -> None: account_id="string", ) - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - service_token = client.zero_trust.access.service_tokens.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: - service_token = client.zero_trust.access.service_tokens.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - duration="60m", - name="CI/CD token", - ) - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.zero_trust.access.service_tokens.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service_token = response.parse() - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.zero_trust.access.service_tokens.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service_token = response.parse() - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.service_tokens.with_raw_response.update( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.service_tokens.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.service_tokens.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_list(self, client: Cloudflare) -> None: @@ -208,236 +135,6 @@ def test_path_params_list(self, client: Cloudflare) -> None: account_id="string", ) - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - service_token = client.zero_trust.access.service_tokens.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_delete_with_all_params(self, client: Cloudflare) -> None: - service_token = client.zero_trust.access.service_tokens.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.zero_trust.access.service_tokens.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service_token = response.parse() - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.zero_trust.access.service_tokens.with_streaming_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service_token = response.parse() - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.service_tokens.with_raw_response.delete( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.service_tokens.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.service_tokens.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - service_token = client.zero_trust.access.service_tokens.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_get_with_all_params(self, client: Cloudflare) -> None: - service_token = client.zero_trust.access.service_tokens.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zero_trust.access.service_tokens.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service_token = response.parse() - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zero_trust.access.service_tokens.with_streaming_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service_token = response.parse() - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.service_tokens.with_raw_response.get( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.service_tokens.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.service_tokens.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - @parametrize - def test_method_refresh(self, client: Cloudflare) -> None: - service_token = client.zero_trust.access.service_tokens.refresh( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @parametrize - def test_raw_response_refresh(self, client: Cloudflare) -> None: - response = client.zero_trust.access.service_tokens.with_raw_response.refresh( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service_token = response.parse() - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @parametrize - def test_streaming_response_refresh(self, client: Cloudflare) -> None: - with client.zero_trust.access.service_tokens.with_streaming_response.refresh( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service_token = response.parse() - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_refresh(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.service_tokens.with_raw_response.refresh( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.service_tokens.with_raw_response.refresh( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @parametrize - def test_method_rotate(self, client: Cloudflare) -> None: - service_token = client.zero_trust.access.service_tokens.rotate( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ServiceTokenRotateResponse], service_token, path=["response"]) - - @parametrize - def test_raw_response_rotate(self, client: Cloudflare) -> None: - response = client.zero_trust.access.service_tokens.with_raw_response.rotate( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service_token = response.parse() - assert_matches_type(Optional[ServiceTokenRotateResponse], service_token, path=["response"]) - - @parametrize - def test_streaming_response_rotate(self, client: Cloudflare) -> None: - with client.zero_trust.access.service_tokens.with_streaming_response.rotate( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service_token = response.parse() - assert_matches_type(Optional[ServiceTokenRotateResponse], service_token, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_rotate(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.service_tokens.with_raw_response.rotate( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.service_tokens.with_raw_response.rotate( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - class TestAsyncServiceTokens: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -504,75 +201,6 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: account_id="string", ) - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - service_token = await async_client.zero_trust.access.service_tokens.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - service_token = await async_client.zero_trust.access.service_tokens.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - duration="60m", - name="CI/CD token", - ) - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.service_tokens.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service_token = await response.parse() - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.service_tokens.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service_token = await response.parse() - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.service_tokens.with_raw_response.update( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.service_tokens.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.service_tokens.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: @@ -627,233 +255,3 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.access.service_tokens.with_raw_response.list( account_id="string", ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - service_token = await async_client.zero_trust.access.service_tokens.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare) -> None: - service_token = await async_client.zero_trust.access.service_tokens.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.service_tokens.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service_token = await response.parse() - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.service_tokens.with_streaming_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service_token = await response.parse() - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.service_tokens.with_raw_response.delete( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.service_tokens.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.service_tokens.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - service_token = await async_client.zero_trust.access.service_tokens.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: - service_token = await async_client.zero_trust.access.service_tokens.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.service_tokens.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service_token = await response.parse() - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.service_tokens.with_streaming_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service_token = await response.parse() - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.service_tokens.with_raw_response.get( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.service_tokens.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.service_tokens.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - @parametrize - async def test_method_refresh(self, async_client: AsyncCloudflare) -> None: - service_token = await async_client.zero_trust.access.service_tokens.refresh( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @parametrize - async def test_raw_response_refresh(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.service_tokens.with_raw_response.refresh( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service_token = await response.parse() - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - @parametrize - async def test_streaming_response_refresh(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.service_tokens.with_streaming_response.refresh( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service_token = await response.parse() - assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_refresh(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.service_tokens.with_raw_response.refresh( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.service_tokens.with_raw_response.refresh( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @parametrize - async def test_method_rotate(self, async_client: AsyncCloudflare) -> None: - service_token = await async_client.zero_trust.access.service_tokens.rotate( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ServiceTokenRotateResponse], service_token, path=["response"]) - - @parametrize - async def test_raw_response_rotate(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.service_tokens.with_raw_response.rotate( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service_token = await response.parse() - assert_matches_type(Optional[ServiceTokenRotateResponse], service_token, path=["response"]) - - @parametrize - async def test_streaming_response_rotate(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.service_tokens.with_streaming_response.rotate( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service_token = await response.parse() - assert_matches_type(Optional[ServiceTokenRotateResponse], service_token, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_rotate(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.service_tokens.with_raw_response.rotate( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.service_tokens.with_raw_response.rotate( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/zero_trust/access/test_tags.py b/tests/api_resources/zero_trust/access/test_tags.py deleted file mode 100644 index c81e4b77bcb..00000000000 --- a/tests/api_resources/zero_trust/access/test_tags.py +++ /dev/null @@ -1,481 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access import Tag, TagDeleteResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestTags: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - tag = client.zero_trust.access.tags.create( - "023e105f4ecef8ad9ca31a8372d0c353", - name="engineers", - ) - assert_matches_type(Optional[Tag], tag, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.zero_trust.access.tags.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - name="engineers", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - tag = response.parse() - assert_matches_type(Optional[Tag], tag, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.zero_trust.access.tags.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - name="engineers", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - tag = response.parse() - assert_matches_type(Optional[Tag], tag, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.tags.with_raw_response.create( - "", - name="engineers", - ) - - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - tag = client.zero_trust.access.tags.update( - "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - name="engineers", - ) - assert_matches_type(Optional[Tag], tag, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.zero_trust.access.tags.with_raw_response.update( - "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - name="engineers", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - tag = response.parse() - assert_matches_type(Optional[Tag], tag, path=["response"]) - - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.zero_trust.access.tags.with_streaming_response.update( - "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - name="engineers", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - tag = response.parse() - assert_matches_type(Optional[Tag], tag, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.tags.with_raw_response.update( - "engineers", - identifier="", - name="engineers", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `tag_name` but received ''"): - client.zero_trust.access.tags.with_raw_response.update( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - name="", - ) - - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - tag = client.zero_trust.access.tags.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SyncSinglePage[Tag], tag, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.zero_trust.access.tags.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - tag = response.parse() - assert_matches_type(SyncSinglePage[Tag], tag, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.zero_trust.access.tags.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - tag = response.parse() - assert_matches_type(SyncSinglePage[Tag], tag, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.tags.with_raw_response.list( - "", - ) - - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - tag = client.zero_trust.access.tags.delete( - "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[TagDeleteResponse], tag, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.zero_trust.access.tags.with_raw_response.delete( - "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - tag = response.parse() - assert_matches_type(Optional[TagDeleteResponse], tag, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.zero_trust.access.tags.with_streaming_response.delete( - "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - tag = response.parse() - assert_matches_type(Optional[TagDeleteResponse], tag, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.tags.with_raw_response.delete( - "engineers", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): - client.zero_trust.access.tags.with_raw_response.delete( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - tag = client.zero_trust.access.tags.get( - "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[Tag], tag, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zero_trust.access.tags.with_raw_response.get( - "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - tag = response.parse() - assert_matches_type(Optional[Tag], tag, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zero_trust.access.tags.with_streaming_response.get( - "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - tag = response.parse() - assert_matches_type(Optional[Tag], tag, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.tags.with_raw_response.get( - "engineers", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): - client.zero_trust.access.tags.with_raw_response.get( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncTags: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - tag = await async_client.zero_trust.access.tags.create( - "023e105f4ecef8ad9ca31a8372d0c353", - name="engineers", - ) - assert_matches_type(Optional[Tag], tag, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.tags.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - name="engineers", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - tag = await response.parse() - assert_matches_type(Optional[Tag], tag, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.tags.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - name="engineers", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - tag = await response.parse() - assert_matches_type(Optional[Tag], tag, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.tags.with_raw_response.create( - "", - name="engineers", - ) - - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - tag = await async_client.zero_trust.access.tags.update( - "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - name="engineers", - ) - assert_matches_type(Optional[Tag], tag, path=["response"]) - - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.tags.with_raw_response.update( - "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - name="engineers", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - tag = await response.parse() - assert_matches_type(Optional[Tag], tag, path=["response"]) - - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.tags.with_streaming_response.update( - "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - name="engineers", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - tag = await response.parse() - assert_matches_type(Optional[Tag], tag, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.tags.with_raw_response.update( - "engineers", - identifier="", - name="engineers", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `tag_name` but received ''"): - await async_client.zero_trust.access.tags.with_raw_response.update( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - name="", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - tag = await async_client.zero_trust.access.tags.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(AsyncSinglePage[Tag], tag, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.tags.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - tag = await response.parse() - assert_matches_type(AsyncSinglePage[Tag], tag, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.tags.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - tag = await response.parse() - assert_matches_type(AsyncSinglePage[Tag], tag, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.tags.with_raw_response.list( - "", - ) - - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - tag = await async_client.zero_trust.access.tags.delete( - "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[TagDeleteResponse], tag, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.tags.with_raw_response.delete( - "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - tag = await response.parse() - assert_matches_type(Optional[TagDeleteResponse], tag, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.tags.with_streaming_response.delete( - "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - tag = await response.parse() - assert_matches_type(Optional[TagDeleteResponse], tag, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.tags.with_raw_response.delete( - "engineers", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): - await async_client.zero_trust.access.tags.with_raw_response.delete( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - tag = await async_client.zero_trust.access.tags.get( - "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[Tag], tag, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.tags.with_raw_response.get( - "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - tag = await response.parse() - assert_matches_type(Optional[Tag], tag, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.tags.with_streaming_response.get( - "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - tag = await response.parse() - assert_matches_type(Optional[Tag], tag, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.tags.with_raw_response.get( - "engineers", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): - await async_client.zero_trust.access.tags.with_raw_response.get( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/zero_trust/access/test_users.py b/tests/api_resources/zero_trust/access/test_users.py deleted file mode 100644 index 502300c4919..00000000000 --- a/tests/api_resources/zero_trust/access/test_users.py +++ /dev/null @@ -1,99 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access import AccessUser - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestUsers: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - user = client.zero_trust.access.users.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SyncSinglePage[AccessUser], user, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.zero_trust.access.users.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = response.parse() - assert_matches_type(SyncSinglePage[AccessUser], user, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.zero_trust.access.users.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = response.parse() - assert_matches_type(SyncSinglePage[AccessUser], user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.users.with_raw_response.list( - "", - ) - - -class TestAsyncUsers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - user = await async_client.zero_trust.access.users.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(AsyncSinglePage[AccessUser], user, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.users.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = await response.parse() - assert_matches_type(AsyncSinglePage[AccessUser], user, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.users.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = await response.parse() - assert_matches_type(AsyncSinglePage[AccessUser], user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.users.with_raw_response.list( - "", - ) diff --git a/tests/api_resources/zero_trust/access/users/__init__.py b/tests/api_resources/zero_trust/access/users/__init__.py deleted file mode 100644 index fd8019a9a1a..00000000000 --- a/tests/api_resources/zero_trust/access/users/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/zero_trust/access/users/test_active_sessions.py b/tests/api_resources/zero_trust/access/users/test_active_sessions.py deleted file mode 100644 index 257192ec0de..00000000000 --- a/tests/api_resources/zero_trust/access/users/test_active_sessions.py +++ /dev/null @@ -1,239 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access.users import ActiveSessionGetResponse, ActiveSessionListResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestActiveSessions: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - active_session = client.zero_trust.access.users.active_sessions.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SyncSinglePage[ActiveSessionListResponse], active_session, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.zero_trust.access.users.active_sessions.with_raw_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - active_session = response.parse() - assert_matches_type(SyncSinglePage[ActiveSessionListResponse], active_session, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.zero_trust.access.users.active_sessions.with_streaming_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - active_session = response.parse() - assert_matches_type(SyncSinglePage[ActiveSessionListResponse], active_session, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.users.active_sessions.with_raw_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.zero_trust.access.users.active_sessions.with_raw_response.list( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - active_session = client.zero_trust.access.users.active_sessions.get( - "X1aXj1lFVcqqyoXF", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - ) - assert_matches_type(Optional[ActiveSessionGetResponse], active_session, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zero_trust.access.users.active_sessions.with_raw_response.get( - "X1aXj1lFVcqqyoXF", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - active_session = response.parse() - assert_matches_type(Optional[ActiveSessionGetResponse], active_session, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zero_trust.access.users.active_sessions.with_streaming_response.get( - "X1aXj1lFVcqqyoXF", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - active_session = response.parse() - assert_matches_type(Optional[ActiveSessionGetResponse], active_session, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.users.active_sessions.with_raw_response.get( - "X1aXj1lFVcqqyoXF", - identifier="", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.zero_trust.access.users.active_sessions.with_raw_response.get( - "X1aXj1lFVcqqyoXF", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `nonce` but received ''"): - client.zero_trust.access.users.active_sessions.with_raw_response.get( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - ) - - -class TestAsyncActiveSessions: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - active_session = await async_client.zero_trust.access.users.active_sessions.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(AsyncSinglePage[ActiveSessionListResponse], active_session, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.users.active_sessions.with_raw_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - active_session = await response.parse() - assert_matches_type(AsyncSinglePage[ActiveSessionListResponse], active_session, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.users.active_sessions.with_streaming_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - active_session = await response.parse() - assert_matches_type(AsyncSinglePage[ActiveSessionListResponse], active_session, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.users.active_sessions.with_raw_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.zero_trust.access.users.active_sessions.with_raw_response.list( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - active_session = await async_client.zero_trust.access.users.active_sessions.get( - "X1aXj1lFVcqqyoXF", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - ) - assert_matches_type(Optional[ActiveSessionGetResponse], active_session, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.users.active_sessions.with_raw_response.get( - "X1aXj1lFVcqqyoXF", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - active_session = await response.parse() - assert_matches_type(Optional[ActiveSessionGetResponse], active_session, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.users.active_sessions.with_streaming_response.get( - "X1aXj1lFVcqqyoXF", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - active_session = await response.parse() - assert_matches_type(Optional[ActiveSessionGetResponse], active_session, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.users.active_sessions.with_raw_response.get( - "X1aXj1lFVcqqyoXF", - identifier="", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.zero_trust.access.users.active_sessions.with_raw_response.get( - "X1aXj1lFVcqqyoXF", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `nonce` but received ''"): - await async_client.zero_trust.access.users.active_sessions.with_raw_response.get( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - ) diff --git a/tests/api_resources/zero_trust/access/users/test_failed_logins.py b/tests/api_resources/zero_trust/access/users/test_failed_logins.py deleted file mode 100644 index 466bb95ca07..00000000000 --- a/tests/api_resources/zero_trust/access/users/test_failed_logins.py +++ /dev/null @@ -1,119 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access.users import FailedLoginListResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestFailedLogins: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - failed_login = client.zero_trust.access.users.failed_logins.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SyncSinglePage[FailedLoginListResponse], failed_login, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.zero_trust.access.users.failed_logins.with_raw_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - failed_login = response.parse() - assert_matches_type(SyncSinglePage[FailedLoginListResponse], failed_login, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.zero_trust.access.users.failed_logins.with_streaming_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - failed_login = response.parse() - assert_matches_type(SyncSinglePage[FailedLoginListResponse], failed_login, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.users.failed_logins.with_raw_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.zero_trust.access.users.failed_logins.with_raw_response.list( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncFailedLogins: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - failed_login = await async_client.zero_trust.access.users.failed_logins.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(AsyncSinglePage[FailedLoginListResponse], failed_login, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.users.failed_logins.with_raw_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - failed_login = await response.parse() - assert_matches_type(AsyncSinglePage[FailedLoginListResponse], failed_login, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.users.failed_logins.with_streaming_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - failed_login = await response.parse() - assert_matches_type(AsyncSinglePage[FailedLoginListResponse], failed_login, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.users.failed_logins.with_raw_response.list( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.zero_trust.access.users.failed_logins.with_raw_response.list( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/zero_trust/access/users/test_last_seen_identity.py b/tests/api_resources/zero_trust/access/users/test_last_seen_identity.py deleted file mode 100644 index e23146df8d6..00000000000 --- a/tests/api_resources/zero_trust/access/users/test_last_seen_identity.py +++ /dev/null @@ -1,118 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.access.users import Identity - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestLastSeenIdentity: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - last_seen_identity = client.zero_trust.access.users.last_seen_identity.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[Identity], last_seen_identity, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zero_trust.access.users.last_seen_identity.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - last_seen_identity = response.parse() - assert_matches_type(Optional[Identity], last_seen_identity, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zero_trust.access.users.last_seen_identity.with_streaming_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - last_seen_identity = response.parse() - assert_matches_type(Optional[Identity], last_seen_identity, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.users.last_seen_identity.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.zero_trust.access.users.last_seen_identity.with_raw_response.get( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncLastSeenIdentity: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - last_seen_identity = await async_client.zero_trust.access.users.last_seen_identity.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[Identity], last_seen_identity, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.users.last_seen_identity.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - last_seen_identity = await response.parse() - assert_matches_type(Optional[Identity], last_seen_identity, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.users.last_seen_identity.with_streaming_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - last_seen_identity = await response.parse() - assert_matches_type(Optional[Identity], last_seen_identity, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.users.last_seen_identity.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.zero_trust.access.users.last_seen_identity.with_raw_response.get( - "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/zero_trust/test_identity_providers.py b/tests/api_resources/zero_trust/test_identity_providers.py index 7204c198113..b78e5843fd8 100644 --- a/tests/api_resources/zero_trust/test_identity_providers.py +++ b/tests/api_resources/zero_trust/test_identity_providers.py @@ -13,7 +13,6 @@ from cloudflare.types.zero_trust import ( IdentityProvider, IdentityProviderListResponse, - IdentityProviderDeleteResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -1232,2828 +1231,67 @@ def test_path_params_create_overload_14(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - def test_method_update_overload_1(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={ - "client_id": "", - "client_secret": "", - "claims": ["email_verified", "preferred_username", "custom_claim_name"], - "email_claim_name": "custom_claim_name", - "conditional_access_enabled": True, - "directory_id": "", - "prompt": "login", - "support_groups": True, - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update_overload_1(self, client: Cloudflare) -> None: - response = client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: - with client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update_overload_1(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_overload_2(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={ - "client_id": "", - "client_secret": "", - "claims": ["email_verified", "preferred_username", "custom_claim_name"], - "email_claim_name": "custom_claim_name", - "centrify_account": "https://abc123.my.centrify.com/", - "centrify_app_id": "exampleapp", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update_overload_2(self, client: Cloudflare) -> None: - response = client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None: - with client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update_overload_2(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_overload_3(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params_overload_3(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={ - "client_id": "", - "client_secret": "", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update_overload_3(self, client: Cloudflare) -> None: - response = client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update_overload_3(self, client: Cloudflare) -> None: - with client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update_overload_3(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_overload_4(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params_overload_4(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={ - "client_id": "", - "client_secret": "", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update_overload_4(self, client: Cloudflare) -> None: - response = client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update_overload_4(self, client: Cloudflare) -> None: - with client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update_overload_4(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_overload_5(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params_overload_5(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={ - "client_id": "", - "client_secret": "", - "claims": ["email_verified", "preferred_username", "custom_claim_name"], - "email_claim_name": "custom_claim_name", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update_overload_5(self, client: Cloudflare) -> None: - response = client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update_overload_5(self, client: Cloudflare) -> None: - with client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update_overload_5(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_overload_6(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params_overload_6(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={ - "client_id": "", - "client_secret": "", - "claims": ["email_verified", "preferred_username", "custom_claim_name"], - "email_claim_name": "custom_claim_name", - "apps_domain": "mycompany.com", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update_overload_6(self, client: Cloudflare) -> None: - response = client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update_overload_6(self, client: Cloudflare) -> None: - with client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update_overload_6(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_overload_7(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params_overload_7(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={ - "client_id": "", - "client_secret": "", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update_overload_7(self, client: Cloudflare) -> None: - response = client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update_overload_7(self, client: Cloudflare) -> None: - with client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update_overload_7(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_overload_8(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params_overload_8(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={ - "client_id": "", - "client_secret": "", - "claims": ["email_verified", "preferred_username", "custom_claim_name"], - "email_claim_name": "custom_claim_name", - "auth_url": "https://accounts.google.com/o/oauth2/auth", - "certs_url": "https://www.googleapis.com/oauth2/v3/certs", - "scopes": ["openid", "email", "profile"], - "token_url": "https://accounts.google.com/o/oauth2/token", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update_overload_8(self, client: Cloudflare) -> None: - response = client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update_overload_8(self, client: Cloudflare) -> None: - with client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update_overload_8(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_overload_9(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params_overload_9(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={ - "client_id": "", - "client_secret": "", - "claims": ["email_verified", "preferred_username", "custom_claim_name"], - "email_claim_name": "custom_claim_name", - "authorization_server_id": "aus9o8wzkhckw9TLa0h7z", - "okta_account": "https://dev-abc123.oktapreview.com", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update_overload_9(self, client: Cloudflare) -> None: - response = client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update_overload_9(self, client: Cloudflare) -> None: - with client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update_overload_9(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_overload_10(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params_overload_10(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={ - "client_id": "", - "client_secret": "", - "claims": ["email_verified", "preferred_username", "custom_claim_name"], - "email_claim_name": "custom_claim_name", - "onelogin_account": "https://mycompany.onelogin.com", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update_overload_10(self, client: Cloudflare) -> None: - response = client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update_overload_10(self, client: Cloudflare) -> None: - with client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update_overload_10(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_overload_11(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params_overload_11(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={ - "client_id": "", - "client_secret": "", - "claims": ["email_verified", "preferred_username", "custom_claim_name"], - "email_claim_name": "custom_claim_name", - "ping_env_id": "342b5660-0c32-4936-a5a4-ce21fae57b0a", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update_overload_11(self, client: Cloudflare) -> None: - response = client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update_overload_11(self, client: Cloudflare) -> None: - with client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update_overload_11(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_overload_12(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params_overload_12(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={ - "attributes": ["group", "department_code", "divison"], - "email_attribute_name": "Email", - "header_attributes": [ - { - "attribute_name": "string", - "header_name": "string", - }, - { - "attribute_name": "string", - "header_name": "string", - }, - { - "attribute_name": "string", - "header_name": "string", - }, - ], - "idp_public_certs": ["string", "string", "string"], - "issuer_url": "https://whoami.com", - "sign_request": True, - "sso_target_url": "https://edgeaccess.org/idp/saml/login", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update_overload_12(self, client: Cloudflare) -> None: - response = client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update_overload_12(self, client: Cloudflare) -> None: - with client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update_overload_12(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_overload_13(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params_overload_13(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={ - "client_id": "", - "client_secret": "", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update_overload_13(self, client: Cloudflare) -> None: - response = client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update_overload_13(self, client: Cloudflare) -> None: - with client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update_overload_13(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_overload_14(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params_overload_14(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update_overload_14(self, client: Cloudflare) -> None: - response = client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update_overload_14(self, client: Cloudflare) -> None: - with client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update_overload_14(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.list( - account_id="string", - ) - assert_matches_type(SyncSinglePage[IdentityProviderListResponse], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_list_with_all_params(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.list( - account_id="string", - ) - assert_matches_type(SyncSinglePage[IdentityProviderListResponse], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.zero_trust.identity_providers.with_raw_response.list( - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = response.parse() - assert_matches_type(SyncSinglePage[IdentityProviderListResponse], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.zero_trust.identity_providers.with_streaming_response.list( - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = response.parse() - assert_matches_type(SyncSinglePage[IdentityProviderListResponse], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.list( - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.list( - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[IdentityProviderDeleteResponse], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_delete_with_all_params(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[IdentityProviderDeleteResponse], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.zero_trust.identity_providers.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProviderDeleteResponse], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.zero_trust.identity_providers.with_streaming_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProviderDeleteResponse], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.identity_providers.with_raw_response.delete( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_get_with_all_params(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.identity_providers.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zero_trust.identity_providers.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zero_trust.identity_providers.with_streaming_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.identity_providers.with_raw_response.get( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.identity_providers.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - -class TestAsyncIdentityProviders: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={ - "client_id": "", - "client_secret": "", - "claims": ["email_verified", "preferred_username", "custom_claim_name"], - "email_claim_name": "custom_claim_name", - "conditional_access_enabled": True, - "directory_id": "", - "prompt": "login", - "support_groups": True, - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_create_overload_1(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_overload_2(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_with_all_params_overload_2(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={ - "client_id": "", - "client_secret": "", - "claims": ["email_verified", "preferred_username", "custom_claim_name"], - "email_claim_name": "custom_claim_name", - "centrify_account": "https://abc123.my.centrify.com/", - "centrify_app_id": "exampleapp", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_create_overload_2(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_overload_3(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_with_all_params_overload_3(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={ - "client_id": "", - "client_secret": "", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_create_overload_3(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_create_overload_3(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_create_overload_3(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_overload_4(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_with_all_params_overload_4(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={ - "client_id": "", - "client_secret": "", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_create_overload_4(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_create_overload_4(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_create_overload_4(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_overload_5(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_with_all_params_overload_5(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={ - "client_id": "", - "client_secret": "", - "claims": ["email_verified", "preferred_username", "custom_claim_name"], - "email_claim_name": "custom_claim_name", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_create_overload_5(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_create_overload_5(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_create_overload_5(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_overload_6(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_with_all_params_overload_6(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={ - "client_id": "", - "client_secret": "", - "claims": ["email_verified", "preferred_username", "custom_claim_name"], - "email_claim_name": "custom_claim_name", - "apps_domain": "mycompany.com", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_create_overload_6(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_create_overload_6(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_create_overload_6(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_overload_7(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_with_all_params_overload_7(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={ - "client_id": "", - "client_secret": "", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_create_overload_7(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_create_overload_7(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_create_overload_7(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_overload_8(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_with_all_params_overload_8(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={ - "client_id": "", - "client_secret": "", - "claims": ["email_verified", "preferred_username", "custom_claim_name"], - "email_claim_name": "custom_claim_name", - "auth_url": "https://accounts.google.com/o/oauth2/auth", - "certs_url": "https://www.googleapis.com/oauth2/v3/certs", - "scopes": ["openid", "email", "profile"], - "token_url": "https://accounts.google.com/o/oauth2/token", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_create_overload_8(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_create_overload_8(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_create_overload_8(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_overload_9(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_with_all_params_overload_9(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={ - "client_id": "", - "client_secret": "", - "claims": ["email_verified", "preferred_username", "custom_claim_name"], - "email_claim_name": "custom_claim_name", - "authorization_server_id": "aus9o8wzkhckw9TLa0h7z", - "okta_account": "https://dev-abc123.oktapreview.com", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_create_overload_9(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_create_overload_9(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_create_overload_9(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_overload_10(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_with_all_params_overload_10(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={ - "client_id": "", - "client_secret": "", - "claims": ["email_verified", "preferred_username", "custom_claim_name"], - "email_claim_name": "custom_claim_name", - "onelogin_account": "https://mycompany.onelogin.com", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_create_overload_10(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_create_overload_10(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_create_overload_10(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_overload_11(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_with_all_params_overload_11(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={ - "client_id": "", - "client_secret": "", - "claims": ["email_verified", "preferred_username", "custom_claim_name"], - "email_claim_name": "custom_claim_name", - "ping_env_id": "342b5660-0c32-4936-a5a4-ce21fae57b0a", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_create_overload_11(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_create_overload_11(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_create_overload_11(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_overload_12(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_with_all_params_overload_12(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={ - "attributes": ["group", "department_code", "divison"], - "email_attribute_name": "Email", - "header_attributes": [ - { - "attribute_name": "string", - "header_name": "string", - }, - { - "attribute_name": "string", - "header_name": "string", - }, - { - "attribute_name": "string", - "header_name": "string", - }, - ], - "idp_public_certs": ["string", "string", "string"], - "issuer_url": "https://whoami.com", - "sign_request": True, - "sso_target_url": "https://edgeaccess.org/idp/saml/login", - }, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_create_overload_12(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_create_overload_12(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_create_overload_12(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_overload_13(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", + def test_method_list(self, client: Cloudflare) -> None: + identity_provider = client.zero_trust.identity_providers.list( account_id="string", ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) + assert_matches_type(SyncSinglePage[IdentityProviderListResponse], identity_provider, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_create_with_all_params_overload_13(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={ - "client_id": "", - "client_secret": "", - }, - name="Widget Corps IDP", - type="onetimepin", + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + identity_provider = client.zero_trust.identity_providers.list( account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) + assert_matches_type(SyncSinglePage[IdentityProviderListResponse], identity_provider, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_create_overload_13(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.zero_trust.identity_providers.with_raw_response.list( account_id="string", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) + identity_provider = response.parse() + assert_matches_type(SyncSinglePage[IdentityProviderListResponse], identity_provider, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_create_overload_13(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.zero_trust.identity_providers.with_streaming_response.list( account_id="string", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) + identity_provider = response.parse() + assert_matches_type(SyncSinglePage[IdentityProviderListResponse], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_create_overload_13(self, async_client: AsyncCloudflare) -> None: + def test_path_params_list(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", + client.zero_trust.identity_providers.with_raw_response.list( account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", + client.zero_trust.identity_providers.with_raw_response.list( account_id="string", ) - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_overload_14(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_create_with_all_params_overload_14(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - scim_config={ - "enabled": True, - "group_member_deprovision": True, - "seat_deprovision": True, - "secret": "string", - "user_deprovision": True, - }, - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_create_overload_14(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_create_overload_14(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_create_overload_14(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="", - ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.create( - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) +class TestAsyncIdentityProviders: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4063,9 +1301,8 @@ async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={ "client_id": "", "client_secret": "", @@ -4091,9 +1328,8 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_update_overload_1(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_raw_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4107,9 +1343,8 @@ async def test_raw_response_update_overload_1(self, async_client: AsyncCloudflar @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_update_overload_1(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_streaming_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.identity_providers.with_streaming_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4125,19 +1360,9 @@ async def test_streaming_response_update_overload_1(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_update_overload_1(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - + async def test_path_params_create_overload_1(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4145,8 +1370,7 @@ async def test_path_params_update_overload_1(self, async_client: AsyncCloudflare ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4155,9 +1379,8 @@ async def test_path_params_update_overload_1(self, async_client: AsyncCloudflare @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_overload_2(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4167,9 +1390,8 @@ async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_with_all_params_overload_2(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_with_all_params_overload_2(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={ "client_id": "", "client_secret": "", @@ -4193,9 +1415,8 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_update_overload_2(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_raw_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4209,9 +1430,8 @@ async def test_raw_response_update_overload_2(self, async_client: AsyncCloudflar @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_update_overload_2(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_streaming_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.identity_providers.with_streaming_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4227,19 +1447,9 @@ async def test_streaming_response_update_overload_2(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_update_overload_2(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - + async def test_path_params_create_overload_2(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4247,8 +1457,7 @@ async def test_path_params_update_overload_2(self, async_client: AsyncCloudflare ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4257,9 +1466,8 @@ async def test_path_params_update_overload_2(self, async_client: AsyncCloudflare @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_overload_3(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_overload_3(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4269,9 +1477,8 @@ async def test_method_update_overload_3(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_with_all_params_overload_3(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_with_all_params_overload_3(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={ "client_id": "", "client_secret": "", @@ -4291,9 +1498,8 @@ async def test_method_update_with_all_params_overload_3(self, async_client: Asyn @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_update_overload_3(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_raw_response_create_overload_3(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4307,9 +1513,8 @@ async def test_raw_response_update_overload_3(self, async_client: AsyncCloudflar @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_update_overload_3(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_streaming_response_create_overload_3(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.identity_providers.with_streaming_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4325,19 +1530,9 @@ async def test_streaming_response_update_overload_3(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_update_overload_3(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - + async def test_path_params_create_overload_3(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4345,8 +1540,7 @@ async def test_path_params_update_overload_3(self, async_client: AsyncCloudflare ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4355,9 +1549,8 @@ async def test_path_params_update_overload_3(self, async_client: AsyncCloudflare @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_overload_4(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_overload_4(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4367,9 +1560,8 @@ async def test_method_update_overload_4(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_with_all_params_overload_4(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_with_all_params_overload_4(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={ "client_id": "", "client_secret": "", @@ -4389,9 +1581,8 @@ async def test_method_update_with_all_params_overload_4(self, async_client: Asyn @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_update_overload_4(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_raw_response_create_overload_4(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4405,9 +1596,8 @@ async def test_raw_response_update_overload_4(self, async_client: AsyncCloudflar @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_update_overload_4(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_streaming_response_create_overload_4(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.identity_providers.with_streaming_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4423,19 +1613,9 @@ async def test_streaming_response_update_overload_4(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_update_overload_4(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - + async def test_path_params_create_overload_4(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4443,8 +1623,7 @@ async def test_path_params_update_overload_4(self, async_client: AsyncCloudflare ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4453,9 +1632,8 @@ async def test_path_params_update_overload_4(self, async_client: AsyncCloudflare @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_overload_5(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_overload_5(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4465,9 +1643,8 @@ async def test_method_update_overload_5(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_with_all_params_overload_5(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_with_all_params_overload_5(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={ "client_id": "", "client_secret": "", @@ -4489,9 +1666,8 @@ async def test_method_update_with_all_params_overload_5(self, async_client: Asyn @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_update_overload_5(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_raw_response_create_overload_5(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4505,9 +1681,8 @@ async def test_raw_response_update_overload_5(self, async_client: AsyncCloudflar @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_update_overload_5(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_streaming_response_create_overload_5(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.identity_providers.with_streaming_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4523,19 +1698,9 @@ async def test_streaming_response_update_overload_5(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_update_overload_5(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - + async def test_path_params_create_overload_5(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4543,8 +1708,7 @@ async def test_path_params_update_overload_5(self, async_client: AsyncCloudflare ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4553,9 +1717,8 @@ async def test_path_params_update_overload_5(self, async_client: AsyncCloudflare @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_overload_6(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_overload_6(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4565,9 +1728,8 @@ async def test_method_update_overload_6(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_with_all_params_overload_6(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_with_all_params_overload_6(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={ "client_id": "", "client_secret": "", @@ -4590,9 +1752,8 @@ async def test_method_update_with_all_params_overload_6(self, async_client: Asyn @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_update_overload_6(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_raw_response_create_overload_6(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4606,9 +1767,8 @@ async def test_raw_response_update_overload_6(self, async_client: AsyncCloudflar @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_update_overload_6(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_streaming_response_create_overload_6(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.identity_providers.with_streaming_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4624,19 +1784,9 @@ async def test_streaming_response_update_overload_6(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_update_overload_6(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - + async def test_path_params_create_overload_6(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4644,8 +1794,7 @@ async def test_path_params_update_overload_6(self, async_client: AsyncCloudflare ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4654,9 +1803,8 @@ async def test_path_params_update_overload_6(self, async_client: AsyncCloudflare @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_overload_7(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_overload_7(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4666,9 +1814,8 @@ async def test_method_update_overload_7(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_with_all_params_overload_7(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_with_all_params_overload_7(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={ "client_id": "", "client_secret": "", @@ -4688,9 +1835,8 @@ async def test_method_update_with_all_params_overload_7(self, async_client: Asyn @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_update_overload_7(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_raw_response_create_overload_7(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4704,9 +1850,8 @@ async def test_raw_response_update_overload_7(self, async_client: AsyncCloudflar @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_update_overload_7(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_streaming_response_create_overload_7(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.identity_providers.with_streaming_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4722,19 +1867,9 @@ async def test_streaming_response_update_overload_7(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_update_overload_7(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - + async def test_path_params_create_overload_7(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4742,8 +1877,7 @@ async def test_path_params_update_overload_7(self, async_client: AsyncCloudflare ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4752,9 +1886,8 @@ async def test_path_params_update_overload_7(self, async_client: AsyncCloudflare @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_overload_8(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_overload_8(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4764,9 +1897,8 @@ async def test_method_update_overload_8(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_with_all_params_overload_8(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_with_all_params_overload_8(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={ "client_id": "", "client_secret": "", @@ -4792,9 +1924,8 @@ async def test_method_update_with_all_params_overload_8(self, async_client: Asyn @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_update_overload_8(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_raw_response_create_overload_8(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4808,9 +1939,8 @@ async def test_raw_response_update_overload_8(self, async_client: AsyncCloudflar @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_update_overload_8(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_streaming_response_create_overload_8(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.identity_providers.with_streaming_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4826,19 +1956,9 @@ async def test_streaming_response_update_overload_8(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_update_overload_8(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - + async def test_path_params_create_overload_8(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4846,8 +1966,7 @@ async def test_path_params_update_overload_8(self, async_client: AsyncCloudflare ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4856,9 +1975,8 @@ async def test_path_params_update_overload_8(self, async_client: AsyncCloudflare @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_overload_9(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_overload_9(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4868,9 +1986,8 @@ async def test_method_update_overload_9(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_with_all_params_overload_9(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_with_all_params_overload_9(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={ "client_id": "", "client_secret": "", @@ -4894,9 +2011,8 @@ async def test_method_update_with_all_params_overload_9(self, async_client: Asyn @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_update_overload_9(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_raw_response_create_overload_9(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4910,9 +2026,8 @@ async def test_raw_response_update_overload_9(self, async_client: AsyncCloudflar @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_update_overload_9(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_streaming_response_create_overload_9(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.identity_providers.with_streaming_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4928,19 +2043,9 @@ async def test_streaming_response_update_overload_9(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_update_overload_9(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - + async def test_path_params_create_overload_9(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4948,8 +2053,7 @@ async def test_path_params_update_overload_9(self, async_client: AsyncCloudflare ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4958,9 +2062,8 @@ async def test_path_params_update_overload_9(self, async_client: AsyncCloudflare @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_overload_10(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_overload_10(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -4970,9 +2073,8 @@ async def test_method_update_overload_10(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_with_all_params_overload_10(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_with_all_params_overload_10(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={ "client_id": "", "client_secret": "", @@ -4995,9 +2097,8 @@ async def test_method_update_with_all_params_overload_10(self, async_client: Asy @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_update_overload_10(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_raw_response_create_overload_10(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5011,9 +2112,8 @@ async def test_raw_response_update_overload_10(self, async_client: AsyncCloudfla @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_update_overload_10(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_streaming_response_create_overload_10(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.identity_providers.with_streaming_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5029,19 +2129,9 @@ async def test_streaming_response_update_overload_10(self, async_client: AsyncCl @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_update_overload_10(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - + async def test_path_params_create_overload_10(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5049,8 +2139,7 @@ async def test_path_params_update_overload_10(self, async_client: AsyncCloudflar ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5059,9 +2148,8 @@ async def test_path_params_update_overload_10(self, async_client: AsyncCloudflar @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_overload_11(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_overload_11(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5071,9 +2159,8 @@ async def test_method_update_overload_11(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_with_all_params_overload_11(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_with_all_params_overload_11(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={ "client_id": "", "client_secret": "", @@ -5096,9 +2183,8 @@ async def test_method_update_with_all_params_overload_11(self, async_client: Asy @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_update_overload_11(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_raw_response_create_overload_11(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5112,9 +2198,8 @@ async def test_raw_response_update_overload_11(self, async_client: AsyncCloudfla @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_update_overload_11(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_streaming_response_create_overload_11(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.identity_providers.with_streaming_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5130,19 +2215,9 @@ async def test_streaming_response_update_overload_11(self, async_client: AsyncCl @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_update_overload_11(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - + async def test_path_params_create_overload_11(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5150,8 +2225,7 @@ async def test_path_params_update_overload_11(self, async_client: AsyncCloudflar ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5160,9 +2234,8 @@ async def test_path_params_update_overload_11(self, async_client: AsyncCloudflar @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_overload_12(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_overload_12(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5172,9 +2245,8 @@ async def test_method_update_overload_12(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_with_all_params_overload_12(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_with_all_params_overload_12(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={ "attributes": ["group", "department_code", "divison"], "email_attribute_name": "Email", @@ -5212,9 +2284,8 @@ async def test_method_update_with_all_params_overload_12(self, async_client: Asy @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_update_overload_12(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_raw_response_create_overload_12(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5228,9 +2299,8 @@ async def test_raw_response_update_overload_12(self, async_client: AsyncCloudfla @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_update_overload_12(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_streaming_response_create_overload_12(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.identity_providers.with_streaming_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5246,19 +2316,9 @@ async def test_streaming_response_update_overload_12(self, async_client: AsyncCl @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_update_overload_12(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - + async def test_path_params_create_overload_12(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5266,8 +2326,7 @@ async def test_path_params_update_overload_12(self, async_client: AsyncCloudflar ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5276,9 +2335,8 @@ async def test_path_params_update_overload_12(self, async_client: AsyncCloudflar @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_overload_13(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_overload_13(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5288,9 +2346,8 @@ async def test_method_update_overload_13(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_with_all_params_overload_13(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_with_all_params_overload_13(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={ "client_id": "", "client_secret": "", @@ -5310,9 +2367,8 @@ async def test_method_update_with_all_params_overload_13(self, async_client: Asy @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_update_overload_13(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_raw_response_create_overload_13(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5326,9 +2382,8 @@ async def test_raw_response_update_overload_13(self, async_client: AsyncCloudfla @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_update_overload_13(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_streaming_response_create_overload_13(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.identity_providers.with_streaming_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5344,19 +2399,9 @@ async def test_streaming_response_update_overload_13(self, async_client: AsyncCl @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_update_overload_13(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - + async def test_path_params_create_overload_13(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5364,8 +2409,7 @@ async def test_path_params_update_overload_13(self, async_client: AsyncCloudflar ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5374,9 +2418,8 @@ async def test_path_params_update_overload_13(self, async_client: AsyncCloudflar @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_overload_14(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_overload_14(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5386,9 +2429,8 @@ async def test_method_update_overload_14(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_with_all_params_overload_14(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_method_create_with_all_params_overload_14(self, async_client: AsyncCloudflare) -> None: + identity_provider = await async_client.zero_trust.identity_providers.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5405,9 +2447,8 @@ async def test_method_update_with_all_params_overload_14(self, async_client: Asy @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_update_overload_14(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_raw_response_create_overload_14(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5421,9 +2462,8 @@ async def test_raw_response_update_overload_14(self, async_client: AsyncCloudfla @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_update_overload_14(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + async def test_streaming_response_create_overload_14(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.identity_providers.with_streaming_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5439,19 +2479,9 @@ async def test_streaming_response_update_overload_14(self, async_client: AsyncCl @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_update_overload_14(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "", - config={}, - name="Widget Corps IDP", - type="onetimepin", - account_id="string", - ) - + async def test_path_params_create_overload_14(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5459,8 +2489,7 @@ async def test_path_params_update_overload_14(self, async_client: AsyncCloudflar ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.update( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -5521,137 +2550,3 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.identity_providers.with_raw_response.list( account_id="string", ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[IdentityProviderDeleteResponse], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[IdentityProviderDeleteResponse], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProviderDeleteResponse], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProviderDeleteResponse], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.delete( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.delete( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.identity_providers.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.identity_providers.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.identity_providers.with_streaming_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.get( - "", - account_id="string", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.identity_providers.with_raw_response.get( - "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="string", - ) diff --git a/tests/api_resources/zero_trust/test_seats.py b/tests/api_resources/zero_trust/test_seats.py deleted file mode 100644 index c609d0ab5a2..00000000000 --- a/tests/api_resources/zero_trust/test_seats.py +++ /dev/null @@ -1,218 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zero_trust import SeatEditResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSeats: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - seat = client.zero_trust.seats.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "access_seat": False, - "gateway_seat": False, - }, - { - "access_seat": False, - "gateway_seat": False, - }, - { - "access_seat": False, - "gateway_seat": False, - }, - ], - ) - assert_matches_type(Optional[SeatEditResponse], seat, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zero_trust.seats.with_raw_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "access_seat": False, - "gateway_seat": False, - }, - { - "access_seat": False, - "gateway_seat": False, - }, - { - "access_seat": False, - "gateway_seat": False, - }, - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - seat = response.parse() - assert_matches_type(Optional[SeatEditResponse], seat, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zero_trust.seats.with_streaming_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "access_seat": False, - "gateway_seat": False, - }, - { - "access_seat": False, - "gateway_seat": False, - }, - { - "access_seat": False, - "gateway_seat": False, - }, - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - seat = response.parse() - assert_matches_type(Optional[SeatEditResponse], seat, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.seats.with_raw_response.edit( - "", - body=[ - { - "access_seat": False, - "gateway_seat": False, - }, - { - "access_seat": False, - "gateway_seat": False, - }, - { - "access_seat": False, - "gateway_seat": False, - }, - ], - ) - - -class TestAsyncSeats: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - seat = await async_client.zero_trust.seats.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "access_seat": False, - "gateway_seat": False, - }, - { - "access_seat": False, - "gateway_seat": False, - }, - { - "access_seat": False, - "gateway_seat": False, - }, - ], - ) - assert_matches_type(Optional[SeatEditResponse], seat, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.seats.with_raw_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "access_seat": False, - "gateway_seat": False, - }, - { - "access_seat": False, - "gateway_seat": False, - }, - { - "access_seat": False, - "gateway_seat": False, - }, - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - seat = await response.parse() - assert_matches_type(Optional[SeatEditResponse], seat, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.seats.with_streaming_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "access_seat": False, - "gateway_seat": False, - }, - { - "access_seat": False, - "gateway_seat": False, - }, - { - "access_seat": False, - "gateway_seat": False, - }, - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - seat = await response.parse() - assert_matches_type(Optional[SeatEditResponse], seat, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.seats.with_raw_response.edit( - "", - body=[ - { - "access_seat": False, - "gateway_seat": False, - }, - { - "access_seat": False, - "gateway_seat": False, - }, - { - "access_seat": False, - "gateway_seat": False, - }, - ], - )