From 5745d99e6178305eb9e32825bb1a4658a702e33a Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 31 May 2024 01:28:21 +0000
Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#727)
---
.stats.yml | 4 +-
api.md | 153 +-
src/cloudflare/resources/rulesets/rules.py | 492 +++
.../resources/zero_trust/__init__.py | 14 +
.../resources/zero_trust/access/__init__.py | 84 +
.../resources/zero_trust/access/access.py | 194 +
.../access/applications/__init__.py | 14 +
.../access/applications/applications.py | 32 +
.../zero_trust/access/applications/cas.py | 404 ++
.../access/applications/policies.py | 1007 +++++
.../resources/zero_trust/access/bookmarks.py | 548 +++
.../access/certificates/certificates.py | 407 +-
.../zero_trust/access/custom_pages.py | 636 +++
.../resources/zero_trust/access/groups.py | 437 ++-
.../resources/zero_trust/access/keys.py | 387 ++
.../zero_trust/access/logs/__init__.py | 33 +
.../zero_trust/access/logs/access_requests.py | 158 +
.../resources/zero_trust/access/logs/logs.py | 80 +
.../zero_trust/access/service_tokens.py | 611 ++-
.../resources/zero_trust/access/tags.py | 566 +++
.../zero_trust/access/users/__init__.py | 61 +
.../access/users/active_sessions.py | 271 ++
.../zero_trust/access/users/failed_logins.py | 161 +
.../access/users/last_seen_identity.py | 168 +
.../zero_trust/access/users/users.py | 247 ++
.../zero_trust/identity_providers.py | 2153 +++++++++-
src/cloudflare/resources/zero_trust/seats.py | 169 +
.../resources/zero_trust/zero_trust.py | 32 +
.../types/rulesets/phase_get_response.py | 74 +
.../types/rulesets/phase_update_params.py | 56 +
.../types/rulesets/phase_update_response.py | 74 +
.../rulesets/phases/version_get_response.py | 74 +
.../types/rulesets/rule_create_params.py | 68 +
.../types/rulesets/rule_create_response.py | 74 +
.../types/rulesets/rule_delete_response.py | 74 +
.../types/rulesets/rule_edit_params.py | 74 +
.../types/rulesets/rule_edit_response.py | 74 +
.../types/rulesets/ruleset_create_params.py | 56 +
.../types/rulesets/ruleset_create_response.py | 74 +
.../types/rulesets/ruleset_get_response.py | 74 +
.../types/rulesets/ruleset_update_params.py | 56 +
.../types/rulesets/ruleset_update_response.py | 74 +
.../types/rulesets/version_get_response.py | 74 +
.../rulesets/versions/by_tag_get_response.py | 74 +
src/cloudflare/types/zero_trust/__init__.py | 5 +
.../types/zero_trust/access/__init__.py | 24 +
.../types/zero_trust/access/access_user.py | 41 +
.../access/application_create_params.py | 42 +
.../access/application_create_response.py | 14 +-
.../access/application_get_response.py | 14 +-
.../access/application_list_response.py | 14 +-
.../access/application_update_params.py | 42 +
.../access/application_update_response.py | 14 +-
.../access/applications/__init__.py | 10 +
.../access/applications/ca_create_response.py | 7 +
.../access/applications/ca_delete_response.py | 12 +
.../access/applications/ca_get_response.py | 7 +
.../applications/policy_create_params.py | 79 +
.../applications/policy_create_response.py | 73 +
.../applications/policy_delete_response.py | 12 +
.../applications/policy_get_response.py | 73 +
.../applications/policy_list_response.py | 73 +
.../applications/policy_update_params.py | 82 +
.../applications/policy_update_response.py | 73 +
.../types/zero_trust/access/bookmark.py | 29 +
.../access/bookmark_create_params.py | 13 +
.../access/bookmark_delete_response.py | 12 +
.../access/bookmark_update_params.py | 13 +
.../access/certificate_delete_response.py | 12 +
.../access/certificate_update_params.py | 24 +
.../types/zero_trust/access/custom_page.py | 30 +
.../access/custom_page_create_params.py | 24 +
.../access/custom_page_delete_response.py | 12 +
.../access/custom_page_update_params.py | 24 +
.../access/custom_page_without_html.py | 27 +
.../access/group_delete_response.py | 12 +
.../zero_trust/access/group_update_params.py | 42 +
.../zero_trust/access/key_get_response.py | 7 +
.../zero_trust/access/key_rotate_response.py | 7 +
.../zero_trust/access/key_update_params.py | 15 +
.../zero_trust/access/key_update_response.py | 7 +
.../types/zero_trust/access/logs/__init__.py | 3 +
.../logs/access_request_list_response.py | 9 +
.../access/service_token_rotate_response.py | 40 +
.../access/service_token_update_params.py | 25 +
src/cloudflare/types/zero_trust/access/tag.py | 20 +
.../zero_trust/access/tag_create_params.py | 15 +
.../zero_trust/access/tag_delete_response.py | 12 +
.../zero_trust/access/tag_update_params.py | 15 +
.../types/zero_trust/access/users/__init__.py | 5 +
.../users/active_session_get_response.py | 98 +
.../users/active_session_list_response.py | 37 +
.../users/failed_login_list_response.py | 13 +
.../types/zero_trust/access/users/identity.py | 96 +
.../identity_provider_delete_response.py | 12 +
.../identity_provider_update_params.py | 697 ++++
src/cloudflare/types/zero_trust/seat.py | 23 +
.../types/zero_trust/seat_edit_params.py | 23 +
.../types/zero_trust/seat_edit_response.py | 9 +
tests/api_resources/rulesets/test_rules.py | 688 +++-
.../access/applications/test_cas.py | 406 +-
.../access/applications/test_policies.py | 1105 ++++++
.../zero_trust/access/logs/__init__.py | 1 +
.../access/logs/test_access_requests.py | 98 +
.../zero_trust/access/test_applications.py | 420 +-
.../zero_trust/access/test_bookmarks.py | 506 +++
.../zero_trust/access/test_certificates.py | 423 +-
.../zero_trust/access/test_custom_pages.py | 567 +++
.../zero_trust/access/test_groups.py | 513 ++-
.../zero_trust/access/test_keys.py | 258 ++
.../zero_trust/access/test_service_tokens.py | 604 ++-
.../zero_trust/access/test_tags.py | 481 +++
.../zero_trust/access/test_users.py | 99 +
.../zero_trust/access/users/__init__.py | 1 +
.../access/users/test_active_sessions.py | 239 ++
.../access/users/test_failed_logins.py | 119 +
.../access/users/test_last_seen_identity.py | 118 +
.../zero_trust/test_identity_providers.py | 3447 ++++++++++++++++-
tests/api_resources/zero_trust/test_seats.py | 218 ++
119 files changed, 22719 insertions(+), 412 deletions(-)
create mode 100644 src/cloudflare/resources/zero_trust/access/applications/policies.py
create mode 100644 src/cloudflare/resources/zero_trust/access/bookmarks.py
create mode 100644 src/cloudflare/resources/zero_trust/access/custom_pages.py
create mode 100644 src/cloudflare/resources/zero_trust/access/keys.py
create mode 100644 src/cloudflare/resources/zero_trust/access/logs/__init__.py
create mode 100644 src/cloudflare/resources/zero_trust/access/logs/access_requests.py
create mode 100644 src/cloudflare/resources/zero_trust/access/logs/logs.py
create mode 100644 src/cloudflare/resources/zero_trust/access/tags.py
create mode 100644 src/cloudflare/resources/zero_trust/access/users/__init__.py
create mode 100644 src/cloudflare/resources/zero_trust/access/users/active_sessions.py
create mode 100644 src/cloudflare/resources/zero_trust/access/users/failed_logins.py
create mode 100644 src/cloudflare/resources/zero_trust/access/users/last_seen_identity.py
create mode 100644 src/cloudflare/resources/zero_trust/access/users/users.py
create mode 100644 src/cloudflare/resources/zero_trust/seats.py
create mode 100644 src/cloudflare/types/zero_trust/access/access_user.py
create mode 100644 src/cloudflare/types/zero_trust/access/applications/ca_create_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/applications/ca_delete_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/applications/ca_get_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/applications/policy_create_params.py
create mode 100644 src/cloudflare/types/zero_trust/access/applications/policy_create_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/applications/policy_delete_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/applications/policy_get_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/applications/policy_list_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/applications/policy_update_params.py
create mode 100644 src/cloudflare/types/zero_trust/access/applications/policy_update_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/bookmark.py
create mode 100644 src/cloudflare/types/zero_trust/access/bookmark_create_params.py
create mode 100644 src/cloudflare/types/zero_trust/access/bookmark_delete_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/bookmark_update_params.py
create mode 100644 src/cloudflare/types/zero_trust/access/certificate_delete_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/certificate_update_params.py
create mode 100644 src/cloudflare/types/zero_trust/access/custom_page.py
create mode 100644 src/cloudflare/types/zero_trust/access/custom_page_create_params.py
create mode 100644 src/cloudflare/types/zero_trust/access/custom_page_delete_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/custom_page_update_params.py
create mode 100644 src/cloudflare/types/zero_trust/access/custom_page_without_html.py
create mode 100644 src/cloudflare/types/zero_trust/access/group_delete_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/group_update_params.py
create mode 100644 src/cloudflare/types/zero_trust/access/key_get_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/key_rotate_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/key_update_params.py
create mode 100644 src/cloudflare/types/zero_trust/access/key_update_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/logs/access_request_list_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/service_token_rotate_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/service_token_update_params.py
create mode 100644 src/cloudflare/types/zero_trust/access/tag.py
create mode 100644 src/cloudflare/types/zero_trust/access/tag_create_params.py
create mode 100644 src/cloudflare/types/zero_trust/access/tag_delete_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/tag_update_params.py
create mode 100644 src/cloudflare/types/zero_trust/access/users/active_session_get_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/users/active_session_list_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/users/failed_login_list_response.py
create mode 100644 src/cloudflare/types/zero_trust/access/users/identity.py
create mode 100644 src/cloudflare/types/zero_trust/identity_provider_delete_response.py
create mode 100644 src/cloudflare/types/zero_trust/identity_provider_update_params.py
create mode 100644 src/cloudflare/types/zero_trust/seat.py
create mode 100644 src/cloudflare/types/zero_trust/seat_edit_params.py
create mode 100644 src/cloudflare/types/zero_trust/seat_edit_response.py
create mode 100644 tests/api_resources/zero_trust/access/applications/test_policies.py
create mode 100644 tests/api_resources/zero_trust/access/logs/__init__.py
create mode 100644 tests/api_resources/zero_trust/access/logs/test_access_requests.py
create mode 100644 tests/api_resources/zero_trust/access/test_bookmarks.py
create mode 100644 tests/api_resources/zero_trust/access/test_custom_pages.py
create mode 100644 tests/api_resources/zero_trust/access/test_keys.py
create mode 100644 tests/api_resources/zero_trust/access/test_tags.py
create mode 100644 tests/api_resources/zero_trust/access/test_users.py
create mode 100644 tests/api_resources/zero_trust/access/users/__init__.py
create mode 100644 tests/api_resources/zero_trust/access/users/test_active_sessions.py
create mode 100644 tests/api_resources/zero_trust/access/users/test_failed_logins.py
create mode 100644 tests/api_resources/zero_trust/access/users/test_last_seen_identity.py
create mode 100644 tests/api_resources/zero_trust/test_seats.py
diff --git a/.stats.yml b/.stats.yml
index 30e67c9adb7..a157cc5cf6b 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 1274
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-14c9c9adbd65eee546c4f54d95b7627f10b02185348e334a68cbebbe3442733e.yml
+configured_endpoints: 1321
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-faaa81dda06d091c58d19e3aba3fc1609f647c8af561f2aa645b484412805084.yml
diff --git a/api.md b/api.md
index 0a50bcdb16f..bcf2f8086e2 100644
--- a/api.md
+++ b/api.md
@@ -5178,13 +5178,17 @@ 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(identity_provider_id, \*, account_id, zone_id, \*\*params) -> Optional
- client.zero_trust.identity_providers.list(\*, account_id, zone_id) -> SyncSinglePage[IdentityProviderListResponse]
+- client.zero_trust.identity_providers.delete(identity_provider_id, \*, account_id, zone_id) -> Optional
+- client.zero_trust.identity_providers.get(identity_provider_id, \*, account_id, zone_id) -> Optional
## Organizations
@@ -5206,9 +5210,13 @@ Methods:
Types:
```python
-from cloudflare.types.zero_trust import Seat
+from cloudflare.types.zero_trust import Seat, SeatEditResponse
```
+Methods:
+
+- client.zero_trust.seats.edit(\*, account_id, \*\*params) -> Optional
+
## Access
Types:
@@ -5281,12 +5289,20 @@ Methods:
Types:
```python
-from cloudflare.types.zero_trust.access.applications import CA
+from cloudflare.types.zero_trust.access.applications import (
+ CA,
+ CACreateResponse,
+ CADeleteResponse,
+ CAGetResponse,
+)
```
Methods:
+- client.zero_trust.access.applications.cas.create(app_id, \*, 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(app_id, \*, account_id, zone_id) -> Optional
+- client.zero_trust.access.applications.cas.get(app_id, \*, account_id, zone_id) -> Optional
#### UserPolicyChecks
@@ -5308,21 +5324,44 @@ Methods:
Types:
```python
-from cloudflare.types.zero_trust.access.applications import ApprovalGroup, Policy
+from cloudflare.types.zero_trust.access.applications import (
+ ApprovalGroup,
+ Policy,
+ PolicyCreateResponse,
+ PolicyUpdateResponse,
+ PolicyListResponse,
+ PolicyDeleteResponse,
+ PolicyGetResponse,
+)
```
+Methods:
+
+- client.zero_trust.access.applications.policies.create(app_id, \*, account_id, zone_id, \*\*params) -> Optional
+- client.zero_trust.access.applications.policies.update(policy_id, \*, app_id, account_id, zone_id, \*\*params) -> Optional
+- client.zero_trust.access.applications.policies.list(app_id, \*, account_id, zone_id) -> SyncSinglePage[PolicyListResponse]
+- client.zero_trust.access.applications.policies.delete(policy_id, \*, app_id, account_id, zone_id) -> Optional
+- client.zero_trust.access.applications.policies.get(policy_id, \*, app_id, account_id, zone_id) -> Optional
+
### Certificates
Types:
```python
-from cloudflare.types.zero_trust.access import AssociatedHostnames, Certificate
+from cloudflare.types.zero_trust.access import (
+ AssociatedHostnames,
+ Certificate,
+ CertificateDeleteResponse,
+)
```
Methods:
- client.zero_trust.access.certificates.create(\*, account_id, zone_id, \*\*params) -> Optional
+- client.zero_trust.access.certificates.update(certificate_id, \*, account_id, zone_id, \*\*params) -> Optional
- client.zero_trust.access.certificates.list(\*, account_id, zone_id) -> SyncSinglePage[Certificate]
+- client.zero_trust.access.certificates.delete(certificate_id, \*, account_id, zone_id) -> Optional
+- client.zero_trust.access.certificates.get(certificate_id, \*, account_id, zone_id) -> Optional
#### Settings
@@ -5346,35 +5385,69 @@ Methods:
Types:
```python
-from cloudflare.types.zero_trust.access import ZeroTrustGroup
+from cloudflare.types.zero_trust.access import ZeroTrustGroup, GroupDeleteResponse
```
Methods:
- client.zero_trust.access.groups.create(\*, account_id, zone_id, \*\*params) -> Optional
+- client.zero_trust.access.groups.update(group_id, \*, account_id, zone_id, \*\*params) -> Optional
- client.zero_trust.access.groups.list(\*, account_id, zone_id) -> SyncSinglePage[ZeroTrustGroup]
+- client.zero_trust.access.groups.delete(group_id, \*, account_id, zone_id) -> Optional
+- client.zero_trust.access.groups.get(group_id, \*, account_id, zone_id) -> Optional
### ServiceTokens
Types:
```python
-from cloudflare.types.zero_trust.access import ServiceToken, ServiceTokenCreateResponse
+from cloudflare.types.zero_trust.access import (
+ ServiceToken,
+ ServiceTokenCreateResponse,
+ ServiceTokenRotateResponse,
+)
```
Methods:
- client.zero_trust.access.service_tokens.create(\*, account_id, zone_id, \*\*params) -> Optional
+- client.zero_trust.access.service_tokens.update(service_token_id, \*, 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(service_token_id, \*, account_id, zone_id) -> Optional
+- client.zero_trust.access.service_tokens.get(service_token_id, \*, account_id, zone_id) -> Optional
+- client.zero_trust.access.service_tokens.refresh(service_token_id, \*, account_id) -> Optional
+- client.zero_trust.access.service_tokens.rotate(service_token_id, \*, account_id) -> Optional
### Bookmarks
Types:
```python
-from cloudflare.types.zero_trust.access import Bookmark
+from cloudflare.types.zero_trust.access import Bookmark, BookmarkDeleteResponse
```
+Methods:
+
+- client.zero_trust.access.bookmarks.create(bookmark_id, \*, account_id, \*\*params) -> Optional
+- client.zero_trust.access.bookmarks.update(bookmark_id, \*, account_id, \*\*params) -> Optional
+- client.zero_trust.access.bookmarks.list(\*, account_id) -> SyncSinglePage[Bookmark]
+- client.zero_trust.access.bookmarks.delete(bookmark_id, \*, account_id) -> Optional
+- client.zero_trust.access.bookmarks.get(bookmark_id, \*, account_id) -> Optional
+
+### Keys
+
+Types:
+
+```python
+from cloudflare.types.zero_trust.access import KeyUpdateResponse, KeyGetResponse, KeyRotateResponse
+```
+
+Methods:
+
+- client.zero_trust.access.keys.update(\*, account_id, \*\*params) -> Optional
+- client.zero_trust.access.keys.get(\*, account_id) -> Optional
+- client.zero_trust.access.keys.rotate(\*, account_id) -> Optional
+
### Logs
#### AccessRequests
@@ -5382,9 +5455,13 @@ from cloudflare.types.zero_trust.access import Bookmark
Types:
```python
-from cloudflare.types.zero_trust.access.logs import AccessRequests
+from cloudflare.types.zero_trust.access.logs import AccessRequests, AccessRequestListResponse
```
+Methods:
+
+- client.zero_trust.access.logs.access_requests.list(\*, account_id) -> Optional
+
### Users
Types:
@@ -5393,6 +5470,26 @@ Types:
from cloudflare.types.zero_trust.access import AccessUser
```
+Methods:
+
+- client.zero_trust.access.users.list(\*, account_id) -> SyncSinglePage[AccessUser]
+
+#### ActiveSessions
+
+Types:
+
+```python
+from cloudflare.types.zero_trust.access.users import (
+ ActiveSessionListResponse,
+ ActiveSessionGetResponse,
+)
+```
+
+Methods:
+
+- client.zero_trust.access.users.active_sessions.list(user_id, \*, account_id) -> SyncSinglePage[ActiveSessionListResponse]
+- client.zero_trust.access.users.active_sessions.get(nonce, \*, account_id, user_id) -> Optional
+
#### LastSeenIdentity
Types:
@@ -5401,22 +5498,58 @@ Types:
from cloudflare.types.zero_trust.access.users import Identity
```
+Methods:
+
+- client.zero_trust.access.users.last_seen_identity.get(user_id, \*, account_id) -> Optional
+
+#### FailedLogins
+
+Types:
+
+```python
+from cloudflare.types.zero_trust.access.users import FailedLoginListResponse
+```
+
+Methods:
+
+- client.zero_trust.access.users.failed_logins.list(user_id, \*, account_id) -> SyncSinglePage[FailedLoginListResponse]
+
### CustomPages
Types:
```python
-from cloudflare.types.zero_trust.access import CustomPage, CustomPageWithoutHTML
+from cloudflare.types.zero_trust.access import (
+ CustomPage,
+ CustomPageWithoutHTML,
+ CustomPageDeleteResponse,
+)
```
+Methods:
+
+- client.zero_trust.access.custom_pages.create(\*, account_id, \*\*params) -> Optional
+- client.zero_trust.access.custom_pages.update(custom_page_id, \*, account_id, \*\*params) -> Optional
+- client.zero_trust.access.custom_pages.list(\*, account_id) -> SyncSinglePage[CustomPageWithoutHTML]
+- client.zero_trust.access.custom_pages.delete(custom_page_id, \*, account_id) -> Optional
+- client.zero_trust.access.custom_pages.get(custom_page_id, \*, account_id) -> Optional
+
### Tags
Types:
```python
-from cloudflare.types.zero_trust.access import Tag
+from cloudflare.types.zero_trust.access import Tag, TagDeleteResponse
```
+Methods:
+
+- client.zero_trust.access.tags.create(\*, account_id, \*\*params) -> Optional
+- client.zero_trust.access.tags.update(tag_name, \*, account_id, \*\*params) -> Optional
+- client.zero_trust.access.tags.list(\*, account_id) -> SyncSinglePage[Tag]
+- client.zero_trust.access.tags.delete(tag_name, \*, account_id) -> Optional
+- client.zero_trust.access.tags.get(tag_name, \*, account_id) -> Optional
+
## DEX
Types:
diff --git a/src/cloudflare/resources/rulesets/rules.py b/src/cloudflare/resources/rulesets/rules.py
index bd7c415a47b..ecf569b9efa 100644
--- a/src/cloudflare/resources/rulesets/rules.py
+++ b/src/cloudflare/resources/rulesets/rules.py
@@ -1003,6 +1003,126 @@ 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,
@@ -1026,6 +1146,8 @@ 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
@@ -2130,6 +2252,128 @@ 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,
@@ -2155,6 +2399,8 @@ 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
@@ -3193,6 +3439,126 @@ 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,
@@ -3216,6 +3582,8 @@ 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
@@ -4320,6 +4688,128 @@ 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,
@@ -4345,6 +4835,8 @@ 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 0eac27aeedb..7703df18c9b 100644
--- a/src/cloudflare/resources/zero_trust/__init__.py
+++ b/src/cloudflare/resources/zero_trust/__init__.py
@@ -16,6 +16,14 @@
DLPResourceWithStreamingResponse,
AsyncDLPResourceWithStreamingResponse,
)
+from .seats import (
+ SeatsResource,
+ AsyncSeatsResource,
+ SeatsResourceWithRawResponse,
+ AsyncSeatsResourceWithRawResponse,
+ SeatsResourceWithStreamingResponse,
+ AsyncSeatsResourceWithStreamingResponse,
+)
from .access import (
AccessResource,
AsyncAccessResource,
@@ -116,6 +124,12 @@
"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 7f6771c4683..b34af407a86 100644
--- a/src/cloudflare/resources/zero_trust/access/__init__.py
+++ b/src/cloudflare/resources/zero_trust/access/__init__.py
@@ -1,5 +1,37 @@
# 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,
@@ -16,6 +48,14 @@
GroupsResourceWithStreamingResponse,
AsyncGroupsResourceWithStreamingResponse,
)
+from .bookmarks import (
+ BookmarksResource,
+ AsyncBookmarksResource,
+ BookmarksResourceWithRawResponse,
+ AsyncBookmarksResourceWithRawResponse,
+ BookmarksResourceWithStreamingResponse,
+ AsyncBookmarksResourceWithStreamingResponse,
+)
from .applications import (
ApplicationsResource,
AsyncApplicationsResource,
@@ -32,6 +72,14 @@
CertificatesResourceWithStreamingResponse,
AsyncCertificatesResourceWithStreamingResponse,
)
+from .custom_pages import (
+ CustomPagesResource,
+ AsyncCustomPagesResource,
+ CustomPagesResourceWithRawResponse,
+ AsyncCustomPagesResourceWithRawResponse,
+ CustomPagesResourceWithStreamingResponse,
+ AsyncCustomPagesResourceWithStreamingResponse,
+)
from .service_tokens import (
ServiceTokensResource,
AsyncServiceTokensResource,
@@ -66,6 +114,42 @@
"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 f9f03534570..6707c0f7745 100644
--- a/src/cloudflare/resources/zero_trust/access/access.py
+++ b/src/cloudflare/resources/zero_trust/access/access.py
@@ -2,6 +2,38 @@
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,
@@ -10,7 +42,17 @@
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,
@@ -28,6 +70,14 @@
CertificatesResourceWithStreamingResponse,
AsyncCertificatesResourceWithStreamingResponse,
)
+from .custom_pages import (
+ CustomPagesResource,
+ AsyncCustomPagesResource,
+ CustomPagesResourceWithRawResponse,
+ AsyncCustomPagesResourceWithRawResponse,
+ CustomPagesResourceWithStreamingResponse,
+ AsyncCustomPagesResourceWithStreamingResponse,
+)
from .service_tokens import (
ServiceTokensResource,
AsyncServiceTokensResource,
@@ -59,6 +109,30 @@ 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)
@@ -85,6 +159,30 @@ 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)
@@ -114,6 +212,30 @@ 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:
@@ -135,6 +257,30 @@ 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:
@@ -156,6 +302,30 @@ 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:
@@ -176,3 +346,27 @@ 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 f4d00c67e8c..8b6f39c4dd8 100644
--- a/src/cloudflare/resources/zero_trust/access/applications/__init__.py
+++ b/src/cloudflare/resources/zero_trust/access/applications/__init__.py
@@ -8,6 +8,14 @@
CAsResourceWithStreamingResponse,
AsyncCAsResourceWithStreamingResponse,
)
+from .policies import (
+ PoliciesResource,
+ AsyncPoliciesResource,
+ PoliciesResourceWithRawResponse,
+ AsyncPoliciesResourceWithRawResponse,
+ PoliciesResourceWithStreamingResponse,
+ AsyncPoliciesResourceWithStreamingResponse,
+)
from .applications import (
ApplicationsResource,
AsyncApplicationsResource,
@@ -38,6 +46,12 @@
"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 7cb75fe8ecc..cb837d07265 100644
--- a/src/cloudflare/resources/zero_trust/access/applications/applications.py
+++ b/src/cloudflare/resources/zero_trust/access/applications/applications.py
@@ -14,6 +14,14 @@
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,
@@ -69,6 +77,10 @@ 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)
@@ -1851,6 +1863,10 @@ 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)
@@ -3655,6 +3671,10 @@ 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:
@@ -3687,6 +3707,10 @@ 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:
@@ -3719,6 +3743,10 @@ 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:
@@ -3750,3 +3778,7 @@ 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 29133e3028c..6dcc2e9f3d9 100644
--- a/src/cloudflare/resources/zero_trust/access/applications/cas.py
+++ b/src/cloudflare/resources/zero_trust/access/applications/cas.py
@@ -2,6 +2,8 @@
from __future__ import annotations
+from typing import Any, Type, Optional, cast
+
import httpx
from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven
@@ -13,12 +15,16 @@
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"]
@@ -32,6 +38,68 @@ def with_raw_response(self) -> CAsResourceWithRawResponse:
def with_streaming_response(self) -> CAsResourceWithStreamingResponse:
return CAsResourceWithStreamingResponse(self)
+ def create(
+ self,
+ app_id: 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:
+ app_id: 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 app_id:
+ raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!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/{app_id}/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,
*,
@@ -81,6 +149,125 @@ def list(
model=CA,
)
+ def delete(
+ self,
+ app_id: 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:
+ app_id: 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 app_id:
+ raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!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/{app_id}/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,
+ app_id: 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:
+ app_id: 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 app_id:
+ raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!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/{app_id}/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
@@ -91,6 +278,68 @@ def with_raw_response(self) -> AsyncCAsResourceWithRawResponse:
def with_streaming_response(self) -> AsyncCAsResourceWithStreamingResponse:
return AsyncCAsResourceWithStreamingResponse(self)
+ async def create(
+ self,
+ app_id: 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:
+ app_id: 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 app_id:
+ raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!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/{app_id}/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,
*,
@@ -140,38 +389,193 @@ def list(
model=CA,
)
+ async def delete(
+ self,
+ app_id: 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:
+ app_id: 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 app_id:
+ raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!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/{app_id}/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,
+ app_id: 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:
+ app_id: 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 app_id:
+ raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!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/{app_id}/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
new file mode 100644
index 00000000000..bbea31c3736
--- /dev/null
+++ b/src/cloudflare/resources/zero_trust/access/applications/policies.py
@@ -0,0 +1,1007 @@
+# 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,
+ app_id: 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:
+ app_id: 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 app_id:
+ raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!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/{app_id}/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,
+ policy_id: str,
+ *,
+ app_id: 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/{account or zone_id}/policies/{uid} endpoint.
+
+ Args:
+ app_id: UUID
+
+ policy_id: 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 app_id:
+ raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}")
+ if not policy_id:
+ raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!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/{app_id}/policies/{policy_id}",
+ 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,
+ app_id: 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:
+ app_id: 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 app_id:
+ raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!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/{app_id}/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,
+ policy_id: str,
+ *,
+ app_id: 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/{account or zone_id}/policies/{uid} endpoint.
+
+ Args:
+ app_id: UUID
+
+ policy_id: 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 app_id:
+ raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}")
+ if not policy_id:
+ raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!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/{app_id}/policies/{policy_id}",
+ 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,
+ policy_id: str,
+ *,
+ app_id: 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:
+ app_id: UUID
+
+ policy_id: 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 app_id:
+ raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}")
+ if not policy_id:
+ raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!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/{app_id}/policies/{policy_id}",
+ 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,
+ app_id: 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:
+ app_id: 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 app_id:
+ raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!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/{app_id}/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,
+ policy_id: str,
+ *,
+ app_id: 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/{account or zone_id}/policies/{uid} endpoint.
+
+ Args:
+ app_id: UUID
+
+ policy_id: 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 app_id:
+ raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}")
+ if not policy_id:
+ raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!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/{app_id}/policies/{policy_id}",
+ 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,
+ app_id: 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:
+ app_id: 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 app_id:
+ raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!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/{app_id}/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,
+ policy_id: str,
+ *,
+ app_id: 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/{account or zone_id}/policies/{uid} endpoint.
+
+ Args:
+ app_id: UUID
+
+ policy_id: 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 app_id:
+ raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}")
+ if not policy_id:
+ raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!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/{app_id}/policies/{policy_id}",
+ 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,
+ policy_id: str,
+ *,
+ app_id: 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:
+ app_id: UUID
+
+ policy_id: 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 app_id:
+ raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}")
+ if not policy_id:
+ raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!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/{app_id}/policies/{policy_id}",
+ 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
new file mode 100644
index 00000000000..f6d07c482c2
--- /dev/null
+++ b/src/cloudflare/resources/zero_trust/access/bookmarks.py
@@ -0,0 +1,548 @@
+# 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,
+ bookmark_id: str,
+ *,
+ account_id: 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:
+ bookmark_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not bookmark_id:
+ raise ValueError(f"Expected a non-empty value for `bookmark_id` but received {bookmark_id!r}")
+ return self._post(
+ f"/accounts/{account_id}/access/bookmarks/{bookmark_id}",
+ 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,
+ bookmark_id: str,
+ *,
+ account_id: 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:
+ bookmark_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not bookmark_id:
+ raise ValueError(f"Expected a non-empty value for `bookmark_id` but received {bookmark_id!r}")
+ return self._put(
+ f"/accounts/{account_id}/access/bookmarks/{bookmark_id}",
+ 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,
+ *,
+ account_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,
+ ) -> 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/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,
+ bookmark_id: str,
+ *,
+ account_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[BookmarkDeleteResponse]:
+ """
+ Deletes a Bookmark application.
+
+ Args:
+ bookmark_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not bookmark_id:
+ raise ValueError(f"Expected a non-empty value for `bookmark_id` but received {bookmark_id!r}")
+ return self._delete(
+ f"/accounts/{account_id}/access/bookmarks/{bookmark_id}",
+ 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,
+ bookmark_id: str,
+ *,
+ account_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[Bookmark]:
+ """
+ Fetches a single Bookmark application.
+
+ Args:
+ bookmark_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not bookmark_id:
+ raise ValueError(f"Expected a non-empty value for `bookmark_id` but received {bookmark_id!r}")
+ return self._get(
+ f"/accounts/{account_id}/access/bookmarks/{bookmark_id}",
+ 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,
+ bookmark_id: str,
+ *,
+ account_id: 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:
+ bookmark_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not bookmark_id:
+ raise ValueError(f"Expected a non-empty value for `bookmark_id` but received {bookmark_id!r}")
+ return await self._post(
+ f"/accounts/{account_id}/access/bookmarks/{bookmark_id}",
+ 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,
+ bookmark_id: str,
+ *,
+ account_id: 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:
+ bookmark_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not bookmark_id:
+ raise ValueError(f"Expected a non-empty value for `bookmark_id` but received {bookmark_id!r}")
+ return await self._put(
+ f"/accounts/{account_id}/access/bookmarks/{bookmark_id}",
+ 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,
+ *,
+ account_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,
+ ) -> 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/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,
+ bookmark_id: str,
+ *,
+ account_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[BookmarkDeleteResponse]:
+ """
+ Deletes a Bookmark application.
+
+ Args:
+ bookmark_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not bookmark_id:
+ raise ValueError(f"Expected a non-empty value for `bookmark_id` but received {bookmark_id!r}")
+ return await self._delete(
+ f"/accounts/{account_id}/access/bookmarks/{bookmark_id}",
+ 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,
+ bookmark_id: str,
+ *,
+ account_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[Bookmark]:
+ """
+ Fetches a single Bookmark application.
+
+ Args:
+ bookmark_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not bookmark_id:
+ raise ValueError(f"Expected a non-empty value for `bookmark_id` but received {bookmark_id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/access/bookmarks/{bookmark_id}",
+ 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 a7e07081133..3bcae016b10 100644
--- a/src/cloudflare/resources/zero_trust/access/certificates/certificates.py
+++ b/src/cloudflare/resources/zero_trust/access/certificates/certificates.py
@@ -33,9 +33,10 @@
AsyncPaginator,
make_request_options,
)
-from .....types.zero_trust.access import certificate_create_params
+from .....types.zero_trust.access import certificate_create_params, certificate_update_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"]
@@ -122,6 +123,76 @@ def create(
cast_to=cast(Type[Optional[Certificate]], ResultWrapper[Certificate]),
)
+ def update(
+ self,
+ certificate_id: 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:
+ certificate_id: 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 certificate_id:
+ raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!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/{certificate_id}",
+ 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,
*,
@@ -171,6 +242,120 @@ def list(
model=Certificate,
)
+ def delete(
+ self,
+ certificate_id: 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:
+ certificate_id: 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 certificate_id:
+ raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!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/{certificate_id}",
+ 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,
+ certificate_id: 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:
+ certificate_id: 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 certificate_id:
+ raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!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/{certificate_id}",
+ 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
@@ -254,6 +439,76 @@ async def create(
cast_to=cast(Type[Optional[Certificate]], ResultWrapper[Certificate]),
)
+ async def update(
+ self,
+ certificate_id: 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:
+ certificate_id: 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 certificate_id:
+ raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!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/{certificate_id}",
+ 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,
*,
@@ -303,6 +558,120 @@ def list(
model=Certificate,
)
+ async def delete(
+ self,
+ certificate_id: 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:
+ certificate_id: 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 certificate_id:
+ raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!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/{certificate_id}",
+ 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,
+ certificate_id: 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:
+ certificate_id: 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 certificate_id:
+ raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!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/{certificate_id}",
+ 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:
@@ -311,9 +680,18 @@ 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:
@@ -327,9 +705,18 @@ 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:
@@ -343,9 +730,18 @@ 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:
@@ -359,9 +755,18 @@ 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
new file mode 100644
index 00000000000..d7eae2f7f7d
--- /dev/null
+++ b/src/cloudflare/resources/zero_trust/access/custom_pages.py
@@ -0,0 +1,636 @@
+# 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,
+ *,
+ account_id: 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:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return self._post(
+ f"/accounts/{account_id}/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,
+ custom_page_id: str,
+ *,
+ account_id: 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:
+ account_id: Identifier
+
+ custom_page_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not custom_page_id:
+ raise ValueError(f"Expected a non-empty value for `custom_page_id` but received {custom_page_id!r}")
+ return self._put(
+ f"/accounts/{account_id}/access/custom_pages/{custom_page_id}",
+ 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,
+ *,
+ account_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,
+ ) -> SyncSinglePage[CustomPageWithoutHTML]:
+ """
+ List custom pages
+
+ Args:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/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,
+ custom_page_id: str,
+ *,
+ account_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[CustomPageDeleteResponse]:
+ """
+ Delete a custom page
+
+ Args:
+ account_id: Identifier
+
+ custom_page_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not custom_page_id:
+ raise ValueError(f"Expected a non-empty value for `custom_page_id` but received {custom_page_id!r}")
+ return self._delete(
+ f"/accounts/{account_id}/access/custom_pages/{custom_page_id}",
+ 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,
+ custom_page_id: str,
+ *,
+ account_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[CustomPage]:
+ """
+ Fetches a custom page and also returns its HTML.
+
+ Args:
+ account_id: Identifier
+
+ custom_page_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not custom_page_id:
+ raise ValueError(f"Expected a non-empty value for `custom_page_id` but received {custom_page_id!r}")
+ return self._get(
+ f"/accounts/{account_id}/access/custom_pages/{custom_page_id}",
+ 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,
+ *,
+ account_id: 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:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return await self._post(
+ f"/accounts/{account_id}/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,
+ custom_page_id: str,
+ *,
+ account_id: 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:
+ account_id: Identifier
+
+ custom_page_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not custom_page_id:
+ raise ValueError(f"Expected a non-empty value for `custom_page_id` but received {custom_page_id!r}")
+ return await self._put(
+ f"/accounts/{account_id}/access/custom_pages/{custom_page_id}",
+ 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,
+ *,
+ account_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,
+ ) -> AsyncPaginator[CustomPageWithoutHTML, AsyncSinglePage[CustomPageWithoutHTML]]:
+ """
+ List custom pages
+
+ Args:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/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,
+ custom_page_id: str,
+ *,
+ account_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[CustomPageDeleteResponse]:
+ """
+ Delete a custom page
+
+ Args:
+ account_id: Identifier
+
+ custom_page_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not custom_page_id:
+ raise ValueError(f"Expected a non-empty value for `custom_page_id` but received {custom_page_id!r}")
+ return await self._delete(
+ f"/accounts/{account_id}/access/custom_pages/{custom_page_id}",
+ 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,
+ custom_page_id: str,
+ *,
+ account_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[CustomPage]:
+ """
+ Fetches a custom page and also returns its HTML.
+
+ Args:
+ account_id: Identifier
+
+ custom_page_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not custom_page_id:
+ raise ValueError(f"Expected a non-empty value for `custom_page_id` but received {custom_page_id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/access/custom_pages/{custom_page_id}",
+ 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 74f6f4a066d..8b9ee6bf716 100644
--- a/src/cloudflare/resources/zero_trust/access/groups.py
+++ b/src/cloudflare/resources/zero_trust/access/groups.py
@@ -25,9 +25,10 @@
AsyncPaginator,
make_request_options,
)
-from ....types.zero_trust.access import group_create_params
+from ....types.zero_trust.access import group_create_params, group_update_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"]
@@ -121,6 +122,91 @@ def create(
cast_to=cast(Type[Optional[ZeroTrustGroup]], ResultWrapper[ZeroTrustGroup]),
)
+ def update(
+ self,
+ group_id: 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:
+ group_id: 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 group_id:
+ raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!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/{group_id}",
+ 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,
*,
@@ -170,6 +256,120 @@ def list(
model=ZeroTrustGroup,
)
+ def delete(
+ self,
+ group_id: 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:
+ group_id: 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 group_id:
+ raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!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/{group_id}",
+ 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,
+ group_id: 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:
+ group_id: 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 group_id:
+ raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!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/{group_id}",
+ 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
@@ -260,6 +460,91 @@ async def create(
cast_to=cast(Type[Optional[ZeroTrustGroup]], ResultWrapper[ZeroTrustGroup]),
)
+ async def update(
+ self,
+ group_id: 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:
+ group_id: 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 group_id:
+ raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!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/{group_id}",
+ 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,
*,
@@ -309,6 +594,120 @@ def list(
model=ZeroTrustGroup,
)
+ async def delete(
+ self,
+ group_id: 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:
+ group_id: 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 group_id:
+ raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!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/{group_id}",
+ 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,
+ group_id: 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:
+ group_id: 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 group_id:
+ raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!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/{group_id}",
+ 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:
@@ -317,9 +716,18 @@ 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:
@@ -329,9 +737,18 @@ 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:
@@ -341,9 +758,18 @@ 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:
@@ -353,6 +779,15 @@ 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
new file mode 100644
index 00000000000..ac04e6b775d
--- /dev/null
+++ b/src/cloudflare/resources/zero_trust/access/keys.py
@@ -0,0 +1,387 @@
+# 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,
+ *,
+ account_id: 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:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return cast(
+ Optional[KeyUpdateResponse],
+ self._put(
+ f"/accounts/{account_id}/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,
+ *,
+ account_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[KeyGetResponse]:
+ """
+ Gets the Access key rotation settings for an account.
+
+ Args:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return cast(
+ Optional[KeyGetResponse],
+ self._get(
+ f"/accounts/{account_id}/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,
+ *,
+ account_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[KeyRotateResponse]:
+ """
+ Perfoms a key rotation for an account.
+
+ Args:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return cast(
+ Optional[KeyRotateResponse],
+ self._post(
+ f"/accounts/{account_id}/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,
+ *,
+ account_id: 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:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return cast(
+ Optional[KeyUpdateResponse],
+ await self._put(
+ f"/accounts/{account_id}/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,
+ *,
+ account_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[KeyGetResponse]:
+ """
+ Gets the Access key rotation settings for an account.
+
+ Args:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return cast(
+ Optional[KeyGetResponse],
+ await self._get(
+ f"/accounts/{account_id}/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,
+ *,
+ account_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[KeyRotateResponse]:
+ """
+ Perfoms a key rotation for an account.
+
+ Args:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return cast(
+ Optional[KeyRotateResponse],
+ await self._post(
+ f"/accounts/{account_id}/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
new file mode 100644
index 00000000000..7479c1fbef8
--- /dev/null
+++ b/src/cloudflare/resources/zero_trust/access/logs/__init__.py
@@ -0,0 +1,33 @@
+# 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
new file mode 100644
index 00000000000..9b90990d9cc
--- /dev/null
+++ b/src/cloudflare/resources/zero_trust/access/logs/access_requests.py
@@ -0,0 +1,158 @@
+# 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,
+ *,
+ account_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[AccessRequestListResponse]:
+ """
+ Gets a list of Access authentication audit logs for an account.
+
+ Args:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return self._get(
+ f"/accounts/{account_id}/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,
+ *,
+ account_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[AccessRequestListResponse]:
+ """
+ Gets a list of Access authentication audit logs for an account.
+
+ Args:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/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
new file mode 100644
index 00000000000..39226d42917
--- /dev/null
+++ b/src/cloudflare/resources/zero_trust/access/logs/logs.py
@@ -0,0 +1,80 @@
+# 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 679b675fdaa..066ae6dc2ac 100644
--- a/src/cloudflare/resources/zero_trust/access/service_tokens.py
+++ b/src/cloudflare/resources/zero_trust/access/service_tokens.py
@@ -25,9 +25,10 @@
AsyncPaginator,
make_request_options,
)
-from ....types.zero_trust.access import service_token_create_params
+from ....types.zero_trust.access import service_token_create_params, service_token_update_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"]
@@ -111,6 +112,78 @@ def create(
cast_to=cast(Type[Optional[ServiceTokenCreateResponse]], ResultWrapper[ServiceTokenCreateResponse]),
)
+ def update(
+ self,
+ service_token_id: 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:
+ service_token_id: 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 service_token_id:
+ raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_id!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/{service_token_id}",
+ 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,
*,
@@ -160,6 +233,208 @@ def list(
model=ServiceToken,
)
+ def delete(
+ self,
+ service_token_id: 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:
+ service_token_id: 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 service_token_id:
+ raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_id!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/{service_token_id}",
+ 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,
+ service_token_id: 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:
+ service_token_id: 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 service_token_id:
+ raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_id!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/{service_token_id}",
+ 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,
+ service_token_id: str,
+ *,
+ account_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[ServiceToken]:
+ """
+ Refreshes the expiration of a service token.
+
+ Args:
+ account_id: Identifier
+
+ service_token_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not service_token_id:
+ raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_id!r}")
+ return self._post(
+ f"/accounts/{account_id}/access/service_tokens/{service_token_id}/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,
+ service_token_id: str,
+ *,
+ account_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[ServiceTokenRotateResponse]:
+ """
+ Generates a new Client Secret for a service token and revokes the old one.
+
+ Args:
+ account_id: Identifier
+
+ service_token_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not service_token_id:
+ raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_id!r}")
+ return self._post(
+ f"/accounts/{account_id}/access/service_tokens/{service_token_id}/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
@@ -240,6 +515,78 @@ async def create(
cast_to=cast(Type[Optional[ServiceTokenCreateResponse]], ResultWrapper[ServiceTokenCreateResponse]),
)
+ async def update(
+ self,
+ service_token_id: 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:
+ service_token_id: 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 service_token_id:
+ raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_id!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/{service_token_id}",
+ 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,
*,
@@ -289,6 +636,208 @@ def list(
model=ServiceToken,
)
+ async def delete(
+ self,
+ service_token_id: 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:
+ service_token_id: 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 service_token_id:
+ raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_id!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/{service_token_id}",
+ 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,
+ service_token_id: 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:
+ service_token_id: 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 service_token_id:
+ raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_id!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/{service_token_id}",
+ 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,
+ service_token_id: str,
+ *,
+ account_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[ServiceToken]:
+ """
+ Refreshes the expiration of a service token.
+
+ Args:
+ account_id: Identifier
+
+ service_token_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not service_token_id:
+ raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_id!r}")
+ return await self._post(
+ f"/accounts/{account_id}/access/service_tokens/{service_token_id}/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,
+ service_token_id: str,
+ *,
+ account_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[ServiceTokenRotateResponse]:
+ """
+ Generates a new Client Secret for a service token and revokes the old one.
+
+ Args:
+ account_id: Identifier
+
+ service_token_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not service_token_id:
+ raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_id!r}")
+ return await self._post(
+ f"/accounts/{account_id}/access/service_tokens/{service_token_id}/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:
@@ -297,9 +846,24 @@ 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:
@@ -309,9 +873,24 @@ 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:
@@ -321,9 +900,24 @@ 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:
@@ -333,6 +927,21 @@ 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
new file mode 100644
index 00000000000..70cc924d5c3
--- /dev/null
+++ b/src/cloudflare/resources/zero_trust/access/tags.py
@@ -0,0 +1,566 @@
+# 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,
+ *,
+ account_id: 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:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return self._post(
+ f"/accounts/{account_id}/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,
+ *,
+ account_id: 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:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!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/{account_id}/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,
+ *,
+ account_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,
+ ) -> SyncSinglePage[Tag]:
+ """
+ List tags
+
+ Args:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/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,
+ tag_name: str,
+ *,
+ account_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[TagDeleteResponse]:
+ """
+ Delete a tag
+
+ Args:
+ account_id: Identifier
+
+ 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not tag_name:
+ raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}")
+ return self._delete(
+ f"/accounts/{account_id}/access/tags/{tag_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,
+ tag_name: str,
+ *,
+ account_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[Tag]:
+ """
+ Get a tag
+
+ Args:
+ account_id: Identifier
+
+ 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not tag_name:
+ raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}")
+ return self._get(
+ f"/accounts/{account_id}/access/tags/{tag_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,
+ *,
+ account_id: 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:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return await self._post(
+ f"/accounts/{account_id}/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,
+ *,
+ account_id: 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:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!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/{account_id}/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,
+ *,
+ account_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,
+ ) -> AsyncPaginator[Tag, AsyncSinglePage[Tag]]:
+ """
+ List tags
+
+ Args:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/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,
+ tag_name: str,
+ *,
+ account_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[TagDeleteResponse]:
+ """
+ Delete a tag
+
+ Args:
+ account_id: Identifier
+
+ 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not tag_name:
+ raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}")
+ return await self._delete(
+ f"/accounts/{account_id}/access/tags/{tag_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,
+ tag_name: str,
+ *,
+ account_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[Tag]:
+ """
+ Get a tag
+
+ Args:
+ account_id: Identifier
+
+ 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not tag_name:
+ raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}")
+ return await self._get(
+ f"/accounts/{account_id}/access/tags/{tag_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
new file mode 100644
index 00000000000..c5766c1427a
--- /dev/null
+++ b/src/cloudflare/resources/zero_trust/access/users/__init__.py
@@ -0,0 +1,61 @@
+# 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
new file mode 100644
index 00000000000..766bec75c17
--- /dev/null
+++ b/src/cloudflare/resources/zero_trust/access/users/active_sessions.py
@@ -0,0 +1,271 @@
+# 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,
+ user_id: str,
+ *,
+ account_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,
+ ) -> SyncSinglePage[ActiveSessionListResponse]:
+ """
+ Get active sessions for a single user.
+
+ Args:
+ account_id: Identifier
+
+ user_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not user_id:
+ raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/access/users/{user_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,
+ *,
+ account_id: str,
+ user_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:
+ account_id: Identifier
+
+ user_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not user_id:
+ raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}")
+ if not nonce:
+ raise ValueError(f"Expected a non-empty value for `nonce` but received {nonce!r}")
+ return self._get(
+ f"/accounts/{account_id}/access/users/{user_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,
+ user_id: str,
+ *,
+ account_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,
+ ) -> AsyncPaginator[ActiveSessionListResponse, AsyncSinglePage[ActiveSessionListResponse]]:
+ """
+ Get active sessions for a single user.
+
+ Args:
+ account_id: Identifier
+
+ user_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not user_id:
+ raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/access/users/{user_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,
+ *,
+ account_id: str,
+ user_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:
+ account_id: Identifier
+
+ user_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not user_id:
+ raise ValueError(f"Expected a non-empty value for `user_id` but received {user_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/{account_id}/access/users/{user_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
new file mode 100644
index 00000000000..30e2b404147
--- /dev/null
+++ b/src/cloudflare/resources/zero_trust/access/users/failed_logins.py
@@ -0,0 +1,161 @@
+# 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,
+ user_id: str,
+ *,
+ account_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,
+ ) -> SyncSinglePage[FailedLoginListResponse]:
+ """
+ Get all failed login attempts for a single user.
+
+ Args:
+ account_id: Identifier
+
+ user_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not user_id:
+ raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/access/users/{user_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,
+ user_id: str,
+ *,
+ account_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,
+ ) -> AsyncPaginator[FailedLoginListResponse, AsyncSinglePage[FailedLoginListResponse]]:
+ """
+ Get all failed login attempts for a single user.
+
+ Args:
+ account_id: Identifier
+
+ user_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not user_id:
+ raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/access/users/{user_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
new file mode 100644
index 00000000000..e1ac12e3aed
--- /dev/null
+++ b/src/cloudflare/resources/zero_trust/access/users/last_seen_identity.py
@@ -0,0 +1,168 @@
+# 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,
+ user_id: str,
+ *,
+ account_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[Identity]:
+ """
+ Get last seen identity for a single user.
+
+ Args:
+ account_id: Identifier
+
+ user_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not user_id:
+ raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}")
+ return self._get(
+ f"/accounts/{account_id}/access/users/{user_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,
+ user_id: str,
+ *,
+ account_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[Identity]:
+ """
+ Get last seen identity for a single user.
+
+ Args:
+ account_id: Identifier
+
+ user_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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not user_id:
+ raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/access/users/{user_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
new file mode 100644
index 00000000000..9021838eaff
--- /dev/null
+++ b/src/cloudflare/resources/zero_trust/access/users/users.py
@@ -0,0 +1,247 @@
+# 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,
+ *,
+ account_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,
+ ) -> SyncSinglePage[AccessUser]:
+ """
+ Gets a list of users for an account.
+
+ Args:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/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,
+ *,
+ account_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,
+ ) -> AsyncPaginator[AccessUser, AsyncSinglePage[AccessUser]]:
+ """
+ Gets a list of users for an account.
+
+ Args:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/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 22a66d860cd..d90f719e232 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, Optional, cast, overload
+from typing import Any, Type, Optional, cast, overload
import httpx
@@ -26,12 +26,17 @@
AsyncPaginator,
make_request_options,
)
-from ...types.zero_trust import IdentityProviderType, identity_provider_create_params
+from ...types.zero_trust import (
+ IdentityProviderType,
+ identity_provider_create_params,
+ identity_provider_update_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"]
@@ -782,72 +787,12 @@ 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
- async def create(
+ def update(
self,
+ identity_provider_id: str,
*,
- config: identity_provider_create_params.AzureADConfig,
+ config: identity_provider_update_params.AzureADConfig,
name: str,
type: IdentityProviderType,
account_id: str | NotGiven = NOT_GIVEN,
@@ -861,9 +806,11 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[IdentityProvider]:
"""
- Adds a new identity provider to Access.
+ Updates a configured identity provider.
Args:
+ identity_provider_id: 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/).
@@ -892,10 +839,11 @@ async def create(
...
@overload
- async def create(
+ def update(
self,
+ identity_provider_id: str,
*,
- config: identity_provider_create_params.AccessCentrifyConfig,
+ config: identity_provider_update_params.AccessCentrifyConfig,
name: str,
type: IdentityProviderType,
account_id: str | NotGiven = NOT_GIVEN,
@@ -909,9 +857,11 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[IdentityProvider]:
"""
- Adds a new identity provider to Access.
+ Updates a configured identity provider.
Args:
+ identity_provider_id: 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/).
@@ -940,8 +890,9 @@ async def create(
...
@overload
- async def create(
+ def update(
self,
+ identity_provider_id: str,
*,
config: GenericOAuthConfigParam,
name: str,
@@ -957,9 +908,11 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[IdentityProvider]:
"""
- Adds a new identity provider to Access.
+ Updates a configured identity provider.
Args:
+ identity_provider_id: 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/).
@@ -988,8 +941,9 @@ async def create(
...
@overload
- async def create(
+ def update(
self,
+ identity_provider_id: str,
*,
config: GenericOAuthConfigParam,
name: str,
@@ -1005,9 +959,11 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[IdentityProvider]:
"""
- Adds a new identity provider to Access.
+ Updates a configured identity provider.
Args:
+ identity_provider_id: 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/).
@@ -1036,10 +992,11 @@ async def create(
...
@overload
- async def create(
+ def update(
self,
+ identity_provider_id: str,
*,
- config: identity_provider_create_params.AccessGoogleConfig,
+ config: identity_provider_update_params.AccessGoogleConfig,
name: str,
type: IdentityProviderType,
account_id: str | NotGiven = NOT_GIVEN,
@@ -1053,9 +1010,11 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[IdentityProvider]:
"""
- Adds a new identity provider to Access.
+ Updates a configured identity provider.
Args:
+ identity_provider_id: 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/).
@@ -1084,10 +1043,11 @@ async def create(
...
@overload
- async def create(
+ def update(
self,
+ identity_provider_id: str,
*,
- config: identity_provider_create_params.AccessGoogleAppsConfig,
+ config: identity_provider_update_params.AccessGoogleAppsConfig,
name: str,
type: IdentityProviderType,
account_id: str | NotGiven = NOT_GIVEN,
@@ -1101,9 +1061,11 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[IdentityProvider]:
"""
- Adds a new identity provider to Access.
+ Updates a configured identity provider.
Args:
+ identity_provider_id: 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/).
@@ -1132,8 +1094,9 @@ async def create(
...
@overload
- async def create(
+ def update(
self,
+ identity_provider_id: str,
*,
config: GenericOAuthConfigParam,
name: str,
@@ -1149,9 +1112,11 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[IdentityProvider]:
"""
- Adds a new identity provider to Access.
+ Updates a configured identity provider.
Args:
+ identity_provider_id: 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/).
@@ -1180,10 +1145,11 @@ async def create(
...
@overload
- async def create(
+ def update(
self,
+ identity_provider_id: str,
*,
- config: identity_provider_create_params.AccessOIDCConfig,
+ config: identity_provider_update_params.AccessOIDCConfig,
name: str,
type: IdentityProviderType,
account_id: str | NotGiven = NOT_GIVEN,
@@ -1197,9 +1163,11 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[IdentityProvider]:
"""
- Adds a new identity provider to Access.
+ Updates a configured identity provider.
Args:
+ identity_provider_id: 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/).
@@ -1228,10 +1196,11 @@ async def create(
...
@overload
- async def create(
+ def update(
self,
+ identity_provider_id: str,
*,
- config: identity_provider_create_params.AccessOktaConfig,
+ config: identity_provider_update_params.AccessOktaConfig,
name: str,
type: IdentityProviderType,
account_id: str | NotGiven = NOT_GIVEN,
@@ -1245,9 +1214,11 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[IdentityProvider]:
"""
- Adds a new identity provider to Access.
+ Updates a configured identity provider.
Args:
+ identity_provider_id: 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/).
@@ -1276,10 +1247,11 @@ async def create(
...
@overload
- async def create(
+ def update(
self,
+ identity_provider_id: str,
*,
- config: identity_provider_create_params.AccessOneloginConfig,
+ config: identity_provider_update_params.AccessOneloginConfig,
name: str,
type: IdentityProviderType,
account_id: str | NotGiven = NOT_GIVEN,
@@ -1293,9 +1265,11 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[IdentityProvider]:
"""
- Adds a new identity provider to Access.
+ Updates a configured identity provider.
Args:
+ identity_provider_id: 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/).
@@ -1324,10 +1298,11 @@ async def create(
...
@overload
- async def create(
+ def update(
self,
+ identity_provider_id: str,
*,
- config: identity_provider_create_params.AccessPingoneConfig,
+ config: identity_provider_update_params.AccessPingoneConfig,
name: str,
type: IdentityProviderType,
account_id: str | NotGiven = NOT_GIVEN,
@@ -1341,9 +1316,11 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[IdentityProvider]:
"""
- Adds a new identity provider to Access.
+ Updates a configured identity provider.
Args:
+ identity_provider_id: 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/).
@@ -1372,10 +1349,11 @@ async def create(
...
@overload
- async def create(
+ def update(
self,
+ identity_provider_id: str,
*,
- config: identity_provider_create_params.AccessSAMLConfig,
+ config: identity_provider_update_params.AccessSAMLConfig,
name: str,
type: IdentityProviderType,
account_id: str | NotGiven = NOT_GIVEN,
@@ -1389,9 +1367,11 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[IdentityProvider]:
"""
- Adds a new identity provider to Access.
+ Updates a configured identity provider.
Args:
+ identity_provider_id: 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/).
@@ -1420,8 +1400,9 @@ async def create(
...
@overload
- async def create(
+ def update(
self,
+ identity_provider_id: str,
*,
config: GenericOAuthConfigParam,
name: str,
@@ -1437,9 +1418,11 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[IdentityProvider]:
"""
- Adds a new identity provider to Access.
+ Updates a configured identity provider.
Args:
+ identity_provider_id: 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/).
@@ -1468,8 +1451,9 @@ async def create(
...
@overload
- async def create(
+ def update(
self,
+ identity_provider_id: str,
*,
config: object,
name: str,
@@ -1485,9 +1469,11 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[IdentityProvider]:
"""
- Adds a new identity provider to Access.
+ Updates a configured identity provider.
Args:
+ identity_provider_id: 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/).
@@ -1516,19 +1502,20 @@ async def create(
...
@required_args(["config", "name", "type"])
- async def create(
+ def update(
self,
+ identity_provider_id: str,
*,
- config: identity_provider_create_params.AzureADConfig
- | identity_provider_create_params.AccessCentrifyConfig
+ config: identity_provider_update_params.AzureADConfig
+ | identity_provider_update_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
+ | 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,
@@ -1542,6 +1529,10 @@ async def create(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[IdentityProvider]:
+ if not identity_provider_id:
+ raise ValueError(
+ f"Expected a non-empty value for `identity_provider_id` but received {identity_provider_id!r}"
+ )
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")
@@ -1556,16 +1547,16 @@ async def create(
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(
+ self._put(
+ f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{identity_provider_id}",
+ body=maybe_transform(
{
"config": config,
"name": name,
"type": type,
"scim_config": scim_config,
},
- identity_provider_create_params.IdentityProviderCreateParams,
+ identity_provider_update_params.IdentityProviderUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers,
@@ -1591,7 +1582,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AsyncPaginator[IdentityProviderListResponse, AsyncSinglePage[IdentityProviderListResponse]]:
+ ) -> SyncSinglePage[IdentityProviderListResponse]:
"""
Lists all configured identity providers.
@@ -1622,7 +1613,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=AsyncSinglePage[IdentityProviderListResponse],
+ page=SyncSinglePage[IdentityProviderListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -1631,50 +1622,1914 @@ def list(
), # Union types cannot be passed in as arguments in the type system
)
+ def delete(
+ self,
+ identity_provider_id: 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.
-class IdentityProvidersResourceWithRawResponse:
- def __init__(self, identity_providers: IdentityProvidersResource) -> None:
- self._identity_providers = identity_providers
+ Args:
+ identity_provider_id: UUID
- self.create = to_raw_response_wrapper(
- identity_providers.create,
- )
- self.list = to_raw_response_wrapper(
- identity_providers.list,
- )
+ 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.
-class AsyncIdentityProvidersResourceWithRawResponse:
- def __init__(self, identity_providers: AsyncIdentityProvidersResource) -> None:
- self._identity_providers = identity_providers
+ extra_headers: Send extra headers
- self.create = async_to_raw_response_wrapper(
- identity_providers.create,
- )
- self.list = async_to_raw_response_wrapper(
- identity_providers.list,
- )
+ extra_query: Add additional query parameters to the request
+ extra_body: Add additional JSON properties to the request
-class IdentityProvidersResourceWithStreamingResponse:
- def __init__(self, identity_providers: IdentityProvidersResource) -> None:
- self._identity_providers = identity_providers
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not identity_provider_id:
+ raise ValueError(
+ f"Expected a non-empty value for `identity_provider_id` but received {identity_provider_id!r}"
+ )
+ if account_id and zone_id:
+ raise ValueError("You cannot provide both account_id and zone_id")
- self.create = to_streamed_response_wrapper(
- identity_providers.create,
- )
- self.list = to_streamed_response_wrapper(
- identity_providers.list,
+ 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/identity_providers/{identity_provider_id}",
+ 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]),
)
+ def get(
+ self,
+ identity_provider_id: 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:
+ identity_provider_id: UUID
-class AsyncIdentityProvidersResourceWithStreamingResponse:
- def __init__(self, identity_providers: AsyncIdentityProvidersResource) -> None:
- self._identity_providers = identity_providers
+ account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- self.create = async_to_streamed_response_wrapper(
- identity_providers.create,
+ 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 identity_provider_id:
+ raise ValueError(
+ f"Expected a non-empty value for `identity_provider_id` but received {identity_provider_id!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],
+ self._get(
+ f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{identity_provider_id}",
+ 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.list = async_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,
+ identity_provider_id: 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:
+ identity_provider_id: 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,
+ identity_provider_id: 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:
+ identity_provider_id: 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,
+ identity_provider_id: 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:
+ identity_provider_id: 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,
+ identity_provider_id: 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:
+ identity_provider_id: 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,
+ identity_provider_id: 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:
+ identity_provider_id: 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,
+ identity_provider_id: 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:
+ identity_provider_id: 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,
+ identity_provider_id: 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:
+ identity_provider_id: 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,
+ identity_provider_id: 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:
+ identity_provider_id: 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,
+ identity_provider_id: 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:
+ identity_provider_id: 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,
+ identity_provider_id: 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:
+ identity_provider_id: 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,
+ identity_provider_id: 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:
+ identity_provider_id: 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,
+ identity_provider_id: 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:
+ identity_provider_id: 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,
+ identity_provider_id: 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:
+ identity_provider_id: 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,
+ identity_provider_id: 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:
+ identity_provider_id: 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,
+ identity_provider_id: 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 identity_provider_id:
+ raise ValueError(
+ f"Expected a non-empty value for `identity_provider_id` but received {identity_provider_id!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/{identity_provider_id}",
+ 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,
+ identity_provider_id: 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:
+ identity_provider_id: 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 identity_provider_id:
+ raise ValueError(
+ f"Expected a non-empty value for `identity_provider_id` but received {identity_provider_id!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/{identity_provider_id}",
+ 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,
+ identity_provider_id: 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:
+ identity_provider_id: 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 identity_provider_id:
+ raise ValueError(
+ f"Expected a non-empty value for `identity_provider_id` but received {identity_provider_id!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/{identity_provider_id}",
+ 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
+
+ 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
new file mode 100644
index 00000000000..fa9fbe00220
--- /dev/null
+++ b/src/cloudflare/resources/zero_trust/seats.py
@@ -0,0 +1,169 @@
+# 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,
+ *,
+ account_id: 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:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return self._patch(
+ f"/accounts/{account_id}/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,
+ *,
+ account_id: 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:
+ account_id: 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 account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return await self._patch(
+ f"/accounts/{account_id}/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 880f0f44ea4..63aefc65ac1 100644
--- a/src/cloudflare/resources/zero_trust/zero_trust.py
+++ b/src/cloudflare/resources/zero_trust/zero_trust.py
@@ -18,6 +18,14 @@
DLPResourceWithStreamingResponse,
AsyncDLPResourceWithStreamingResponse,
)
+from .seats import (
+ SeatsResource,
+ AsyncSeatsResource,
+ SeatsResourceWithRawResponse,
+ AsyncSeatsResourceWithRawResponse,
+ SeatsResourceWithStreamingResponse,
+ AsyncSeatsResourceWithStreamingResponse,
+)
from .access import (
AccessResource,
AsyncAccessResource,
@@ -117,6 +125,10 @@ 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)
@@ -171,6 +183,10 @@ 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)
@@ -228,6 +244,10 @@ 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)
@@ -277,6 +297,10 @@ 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)
@@ -326,6 +350,10 @@ 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)
@@ -375,6 +403,10 @@ 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/rulesets/phase_get_response.py b/src/cloudflare/types/rulesets/phase_get_response.py
index 476a9254497..d88c9679596 100644
--- a/src/cloudflare/types/rulesets/phase_get_response.py
+++ b/src/cloudflare/types/rulesets/phase_get_response.py
@@ -33,6 +33,8 @@
"RuleRulesetsLogCustomFieldRuleActionParametersCookieField",
"RuleRulesetsLogCustomFieldRuleActionParametersRequestField",
"RuleRulesetsLogCustomFieldRuleActionParametersResponseField",
+ "RuleRulesetsDDoSDynamicRule",
+ "RuleRulesetsForceConnectionCloseRule",
]
@@ -97,6 +99,76 @@ 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,
@@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(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 d1e457901af..27f4398d8c9 100644
--- a/src/cloudflare/types/rulesets/phase_update_params.py
+++ b/src/cloudflare/types/rulesets/phase_update_params.py
@@ -32,6 +32,8 @@
"RuleRulesetsLogCustomFieldRuleActionParametersCookieField",
"RuleRulesetsLogCustomFieldRuleActionParametersRequestField",
"RuleRulesetsLogCustomFieldRuleActionParametersResponseField",
+ "RuleRulesetsDDoSDynamicRule",
+ "RuleRulesetsForceConnectionCloseRule",
]
@@ -110,6 +112,58 @@ 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,
@@ -127,4 +181,6 @@ class RuleRulesetsLogCustomFieldRule(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 a92b28cb216..3e00524ec11 100644
--- a/src/cloudflare/types/rulesets/phase_update_response.py
+++ b/src/cloudflare/types/rulesets/phase_update_response.py
@@ -33,6 +33,8 @@
"RuleRulesetsLogCustomFieldRuleActionParametersCookieField",
"RuleRulesetsLogCustomFieldRuleActionParametersRequestField",
"RuleRulesetsLogCustomFieldRuleActionParametersResponseField",
+ "RuleRulesetsDDoSDynamicRule",
+ "RuleRulesetsForceConnectionCloseRule",
]
@@ -97,6 +99,76 @@ 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,
@@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(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 bf04a129360..3c7d7b05653 100644
--- a/src/cloudflare/types/rulesets/phases/version_get_response.py
+++ b/src/cloudflare/types/rulesets/phases/version_get_response.py
@@ -33,6 +33,8 @@
"RuleRulesetsLogCustomFieldRuleActionParametersCookieField",
"RuleRulesetsLogCustomFieldRuleActionParametersRequestField",
"RuleRulesetsLogCustomFieldRuleActionParametersResponseField",
+ "RuleRulesetsDDoSDynamicRule",
+ "RuleRulesetsForceConnectionCloseRule",
]
@@ -97,6 +99,76 @@ 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,
@@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(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 e08bad9f0e5..f027d1e1dc5 100644
--- a/src/cloudflare/types/rulesets/rule_create_params.py
+++ b/src/cloudflare/types/rulesets/rule_create_params.py
@@ -76,6 +76,8 @@
"RulesetsLogCustomFieldRuleActionParametersCookieField",
"RulesetsLogCustomFieldRuleActionParametersRequestField",
"RulesetsLogCustomFieldRuleActionParametersResponseField",
+ "RulesetsDDoSDynamicRule",
+ "RulesetsForceConnectionCloseRule",
]
@@ -1205,6 +1207,70 @@ 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,
@@ -1222,4 +1288,6 @@ class RulesetsLogCustomFieldRuleActionParameters(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 9a729d3fbe1..04e3457f902 100644
--- a/src/cloudflare/types/rulesets/rule_create_response.py
+++ b/src/cloudflare/types/rulesets/rule_create_response.py
@@ -33,6 +33,8 @@
"RuleRulesetsLogCustomFieldRuleActionParametersCookieField",
"RuleRulesetsLogCustomFieldRuleActionParametersRequestField",
"RuleRulesetsLogCustomFieldRuleActionParametersResponseField",
+ "RuleRulesetsDDoSDynamicRule",
+ "RuleRulesetsForceConnectionCloseRule",
]
@@ -97,6 +99,76 @@ 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,
@@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(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 1b6810d585e..25d801cd5aa 100644
--- a/src/cloudflare/types/rulesets/rule_delete_response.py
+++ b/src/cloudflare/types/rulesets/rule_delete_response.py
@@ -33,6 +33,8 @@
"RuleRulesetsLogCustomFieldRuleActionParametersCookieField",
"RuleRulesetsLogCustomFieldRuleActionParametersRequestField",
"RuleRulesetsLogCustomFieldRuleActionParametersResponseField",
+ "RuleRulesetsDDoSDynamicRule",
+ "RuleRulesetsForceConnectionCloseRule",
]
@@ -97,6 +99,76 @@ 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,
@@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(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 86c8418e7c8..8382c7d8687 100644
--- a/src/cloudflare/types/rulesets/rule_edit_params.py
+++ b/src/cloudflare/types/rulesets/rule_edit_params.py
@@ -76,6 +76,8 @@
"RulesetsLogCustomFieldRuleActionParametersCookieField",
"RulesetsLogCustomFieldRuleActionParametersRequestField",
"RulesetsLogCustomFieldRuleActionParametersResponseField",
+ "RulesetsDDoSDynamicRule",
+ "RulesetsForceConnectionCloseRule",
]
@@ -1253,6 +1255,76 @@ 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,
@@ -1270,4 +1342,6 @@ class RulesetsLogCustomFieldRuleActionParameters(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 3bf0100ef6f..47dd4534324 100644
--- a/src/cloudflare/types/rulesets/rule_edit_response.py
+++ b/src/cloudflare/types/rulesets/rule_edit_response.py
@@ -33,6 +33,8 @@
"RuleRulesetsLogCustomFieldRuleActionParametersCookieField",
"RuleRulesetsLogCustomFieldRuleActionParametersRequestField",
"RuleRulesetsLogCustomFieldRuleActionParametersResponseField",
+ "RuleRulesetsDDoSDynamicRule",
+ "RuleRulesetsForceConnectionCloseRule",
]
@@ -97,6 +99,76 @@ 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,
@@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(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 6d34a46fac5..4e372271bef 100644
--- a/src/cloudflare/types/rulesets/ruleset_create_params.py
+++ b/src/cloudflare/types/rulesets/ruleset_create_params.py
@@ -32,6 +32,8 @@
"RuleRulesetsLogCustomFieldRuleActionParametersCookieField",
"RuleRulesetsLogCustomFieldRuleActionParametersRequestField",
"RuleRulesetsLogCustomFieldRuleActionParametersResponseField",
+ "RuleRulesetsDDoSDynamicRule",
+ "RuleRulesetsForceConnectionCloseRule",
]
@@ -110,6 +112,58 @@ 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,
@@ -127,4 +181,6 @@ class RuleRulesetsLogCustomFieldRule(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 f87b58ceec8..bfeacd5afd4 100644
--- a/src/cloudflare/types/rulesets/ruleset_create_response.py
+++ b/src/cloudflare/types/rulesets/ruleset_create_response.py
@@ -33,6 +33,8 @@
"RuleRulesetsLogCustomFieldRuleActionParametersCookieField",
"RuleRulesetsLogCustomFieldRuleActionParametersRequestField",
"RuleRulesetsLogCustomFieldRuleActionParametersResponseField",
+ "RuleRulesetsDDoSDynamicRule",
+ "RuleRulesetsForceConnectionCloseRule",
]
@@ -97,6 +99,76 @@ 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,
@@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(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 d5864df9b91..328ba42b25a 100644
--- a/src/cloudflare/types/rulesets/ruleset_get_response.py
+++ b/src/cloudflare/types/rulesets/ruleset_get_response.py
@@ -33,6 +33,8 @@
"RuleRulesetsLogCustomFieldRuleActionParametersCookieField",
"RuleRulesetsLogCustomFieldRuleActionParametersRequestField",
"RuleRulesetsLogCustomFieldRuleActionParametersResponseField",
+ "RuleRulesetsDDoSDynamicRule",
+ "RuleRulesetsForceConnectionCloseRule",
]
@@ -97,6 +99,76 @@ 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,
@@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(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 ce723859ed9..e2ff9a9fcb8 100644
--- a/src/cloudflare/types/rulesets/ruleset_update_params.py
+++ b/src/cloudflare/types/rulesets/ruleset_update_params.py
@@ -32,6 +32,8 @@
"RuleRulesetsLogCustomFieldRuleActionParametersCookieField",
"RuleRulesetsLogCustomFieldRuleActionParametersRequestField",
"RuleRulesetsLogCustomFieldRuleActionParametersResponseField",
+ "RuleRulesetsDDoSDynamicRule",
+ "RuleRulesetsForceConnectionCloseRule",
]
@@ -110,6 +112,58 @@ 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,
@@ -127,4 +181,6 @@ class RuleRulesetsLogCustomFieldRule(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 d2aaaa91d6f..9fb84d0d26a 100644
--- a/src/cloudflare/types/rulesets/ruleset_update_response.py
+++ b/src/cloudflare/types/rulesets/ruleset_update_response.py
@@ -33,6 +33,8 @@
"RuleRulesetsLogCustomFieldRuleActionParametersCookieField",
"RuleRulesetsLogCustomFieldRuleActionParametersRequestField",
"RuleRulesetsLogCustomFieldRuleActionParametersResponseField",
+ "RuleRulesetsDDoSDynamicRule",
+ "RuleRulesetsForceConnectionCloseRule",
]
@@ -97,6 +99,76 @@ 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,
@@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(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 4d61f17e3ec..abb1cfae6c7 100644
--- a/src/cloudflare/types/rulesets/version_get_response.py
+++ b/src/cloudflare/types/rulesets/version_get_response.py
@@ -33,6 +33,8 @@
"RuleRulesetsLogCustomFieldRuleActionParametersCookieField",
"RuleRulesetsLogCustomFieldRuleActionParametersRequestField",
"RuleRulesetsLogCustomFieldRuleActionParametersResponseField",
+ "RuleRulesetsDDoSDynamicRule",
+ "RuleRulesetsForceConnectionCloseRule",
]
@@ -97,6 +99,76 @@ 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,
@@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(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 62def70b1fd..058c549bc29 100644
--- a/src/cloudflare/types/rulesets/versions/by_tag_get_response.py
+++ b/src/cloudflare/types/rulesets/versions/by_tag_get_response.py
@@ -33,6 +33,8 @@
"RuleRulesetsLogCustomFieldRuleActionParametersCookieField",
"RuleRulesetsLogCustomFieldRuleActionParametersRequestField",
"RuleRulesetsLogCustomFieldRuleActionParametersResponseField",
+ "RuleRulesetsDDoSDynamicRule",
+ "RuleRulesetsForceConnectionCloseRule",
]
@@ -97,6 +99,76 @@ 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,
@@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(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 2cd39fd22ee..fe2de93ed13 100644
--- a/src/cloudflare/types/zero_trust/__init__.py
+++ b/src/cloudflare/types/zero_trust/__init__.py
@@ -2,6 +2,7 @@
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
@@ -26,6 +27,7 @@
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
@@ -34,6 +36,7 @@
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
@@ -73,11 +76,13 @@
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 2645e488cfc..8b8d5c829cf 100644
--- a/src/cloudflare/types/zero_trust/access/__init__.py
+++ b/src/cloudflare/types/zero_trust/access/__init__.py
@@ -2,8 +2,12 @@
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
@@ -14,22 +18,42 @@
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
new file mode 100644
index 00000000000..2430d721cf2
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/access_user.py
@@ -0,0 +1,41 @@
+# 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/application_create_params.py b/src/cloudflare/types/zero_trust/access/application_create_params.py
index ceefef639fc..8db6908028c 100644
--- a/src/cloudflare/types/zero_trust/access/application_create_params.py
+++ b/src/cloudflare/types/zero_trust/access/application_create_params.py
@@ -248,6 +248,9 @@ class SelfHostedApplication(TypedDict, total=False):
class SelfHostedApplicationPolicyAccessAppPolicyLink(TypedDict, total=False):
+ id: str
+ """The UUID of the policy"""
+
precedence: int
"""The order of execution for this policy.
@@ -268,6 +271,9 @@ class SelfHostedApplicationPolicyUnionMember2(TypedDict, total=False):
name: Required[str]
"""The name of the Access policy."""
+ id: str
+ """The UUID of the policy"""
+
approval_groups: Iterable[ApprovalGroupParam]
"""Administrators who can approve a temporary authentication request."""
@@ -508,6 +514,9 @@ class SaaSApplication(TypedDict, total=False):
class SaaSApplicationPolicyAccessAppPolicyLink(TypedDict, total=False):
+ id: str
+ """The UUID of the policy"""
+
precedence: int
"""The order of execution for this policy.
@@ -528,6 +537,9 @@ class SaaSApplicationPolicyUnionMember2(TypedDict, total=False):
name: Required[str]
"""The name of the Access policy."""
+ id: str
+ """The UUID of the policy"""
+
approval_groups: Iterable[ApprovalGroupParam]
"""Administrators who can approve a temporary authentication request."""
@@ -935,6 +947,9 @@ class BrowserSSHApplication(TypedDict, total=False):
class BrowserSSHApplicationPolicyAccessAppPolicyLink(TypedDict, total=False):
+ id: str
+ """The UUID of the policy"""
+
precedence: int
"""The order of execution for this policy.
@@ -955,6 +970,9 @@ class BrowserSSHApplicationPolicyUnionMember2(TypedDict, total=False):
name: Required[str]
"""The name of the Access policy."""
+ id: str
+ """The UUID of the policy"""
+
approval_groups: Iterable[ApprovalGroupParam]
"""Administrators who can approve a temporary authentication request."""
@@ -1274,6 +1292,9 @@ class BrowserVncApplication(TypedDict, total=False):
class BrowserVncApplicationPolicyAccessAppPolicyLink(TypedDict, total=False):
+ id: str
+ """The UUID of the policy"""
+
precedence: int
"""The order of execution for this policy.
@@ -1294,6 +1315,9 @@ class BrowserVncApplicationPolicyUnionMember2(TypedDict, total=False):
name: Required[str]
"""The name of the Access policy."""
+ id: str
+ """The UUID of the policy"""
+
approval_groups: Iterable[ApprovalGroupParam]
"""Administrators who can approve a temporary authentication request."""
@@ -1521,6 +1545,9 @@ class AppLauncherApplication(TypedDict, total=False):
class AppLauncherApplicationPolicyAccessAppPolicyLink(TypedDict, total=False):
+ id: str
+ """The UUID of the policy"""
+
precedence: int
"""The order of execution for this policy.
@@ -1541,6 +1568,9 @@ class AppLauncherApplicationPolicyUnionMember2(TypedDict, total=False):
name: Required[str]
"""The name of the Access policy."""
+ id: str
+ """The UUID of the policy"""
+
approval_groups: Iterable[ApprovalGroupParam]
"""Administrators who can approve a temporary authentication request."""
@@ -1768,6 +1798,9 @@ class DeviceEnrollmentPermissionsApplication(TypedDict, total=False):
class DeviceEnrollmentPermissionsApplicationPolicyAccessAppPolicyLink(TypedDict, total=False):
+ id: str
+ """The UUID of the policy"""
+
precedence: int
"""The order of execution for this policy.
@@ -1788,6 +1821,9 @@ class DeviceEnrollmentPermissionsApplicationPolicyUnionMember2(TypedDict, total=
name: Required[str]
"""The name of the Access policy."""
+ id: str
+ """The UUID of the policy"""
+
approval_groups: Iterable[ApprovalGroupParam]
"""Administrators who can approve a temporary authentication request."""
@@ -2021,6 +2057,9 @@ class BrowserIsolationPermissionsApplication(TypedDict, total=False):
class BrowserIsolationPermissionsApplicationPolicyAccessAppPolicyLink(TypedDict, total=False):
+ id: str
+ """The UUID of the policy"""
+
precedence: int
"""The order of execution for this policy.
@@ -2041,6 +2080,9 @@ class BrowserIsolationPermissionsApplicationPolicyUnionMember2(TypedDict, total=
name: Required[str]
"""The name of the Access policy."""
+ id: str
+ """The UUID of the policy"""
+
approval_groups: Iterable[ApprovalGroupParam]
"""Administrators who can approve a temporary authentication request."""
diff --git a/src/cloudflare/types/zero_trust/access/application_create_response.py b/src/cloudflare/types/zero_trust/access/application_create_response.py
index 982ec9f5012..5723338d66f 100644
--- a/src/cloudflare/types/zero_trust/access/application_create_response.py
+++ b/src/cloudflare/types/zero_trust/access/application_create_response.py
@@ -100,7 +100,7 @@
class SelfHostedApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -424,7 +424,7 @@ class SelfHostedApplication(BaseModel):
class SaaSApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -765,7 +765,7 @@ class SaaSApplication(BaseModel):
class BrowserSSHApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -1089,7 +1089,7 @@ class BrowserSSHApplication(BaseModel):
class BrowserVncApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -1413,7 +1413,7 @@ class BrowserVncApplication(BaseModel):
class AppLauncherApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -1655,7 +1655,7 @@ class AppLauncherApplication(BaseModel):
class DeviceEnrollmentPermissionsApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -1899,7 +1899,7 @@ class DeviceEnrollmentPermissionsApplication(BaseModel):
class BrowserIsolationPermissionsApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
diff --git a/src/cloudflare/types/zero_trust/access/application_get_response.py b/src/cloudflare/types/zero_trust/access/application_get_response.py
index 002c59d38ba..5fd2d5a2925 100644
--- a/src/cloudflare/types/zero_trust/access/application_get_response.py
+++ b/src/cloudflare/types/zero_trust/access/application_get_response.py
@@ -100,7 +100,7 @@
class SelfHostedApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -424,7 +424,7 @@ class SelfHostedApplication(BaseModel):
class SaaSApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -765,7 +765,7 @@ class SaaSApplication(BaseModel):
class BrowserSSHApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -1089,7 +1089,7 @@ class BrowserSSHApplication(BaseModel):
class BrowserVncApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -1413,7 +1413,7 @@ class BrowserVncApplication(BaseModel):
class AppLauncherApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -1655,7 +1655,7 @@ class AppLauncherApplication(BaseModel):
class DeviceEnrollmentPermissionsApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -1899,7 +1899,7 @@ class DeviceEnrollmentPermissionsApplication(BaseModel):
class BrowserIsolationPermissionsApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
diff --git a/src/cloudflare/types/zero_trust/access/application_list_response.py b/src/cloudflare/types/zero_trust/access/application_list_response.py
index 5cde098ccba..9cbe550e5ac 100644
--- a/src/cloudflare/types/zero_trust/access/application_list_response.py
+++ b/src/cloudflare/types/zero_trust/access/application_list_response.py
@@ -100,7 +100,7 @@
class SelfHostedApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -424,7 +424,7 @@ class SelfHostedApplication(BaseModel):
class SaaSApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -765,7 +765,7 @@ class SaaSApplication(BaseModel):
class BrowserSSHApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -1089,7 +1089,7 @@ class BrowserSSHApplication(BaseModel):
class BrowserVncApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -1413,7 +1413,7 @@ class BrowserVncApplication(BaseModel):
class AppLauncherApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -1655,7 +1655,7 @@ class AppLauncherApplication(BaseModel):
class DeviceEnrollmentPermissionsApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -1899,7 +1899,7 @@ class DeviceEnrollmentPermissionsApplication(BaseModel):
class BrowserIsolationPermissionsApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
diff --git a/src/cloudflare/types/zero_trust/access/application_update_params.py b/src/cloudflare/types/zero_trust/access/application_update_params.py
index 89f3c200849..0f45c59a354 100644
--- a/src/cloudflare/types/zero_trust/access/application_update_params.py
+++ b/src/cloudflare/types/zero_trust/access/application_update_params.py
@@ -248,6 +248,9 @@ class SelfHostedApplication(TypedDict, total=False):
class SelfHostedApplicationPolicyAccessAppPolicyLink(TypedDict, total=False):
+ id: str
+ """The UUID of the policy"""
+
precedence: int
"""The order of execution for this policy.
@@ -268,6 +271,9 @@ class SelfHostedApplicationPolicyUnionMember2(TypedDict, total=False):
name: Required[str]
"""The name of the Access policy."""
+ id: str
+ """The UUID of the policy"""
+
approval_groups: Iterable[ApprovalGroupParam]
"""Administrators who can approve a temporary authentication request."""
@@ -508,6 +514,9 @@ class SaaSApplication(TypedDict, total=False):
class SaaSApplicationPolicyAccessAppPolicyLink(TypedDict, total=False):
+ id: str
+ """The UUID of the policy"""
+
precedence: int
"""The order of execution for this policy.
@@ -528,6 +537,9 @@ class SaaSApplicationPolicyUnionMember2(TypedDict, total=False):
name: Required[str]
"""The name of the Access policy."""
+ id: str
+ """The UUID of the policy"""
+
approval_groups: Iterable[ApprovalGroupParam]
"""Administrators who can approve a temporary authentication request."""
@@ -935,6 +947,9 @@ class BrowserSSHApplication(TypedDict, total=False):
class BrowserSSHApplicationPolicyAccessAppPolicyLink(TypedDict, total=False):
+ id: str
+ """The UUID of the policy"""
+
precedence: int
"""The order of execution for this policy.
@@ -955,6 +970,9 @@ class BrowserSSHApplicationPolicyUnionMember2(TypedDict, total=False):
name: Required[str]
"""The name of the Access policy."""
+ id: str
+ """The UUID of the policy"""
+
approval_groups: Iterable[ApprovalGroupParam]
"""Administrators who can approve a temporary authentication request."""
@@ -1274,6 +1292,9 @@ class BrowserVncApplication(TypedDict, total=False):
class BrowserVncApplicationPolicyAccessAppPolicyLink(TypedDict, total=False):
+ id: str
+ """The UUID of the policy"""
+
precedence: int
"""The order of execution for this policy.
@@ -1294,6 +1315,9 @@ class BrowserVncApplicationPolicyUnionMember2(TypedDict, total=False):
name: Required[str]
"""The name of the Access policy."""
+ id: str
+ """The UUID of the policy"""
+
approval_groups: Iterable[ApprovalGroupParam]
"""Administrators who can approve a temporary authentication request."""
@@ -1521,6 +1545,9 @@ class AppLauncherApplication(TypedDict, total=False):
class AppLauncherApplicationPolicyAccessAppPolicyLink(TypedDict, total=False):
+ id: str
+ """The UUID of the policy"""
+
precedence: int
"""The order of execution for this policy.
@@ -1541,6 +1568,9 @@ class AppLauncherApplicationPolicyUnionMember2(TypedDict, total=False):
name: Required[str]
"""The name of the Access policy."""
+ id: str
+ """The UUID of the policy"""
+
approval_groups: Iterable[ApprovalGroupParam]
"""Administrators who can approve a temporary authentication request."""
@@ -1768,6 +1798,9 @@ class DeviceEnrollmentPermissionsApplication(TypedDict, total=False):
class DeviceEnrollmentPermissionsApplicationPolicyAccessAppPolicyLink(TypedDict, total=False):
+ id: str
+ """The UUID of the policy"""
+
precedence: int
"""The order of execution for this policy.
@@ -1788,6 +1821,9 @@ class DeviceEnrollmentPermissionsApplicationPolicyUnionMember2(TypedDict, total=
name: Required[str]
"""The name of the Access policy."""
+ id: str
+ """The UUID of the policy"""
+
approval_groups: Iterable[ApprovalGroupParam]
"""Administrators who can approve a temporary authentication request."""
@@ -2021,6 +2057,9 @@ class BrowserIsolationPermissionsApplication(TypedDict, total=False):
class BrowserIsolationPermissionsApplicationPolicyAccessAppPolicyLink(TypedDict, total=False):
+ id: str
+ """The UUID of the policy"""
+
precedence: int
"""The order of execution for this policy.
@@ -2041,6 +2080,9 @@ class BrowserIsolationPermissionsApplicationPolicyUnionMember2(TypedDict, total=
name: Required[str]
"""The name of the Access policy."""
+ id: str
+ """The UUID of the policy"""
+
approval_groups: Iterable[ApprovalGroupParam]
"""Administrators who can approve a temporary authentication request."""
diff --git a/src/cloudflare/types/zero_trust/access/application_update_response.py b/src/cloudflare/types/zero_trust/access/application_update_response.py
index e4d7f457b89..b0a4b129ca1 100644
--- a/src/cloudflare/types/zero_trust/access/application_update_response.py
+++ b/src/cloudflare/types/zero_trust/access/application_update_response.py
@@ -100,7 +100,7 @@
class SelfHostedApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -424,7 +424,7 @@ class SelfHostedApplication(BaseModel):
class SaaSApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -765,7 +765,7 @@ class SaaSApplication(BaseModel):
class BrowserSSHApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -1089,7 +1089,7 @@ class BrowserSSHApplication(BaseModel):
class BrowserVncApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -1413,7 +1413,7 @@ class BrowserVncApplication(BaseModel):
class AppLauncherApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -1655,7 +1655,7 @@ class AppLauncherApplication(BaseModel):
class DeviceEnrollmentPermissionsApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
@@ -1899,7 +1899,7 @@ class DeviceEnrollmentPermissionsApplication(BaseModel):
class BrowserIsolationPermissionsApplicationPolicy(BaseModel):
id: Optional[str] = None
- """UUID"""
+ """The UUID of the policy"""
approval_groups: Optional[List[ApprovalGroup]] = None
"""Administrators who can approve a temporary authentication request."""
diff --git a/src/cloudflare/types/zero_trust/access/applications/__init__.py b/src/cloudflare/types/zero_trust/access/applications/__init__.py
index f34cf3dac26..206ec39071b 100644
--- a/src/cloudflare/types/zero_trust/access/applications/__init__.py
+++ b/src/cloudflare/types/zero_trust/access/applications/__init__.py
@@ -4,6 +4,16 @@
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
new file mode 100644
index 00000000000..c0a4d7af889
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/applications/ca_create_response.py
@@ -0,0 +1,7 @@
+# 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
new file mode 100644
index 00000000000..1067f82cd87
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/applications/ca_delete_response.py
@@ -0,0 +1,12 @@
+# 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
new file mode 100644
index 00000000000..8a2b05ffa92
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/applications/ca_get_response.py
@@ -0,0 +1,7 @@
+# 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
new file mode 100644
index 00000000000..358425ac3f4
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/applications/policy_create_params.py
@@ -0,0 +1,79 @@
+# 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
new file mode 100644
index 00000000000..733932309f2
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/applications/policy_create_response.py
@@ -0,0 +1,73 @@
+# 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
+ """The UUID of the policy"""
+
+ 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
new file mode 100644
index 00000000000..1d70dce656a
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/applications/policy_delete_response.py
@@ -0,0 +1,12 @@
+# 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
new file mode 100644
index 00000000000..58009c55c07
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/applications/policy_get_response.py
@@ -0,0 +1,73 @@
+# 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
+ """The UUID of the policy"""
+
+ 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
new file mode 100644
index 00000000000..af894ba6981
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/applications/policy_list_response.py
@@ -0,0 +1,73 @@
+# 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
+ """The UUID of the policy"""
+
+ 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
new file mode 100644
index 00000000000..88019eb676e
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/applications/policy_update_params.py
@@ -0,0 +1,82 @@
+# 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):
+ app_id: 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
new file mode 100644
index 00000000000..a3649ba0866
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/applications/policy_update_response.py
@@ -0,0 +1,73 @@
+# 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
+ """The UUID of the policy"""
+
+ 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
new file mode 100644
index 00000000000..5d20f8b964c
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/bookmark.py
@@ -0,0 +1,29 @@
+# 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
new file mode 100644
index 00000000000..a0278f281d7
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/bookmark_create_params.py
@@ -0,0 +1,13 @@
+# 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):
+ account_id: 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
new file mode 100644
index 00000000000..93d03aba051
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/bookmark_delete_response.py
@@ -0,0 +1,12 @@
+# 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
new file mode 100644
index 00000000000..82a32f4b5e0
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/bookmark_update_params.py
@@ -0,0 +1,13 @@
+# 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):
+ account_id: 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
new file mode 100644
index 00000000000..01177266648
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/certificate_delete_response.py
@@ -0,0 +1,12 @@
+# 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
new file mode 100644
index 00000000000..e546c333f21
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/certificate_update_params.py
@@ -0,0 +1,24 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import 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
new file mode 100644
index 00000000000..4593071d37a
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/custom_page.py
@@ -0,0 +1,30 @@
+# 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
new file mode 100644
index 00000000000..585692c65ba
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/custom_page_create_params.py
@@ -0,0 +1,24 @@
+# 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):
+ account_id: 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_delete_response.py b/src/cloudflare/types/zero_trust/access/custom_page_delete_response.py
new file mode 100644
index 00000000000..bb6e38bee3b
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/custom_page_delete_response.py
@@ -0,0 +1,12 @@
+# 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
new file mode 100644
index 00000000000..14d5ec2ca9c
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/custom_page_update_params.py
@@ -0,0 +1,24 @@
+# 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):
+ account_id: 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
new file mode 100644
index 00000000000..d0aecfa61f5
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/custom_page_without_html.py
@@ -0,0 +1,27 @@
+# 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
new file mode 100644
index 00000000000..4f17b96b793
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/group_delete_response.py
@@ -0,0 +1,12 @@
+# 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
new file mode 100644
index 00000000000..68672edb40e
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/group_update_params.py
@@ -0,0 +1,42 @@
+# 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
new file mode 100644
index 00000000000..79cfd988d58
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/key_get_response.py
@@ -0,0 +1,7 @@
+# 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
new file mode 100644
index 00000000000..1ababd82b3c
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/key_rotate_response.py
@@ -0,0 +1,7 @@
+# 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
new file mode 100644
index 00000000000..b42e919649b
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/key_update_params.py
@@ -0,0 +1,15 @@
+# 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):
+ account_id: Required[str]
+ """Identifier"""
+
+ 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
new file mode 100644
index 00000000000..a63396635f6
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/key_update_response.py
@@ -0,0 +1,7 @@
+# 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 f8ee8b14b1c..8044ec713b3 100644
--- a/src/cloudflare/types/zero_trust/access/logs/__init__.py
+++ b/src/cloudflare/types/zero_trust/access/logs/__init__.py
@@ -1,3 +1,6 @@
# 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
new file mode 100644
index 00000000000..b48a60046d9
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/logs/access_request_list_response.py
@@ -0,0 +1,9 @@
+# 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
new file mode 100644
index 00000000000..b4a74bcfc69
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/service_token_rotate_response.py
@@ -0,0 +1,40 @@
+# 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
new file mode 100644
index 00000000000..93dc5d1c5bc
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/service_token_update_params.py
@@ -0,0 +1,25 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import 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
new file mode 100644
index 00000000000..bf386015544
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/tag.py
@@ -0,0 +1,20 @@
+# 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
new file mode 100644
index 00000000000..b28c8a8cc73
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/tag_create_params.py
@@ -0,0 +1,15 @@
+# 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):
+ account_id: Required[str]
+ """Identifier"""
+
+ 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
new file mode 100644
index 00000000000..8ffb88e56bf
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/tag_delete_response.py
@@ -0,0 +1,12 @@
+# 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
new file mode 100644
index 00000000000..594920024fd
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/tag_update_params.py
@@ -0,0 +1,15 @@
+# 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):
+ account_id: 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 f8ee8b14b1c..5f23decf1fe 100644
--- a/src/cloudflare/types/zero_trust/access/users/__init__.py
+++ b/src/cloudflare/types/zero_trust/access/users/__init__.py
@@ -1,3 +1,8 @@
# 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
new file mode 100644
index 00000000000..2414f09a55c
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/users/active_session_get_response.py
@@ -0,0 +1,98 @@
+# 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
new file mode 100644
index 00000000000..ac0f4059a81
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/users/active_session_list_response.py
@@ -0,0 +1,37 @@
+# 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
new file mode 100644
index 00000000000..358f7afc443
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/users/failed_login_list_response.py
@@ -0,0 +1,13 @@
+# 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
new file mode 100644
index 00000000000..52f27fee6c2
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/access/users/identity.py
@@ -0,0 +1,96 @@
+# 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
new file mode 100644
index 00000000000..4c84ce5d197
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/identity_provider_delete_response.py
@@ -0,0 +1,12 @@
+# 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
new file mode 100644
index 00000000000..9667f9f04ba
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/identity_provider_update_params.py
@@ -0,0 +1,697 @@
+# 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
new file mode 100644
index 00000000000..bf56403a543
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/seat.py
@@ -0,0 +1,23 @@
+# 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
new file mode 100644
index 00000000000..5e6696944c1
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/seat_edit_params.py
@@ -0,0 +1,23 @@
+# 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):
+ account_id: Required[str]
+ """Identifier"""
+
+ 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
new file mode 100644
index 00000000000..a29d3feb33b
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/seat_edit_response.py
@@ -0,0 +1,9 @@
+# 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/rulesets/test_rules.py b/tests/api_resources/rulesets/test_rules.py
index 1496d433303..b457e152f24 100644
--- a/tests/api_resources/rulesets/test_rules.py
+++ b/tests/api_resources/rulesets/test_rules.py
@@ -1394,6 +1394,156 @@ 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:
@@ -3072,6 +3222,184 @@ 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"])
@@ -4313,7 +4641,86 @@ async def test_method_create_with_all_params_overload_15(self, async_client: Asy
"respect_strong_etags": True,
"serve_stale": {"disable_stale_while_updating": True},
},
- description="Set cache settings when the hostname address is not example.com",
+ 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"}],
+ },
+ 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},
@@ -4323,7 +4730,7 @@ async def test_method_create_with_all_params_overload_15(self, async_client: Asy
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- async def test_raw_response_create_overload_15(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",
@@ -4336,7 +4743,7 @@ async def test_raw_response_create_overload_15(self, async_client: AsyncCloudfla
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- async def test_streaming_response_create_overload_15(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",
@@ -4351,7 +4758,7 @@ async def test_streaming_response_create_overload_15(self, async_client: AsyncCl
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- async def test_path_params_create_overload_15(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(
"",
@@ -4372,7 +4779,7 @@ async def test_path_params_create_overload_15(self, async_client: AsyncCloudflar
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- async def test_method_create_overload_16(self, async_client: AsyncCloudflare) -> None:
+ async def test_method_create_overload_17(self, async_client: AsyncCloudflare) -> None:
rule = await async_client.rulesets.rules.create(
"2f2feab2026849078ba485f918791bdc",
account_id="string",
@@ -4381,18 +4788,14 @@ async def test_method_create_overload_16(self, async_client: AsyncCloudflare) ->
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- async def test_method_create_with_all_params_overload_16(self, async_client: AsyncCloudflare) -> None:
+ 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="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",
+ 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},
@@ -4402,7 +4805,7 @@ async def test_method_create_with_all_params_overload_16(self, async_client: Asy
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- async def test_raw_response_create_overload_16(self, async_client: AsyncCloudflare) -> None:
+ async def test_raw_response_create_overload_17(self, async_client: AsyncCloudflare) -> None:
response = await async_client.rulesets.rules.with_raw_response.create(
"2f2feab2026849078ba485f918791bdc",
account_id="string",
@@ -4415,7 +4818,7 @@ async def test_raw_response_create_overload_16(self, async_client: AsyncCloudfla
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- async def test_streaming_response_create_overload_16(self, async_client: AsyncCloudflare) -> None:
+ async def test_streaming_response_create_overload_17(self, async_client: AsyncCloudflare) -> None:
async with async_client.rulesets.rules.with_streaming_response.create(
"2f2feab2026849078ba485f918791bdc",
account_id="string",
@@ -4430,7 +4833,82 @@ async def test_streaming_response_create_overload_16(self, async_client: AsyncCl
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- async def test_path_params_create_overload_16(self, async_client: AsyncCloudflare) -> None:
+ async def test_path_params_create_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.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_18(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_18(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.",
+ 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_18(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_18(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_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.create(
"",
@@ -6126,3 +6604,181 @@ 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 e80d89059db..d544d4b922b 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, cast
+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 CA
+from cloudflare.types.zero_trust.access.applications import CA, CAGetResponse, CACreateResponse, CADeleteResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -18,6 +18,73 @@
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 `app_id` 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:
@@ -73,10 +140,211 @@ 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 `app_id` 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 `app_id` 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 `app_id` 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:
@@ -131,3 +399,137 @@ 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 `app_id` 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 `app_id` 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
new file mode 100644
index 00000000000..767aa03ea30
--- /dev/null
+++ b/tests/api_resources/zero_trust/access/applications/test_policies.py
@@ -0,0 +1,1105 @@
+# 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 `app_id` 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",
+ app_id="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",
+ app_id="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",
+ app_id="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",
+ app_id="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 `app_id` but received ''"):
+ client.zero_trust.access.applications.policies.with_raw_response.update(
+ "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ app_id="",
+ 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 `policy_id` but received ''"):
+ client.zero_trust.access.applications.policies.with_raw_response.update(
+ "",
+ app_id="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",
+ app_id="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",
+ app_id="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 `app_id` 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",
+ app_id="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",
+ app_id="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",
+ app_id="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",
+ app_id="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 `app_id` but received ''"):
+ client.zero_trust.access.applications.policies.with_raw_response.delete(
+ "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ app_id="",
+ account_id="string",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"):
+ client.zero_trust.access.applications.policies.with_raw_response.delete(
+ "",
+ app_id="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",
+ app_id="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",
+ app_id="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",
+ app_id="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",
+ app_id="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",
+ app_id="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",
+ app_id="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 `app_id` but received ''"):
+ client.zero_trust.access.applications.policies.with_raw_response.get(
+ "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ app_id="",
+ account_id="string",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"):
+ client.zero_trust.access.applications.policies.with_raw_response.get(
+ "",
+ app_id="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",
+ app_id="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",
+ app_id="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 `app_id` 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",
+ app_id="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",
+ app_id="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",
+ app_id="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",
+ app_id="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 `app_id` but received ''"):
+ await async_client.zero_trust.access.applications.policies.with_raw_response.update(
+ "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ app_id="",
+ 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 `policy_id` but received ''"):
+ await async_client.zero_trust.access.applications.policies.with_raw_response.update(
+ "",
+ app_id="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",
+ app_id="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",
+ app_id="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 `app_id` 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",
+ app_id="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",
+ app_id="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",
+ app_id="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",
+ app_id="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 `app_id` but received ''"):
+ await async_client.zero_trust.access.applications.policies.with_raw_response.delete(
+ "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ app_id="",
+ account_id="string",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"):
+ await async_client.zero_trust.access.applications.policies.with_raw_response.delete(
+ "",
+ app_id="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",
+ app_id="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",
+ app_id="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",
+ app_id="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",
+ app_id="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",
+ app_id="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",
+ app_id="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 `app_id` but received ''"):
+ await async_client.zero_trust.access.applications.policies.with_raw_response.get(
+ "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ app_id="",
+ account_id="string",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"):
+ await async_client.zero_trust.access.applications.policies.with_raw_response.get(
+ "",
+ app_id="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",
+ app_id="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",
+ app_id="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
new file mode 100644
index 00000000000..fd8019a9a1a
--- /dev/null
+++ b/tests/api_resources/zero_trust/access/logs/__init__.py
@@ -0,0 +1 @@
+# 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
new file mode 100644
index 00000000000..88f7703f1a6
--- /dev/null
+++ b/tests/api_resources/zero_trust/access/logs/test_access_requests.py
@@ -0,0 +1,98 @@
+# 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(
+ account_id="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(
+ account_id="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(
+ account_id="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 `account_id` but received ''"):
+ client.zero_trust.access.logs.access_requests.with_raw_response.list(
+ account_id="",
+ )
+
+
+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(
+ account_id="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(
+ account_id="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(
+ account_id="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 `account_id` but received ''"):
+ await async_client.zero_trust.access.logs.access_requests.with_raw_response.list(
+ account_id="",
+ )
diff --git a/tests/api_resources/zero_trust/access/test_applications.py b/tests/api_resources/zero_trust/access/test_applications.py
index df34f66d7ef..299c51d1ce9 100644
--- a/tests/api_resources/zero_trust/access/test_applications.py
+++ b/tests/api_resources/zero_trust/access/test_applications.py
@@ -73,7 +73,20 @@ def test_method_create_with_all_params_overload_1(self, client: Cloudflare) -> N
name="Admin Site",
options_preflight_bypass=True,
path_cookie_attribute=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
same_site_cookie_attribute="strict",
scim_config={
"authentication": {
@@ -203,7 +216,20 @@ def test_method_create_with_all_params_overload_2(self, client: Cloudflare) -> N
],
logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg",
name="Admin Site",
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
saas_app={
"auth_type": "saml",
"consumer_service_url": "https://example.com",
@@ -368,7 +394,20 @@ def test_method_create_with_all_params_overload_3(self, client: Cloudflare) -> N
name="Admin Site",
options_preflight_bypass=True,
path_cookie_attribute=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
same_site_cookie_attribute="strict",
scim_config={
"authentication": {
@@ -520,7 +559,20 @@ def test_method_create_with_all_params_overload_4(self, client: Cloudflare) -> N
name="Admin Site",
options_preflight_bypass=True,
path_cookie_attribute=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
same_site_cookie_attribute="strict",
scim_config={
"authentication": {
@@ -644,7 +696,20 @@ def test_method_create_with_all_params_overload_5(self, client: Cloudflare) -> N
"699d98642c564d2e855e9661899b7252",
],
auto_redirect_to_identity=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
scim_config={
"authentication": {
"password": "string",
@@ -759,7 +824,20 @@ def test_method_create_with_all_params_overload_6(self, client: Cloudflare) -> N
"699d98642c564d2e855e9661899b7252",
],
auto_redirect_to_identity=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
scim_config={
"authentication": {
"password": "string",
@@ -874,7 +952,20 @@ def test_method_create_with_all_params_overload_7(self, client: Cloudflare) -> N
"699d98642c564d2e855e9661899b7252",
],
auto_redirect_to_identity=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
scim_config={
"authentication": {
"password": "string",
@@ -1126,7 +1217,20 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N
name="Admin Site",
options_preflight_bypass=True,
path_cookie_attribute=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
same_site_cookie_attribute="strict",
scim_config={
"authentication": {
@@ -1262,7 +1366,20 @@ def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> N
],
logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg",
name="Admin Site",
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
saas_app={
"auth_type": "saml",
"consumer_service_url": "https://example.com",
@@ -1433,7 +1550,20 @@ def test_method_update_with_all_params_overload_3(self, client: Cloudflare) -> N
name="Admin Site",
options_preflight_bypass=True,
path_cookie_attribute=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
same_site_cookie_attribute="strict",
scim_config={
"authentication": {
@@ -1591,7 +1721,20 @@ def test_method_update_with_all_params_overload_4(self, client: Cloudflare) -> N
name="Admin Site",
options_preflight_bypass=True,
path_cookie_attribute=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
same_site_cookie_attribute="strict",
scim_config={
"authentication": {
@@ -1721,7 +1864,20 @@ def test_method_update_with_all_params_overload_5(self, client: Cloudflare) -> N
"699d98642c564d2e855e9661899b7252",
],
auto_redirect_to_identity=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
scim_config={
"authentication": {
"password": "string",
@@ -1842,7 +1998,20 @@ def test_method_update_with_all_params_overload_6(self, client: Cloudflare) -> N
"699d98642c564d2e855e9661899b7252",
],
auto_redirect_to_identity=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
scim_config={
"authentication": {
"password": "string",
@@ -1963,7 +2132,20 @@ def test_method_update_with_all_params_overload_7(self, client: Cloudflare) -> N
"699d98642c564d2e855e9661899b7252",
],
auto_redirect_to_identity=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
scim_config={
"authentication": {
"password": "string",
@@ -2465,7 +2647,20 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn
name="Admin Site",
options_preflight_bypass=True,
path_cookie_attribute=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
same_site_cookie_attribute="strict",
scim_config={
"authentication": {
@@ -2595,7 +2790,20 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn
],
logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg",
name="Admin Site",
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
saas_app={
"auth_type": "saml",
"consumer_service_url": "https://example.com",
@@ -2760,7 +2968,20 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn
name="Admin Site",
options_preflight_bypass=True,
path_cookie_attribute=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
same_site_cookie_attribute="strict",
scim_config={
"authentication": {
@@ -2912,7 +3133,20 @@ async def test_method_create_with_all_params_overload_4(self, async_client: Asyn
name="Admin Site",
options_preflight_bypass=True,
path_cookie_attribute=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
same_site_cookie_attribute="strict",
scim_config={
"authentication": {
@@ -3036,7 +3270,20 @@ async def test_method_create_with_all_params_overload_5(self, async_client: Asyn
"699d98642c564d2e855e9661899b7252",
],
auto_redirect_to_identity=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
scim_config={
"authentication": {
"password": "string",
@@ -3151,7 +3398,20 @@ async def test_method_create_with_all_params_overload_6(self, async_client: Asyn
"699d98642c564d2e855e9661899b7252",
],
auto_redirect_to_identity=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
scim_config={
"authentication": {
"password": "string",
@@ -3266,7 +3526,20 @@ async def test_method_create_with_all_params_overload_7(self, async_client: Asyn
"699d98642c564d2e855e9661899b7252",
],
auto_redirect_to_identity=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
scim_config={
"authentication": {
"password": "string",
@@ -3518,7 +3791,20 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn
name="Admin Site",
options_preflight_bypass=True,
path_cookie_attribute=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
same_site_cookie_attribute="strict",
scim_config={
"authentication": {
@@ -3654,7 +3940,20 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn
],
logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg",
name="Admin Site",
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
saas_app={
"auth_type": "saml",
"consumer_service_url": "https://example.com",
@@ -3825,7 +4124,20 @@ async def test_method_update_with_all_params_overload_3(self, async_client: Asyn
name="Admin Site",
options_preflight_bypass=True,
path_cookie_attribute=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
same_site_cookie_attribute="strict",
scim_config={
"authentication": {
@@ -3983,7 +4295,20 @@ async def test_method_update_with_all_params_overload_4(self, async_client: Asyn
name="Admin Site",
options_preflight_bypass=True,
path_cookie_attribute=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
same_site_cookie_attribute="strict",
scim_config={
"authentication": {
@@ -4113,7 +4438,20 @@ async def test_method_update_with_all_params_overload_5(self, async_client: Asyn
"699d98642c564d2e855e9661899b7252",
],
auto_redirect_to_identity=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
scim_config={
"authentication": {
"password": "string",
@@ -4234,7 +4572,20 @@ async def test_method_update_with_all_params_overload_6(self, async_client: Asyn
"699d98642c564d2e855e9661899b7252",
],
auto_redirect_to_identity=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
scim_config={
"authentication": {
"password": "string",
@@ -4355,7 +4706,20 @@ async def test_method_update_with_all_params_overload_7(self, async_client: Asyn
"699d98642c564d2e855e9661899b7252",
],
auto_redirect_to_identity=True,
- policies=[{"precedence": 0}, {"precedence": 0}, {"precedence": 0}],
+ policies=[
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ {
+ "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ "precedence": 0,
+ },
+ ],
scim_config={
"authentication": {
"password": "string",
diff --git a/tests/api_resources/zero_trust/access/test_bookmarks.py b/tests/api_resources/zero_trust/access/test_bookmarks.py
new file mode 100644
index 00000000000..5cd16fddf4a
--- /dev/null
+++ b/tests/api_resources/zero_trust/access/test_bookmarks.py
@@ -0,0 +1,506 @@
+# 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",
+ account_id="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",
+ account_id="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",
+ account_id="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 `account_id` but received ''"):
+ client.zero_trust.access.bookmarks.with_raw_response.create(
+ "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ account_id="",
+ body={},
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `bookmark_id` but received ''"):
+ client.zero_trust.access.bookmarks.with_raw_response.create(
+ "",
+ account_id="699d98642c564d2e855e9661899b7252",
+ body={},
+ )
+
+ @parametrize
+ def test_method_update(self, client: Cloudflare) -> None:
+ bookmark = client.zero_trust.access.bookmarks.update(
+ "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ account_id="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",
+ account_id="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",
+ account_id="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 `account_id` but received ''"):
+ client.zero_trust.access.bookmarks.with_raw_response.update(
+ "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ account_id="",
+ body={},
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `bookmark_id` but received ''"):
+ client.zero_trust.access.bookmarks.with_raw_response.update(
+ "",
+ account_id="699d98642c564d2e855e9661899b7252",
+ body={},
+ )
+
+ @parametrize
+ def test_method_list(self, client: Cloudflare) -> None:
+ bookmark = client.zero_trust.access.bookmarks.list(
+ account_id="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(
+ account_id="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(
+ account_id="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 `account_id` but received ''"):
+ client.zero_trust.access.bookmarks.with_raw_response.list(
+ account_id="",
+ )
+
+ @parametrize
+ def test_method_delete(self, client: Cloudflare) -> None:
+ bookmark = client.zero_trust.access.bookmarks.delete(
+ "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ account_id="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",
+ account_id="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",
+ account_id="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 `account_id` but received ''"):
+ client.zero_trust.access.bookmarks.with_raw_response.delete(
+ "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `bookmark_id` but received ''"):
+ client.zero_trust.access.bookmarks.with_raw_response.delete(
+ "",
+ account_id="699d98642c564d2e855e9661899b7252",
+ )
+
+ @parametrize
+ def test_method_get(self, client: Cloudflare) -> None:
+ bookmark = client.zero_trust.access.bookmarks.get(
+ "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ account_id="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",
+ account_id="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",
+ account_id="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 `account_id` but received ''"):
+ client.zero_trust.access.bookmarks.with_raw_response.get(
+ "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `bookmark_id` but received ''"):
+ client.zero_trust.access.bookmarks.with_raw_response.get(
+ "",
+ account_id="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",
+ account_id="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",
+ account_id="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",
+ account_id="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 `account_id` but received ''"):
+ await async_client.zero_trust.access.bookmarks.with_raw_response.create(
+ "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ account_id="",
+ body={},
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `bookmark_id` but received ''"):
+ await async_client.zero_trust.access.bookmarks.with_raw_response.create(
+ "",
+ account_id="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",
+ account_id="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",
+ account_id="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",
+ account_id="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 `account_id` but received ''"):
+ await async_client.zero_trust.access.bookmarks.with_raw_response.update(
+ "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ account_id="",
+ body={},
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `bookmark_id` but received ''"):
+ await async_client.zero_trust.access.bookmarks.with_raw_response.update(
+ "",
+ account_id="699d98642c564d2e855e9661899b7252",
+ body={},
+ )
+
+ @parametrize
+ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
+ bookmark = await async_client.zero_trust.access.bookmarks.list(
+ account_id="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(
+ account_id="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(
+ account_id="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 `account_id` but received ''"):
+ await async_client.zero_trust.access.bookmarks.with_raw_response.list(
+ account_id="",
+ )
+
+ @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",
+ account_id="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",
+ account_id="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",
+ account_id="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 `account_id` but received ''"):
+ await async_client.zero_trust.access.bookmarks.with_raw_response.delete(
+ "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `bookmark_id` but received ''"):
+ await async_client.zero_trust.access.bookmarks.with_raw_response.delete(
+ "",
+ account_id="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",
+ account_id="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",
+ account_id="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",
+ account_id="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 `account_id` but received ''"):
+ await async_client.zero_trust.access.bookmarks.with_raw_response.get(
+ "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `bookmark_id` but received ''"):
+ await async_client.zero_trust.access.bookmarks.with_raw_response.get(
+ "",
+ account_id="699d98642c564d2e855e9661899b7252",
+ )
diff --git a/tests/api_resources/zero_trust/access/test_certificates.py b/tests/api_resources/zero_trust/access/test_certificates.py
index feb21df3ea5..cfcd002940d 100644
--- a/tests/api_resources/zero_trust/access/test_certificates.py
+++ b/tests/api_resources/zero_trust/access/test_certificates.py
@@ -10,7 +10,10 @@
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
+from cloudflare.types.zero_trust.access import (
+ Certificate,
+ CertificateDeleteResponse,
+)
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -86,6 +89,81 @@ 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 `certificate_id` 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:
@@ -141,6 +219,140 @@ 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 `certificate_id` 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 `certificate_id` 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"])
@@ -213,6 +425,81 @@ 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 `certificate_id` 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:
@@ -267,3 +554,137 @@ 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 `certificate_id` 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 `certificate_id` 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
new file mode 100644
index 00000000000..4677021a7a3
--- /dev/null
+++ b/tests/api_resources/zero_trust/access/test_custom_pages.py
@@ -0,0 +1,567 @@
+# 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(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ custom_html="