diff --git a/.stats.yml b/.stats.yml
index 72b7f7f18cd..9c18a37e254 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 1449
+configured_endpoints: 1451
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-1c6fe7515b7879a7cd51bbe9433aeee5d3d30feaf519f42d0d81c64b19f45875.yml
diff --git a/api.md b/api.md
index 69a87977345..bb647e900c2 100644
--- a/api.md
+++ b/api.md
@@ -4960,6 +4960,22 @@ Methods:
- client.zero_trust.devices.policies.default.fallback_domains.update(\*, account_id, \*\*params) -> Optional
- client.zero_trust.devices.policies.default.fallback_domains.get(\*, account_id) -> Optional
+##### Certificates
+
+Types:
+
+```python
+from cloudflare.types.zero_trust.devices.policies.default import (
+ CertificateEditResponse,
+ CertificateGetResponse,
+)
+```
+
+Methods:
+
+- client.zero_trust.devices.policies.default.certificates.edit(\*, zone_id, \*\*params) -> CertificateEditResponse
+- client.zero_trust.devices.policies.default.certificates.get(\*, zone_id) -> CertificateGetResponse
+
#### Custom
Types:
diff --git a/src/cloudflare/resources/zero_trust/devices/policies/default/__init__.py b/src/cloudflare/resources/zero_trust/devices/policies/default/__init__.py
index 8189ffe02c5..c22a715e1e2 100644
--- a/src/cloudflare/resources/zero_trust/devices/policies/default/__init__.py
+++ b/src/cloudflare/resources/zero_trust/devices/policies/default/__init__.py
@@ -24,6 +24,14 @@
IncludesResourceWithStreamingResponse,
AsyncIncludesResourceWithStreamingResponse,
)
+from .certificates import (
+ CertificatesResource,
+ AsyncCertificatesResource,
+ CertificatesResourceWithRawResponse,
+ AsyncCertificatesResourceWithRawResponse,
+ CertificatesResourceWithStreamingResponse,
+ AsyncCertificatesResourceWithStreamingResponse,
+)
from .fallback_domains import (
FallbackDomainsResource,
AsyncFallbackDomainsResource,
@@ -52,6 +60,12 @@
"AsyncFallbackDomainsResourceWithRawResponse",
"FallbackDomainsResourceWithStreamingResponse",
"AsyncFallbackDomainsResourceWithStreamingResponse",
+ "CertificatesResource",
+ "AsyncCertificatesResource",
+ "CertificatesResourceWithRawResponse",
+ "AsyncCertificatesResourceWithRawResponse",
+ "CertificatesResourceWithStreamingResponse",
+ "AsyncCertificatesResourceWithStreamingResponse",
"DefaultResource",
"AsyncDefaultResource",
"DefaultResourceWithRawResponse",
diff --git a/src/cloudflare/resources/zero_trust/devices/policies/default/certificates.py b/src/cloudflare/resources/zero_trust/devices/policies/default/certificates.py
new file mode 100644
index 00000000000..1996ac06b92
--- /dev/null
+++ b/src/cloudflare/resources/zero_trust/devices/policies/default/certificates.py
@@ -0,0 +1,300 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Any, 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.devices.policies.default import certificate_edit_params
+from ......types.zero_trust.devices.policies.default.certificate_get_response import CertificateGetResponse
+from ......types.zero_trust.devices.policies.default.certificate_edit_response import CertificateEditResponse
+
+__all__ = ["CertificatesResource", "AsyncCertificatesResource"]
+
+
+class CertificatesResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> CertificatesResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return CertificatesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> CertificatesResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return CertificatesResourceWithStreamingResponse(self)
+
+ def edit(
+ self,
+ *,
+ zone_id: str,
+ enabled: bool,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> CertificateEditResponse:
+ """
+ Enable Zero Trust Clients to provision a certificate, containing a x509 subject,
+ and referenced by Access device posture policies when the client visits MTLS
+ protected domains. This facilitates device posture without a WARP session.
+
+ Args:
+ enabled: The current status of the device policy certificate provisioning feature for
+ WARP clients.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters 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 zone_id:
+ raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
+ return cast(
+ CertificateEditResponse,
+ self._patch(
+ f"/zones/{zone_id}/devices/policy/certificates",
+ body=maybe_transform({"enabled": enabled}, certificate_edit_params.CertificateEditParams),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[CertificateEditResponse]._unwrapper,
+ ),
+ cast_to=cast(
+ Any, ResultWrapper[CertificateEditResponse]
+ ), # Union types cannot be passed in as arguments in the type system
+ ),
+ )
+
+ def get(
+ self,
+ *,
+ zone_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,
+ ) -> CertificateGetResponse:
+ """
+ Fetches device certificate provisioning
+
+ 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 zone_id:
+ raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
+ return cast(
+ CertificateGetResponse,
+ self._get(
+ f"/zones/{zone_id}/devices/policy/certificates",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[CertificateGetResponse]._unwrapper,
+ ),
+ cast_to=cast(
+ Any, ResultWrapper[CertificateGetResponse]
+ ), # Union types cannot be passed in as arguments in the type system
+ ),
+ )
+
+
+class AsyncCertificatesResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncCertificatesResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncCertificatesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncCertificatesResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return AsyncCertificatesResourceWithStreamingResponse(self)
+
+ async def edit(
+ self,
+ *,
+ zone_id: str,
+ enabled: bool,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> CertificateEditResponse:
+ """
+ Enable Zero Trust Clients to provision a certificate, containing a x509 subject,
+ and referenced by Access device posture policies when the client visits MTLS
+ protected domains. This facilitates device posture without a WARP session.
+
+ Args:
+ enabled: The current status of the device policy certificate provisioning feature for
+ WARP clients.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters 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 zone_id:
+ raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
+ return cast(
+ CertificateEditResponse,
+ await self._patch(
+ f"/zones/{zone_id}/devices/policy/certificates",
+ body=await async_maybe_transform({"enabled": enabled}, certificate_edit_params.CertificateEditParams),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[CertificateEditResponse]._unwrapper,
+ ),
+ cast_to=cast(
+ Any, ResultWrapper[CertificateEditResponse]
+ ), # Union types cannot be passed in as arguments in the type system
+ ),
+ )
+
+ async def get(
+ self,
+ *,
+ zone_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,
+ ) -> CertificateGetResponse:
+ """
+ Fetches device certificate provisioning
+
+ 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 zone_id:
+ raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
+ return cast(
+ CertificateGetResponse,
+ await self._get(
+ f"/zones/{zone_id}/devices/policy/certificates",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[CertificateGetResponse]._unwrapper,
+ ),
+ cast_to=cast(
+ Any, ResultWrapper[CertificateGetResponse]
+ ), # Union types cannot be passed in as arguments in the type system
+ ),
+ )
+
+
+class CertificatesResourceWithRawResponse:
+ def __init__(self, certificates: CertificatesResource) -> None:
+ self._certificates = certificates
+
+ self.edit = to_raw_response_wrapper(
+ certificates.edit,
+ )
+ self.get = to_raw_response_wrapper(
+ certificates.get,
+ )
+
+
+class AsyncCertificatesResourceWithRawResponse:
+ def __init__(self, certificates: AsyncCertificatesResource) -> None:
+ self._certificates = certificates
+
+ self.edit = async_to_raw_response_wrapper(
+ certificates.edit,
+ )
+ self.get = async_to_raw_response_wrapper(
+ certificates.get,
+ )
+
+
+class CertificatesResourceWithStreamingResponse:
+ def __init__(self, certificates: CertificatesResource) -> None:
+ self._certificates = certificates
+
+ self.edit = to_streamed_response_wrapper(
+ certificates.edit,
+ )
+ self.get = to_streamed_response_wrapper(
+ certificates.get,
+ )
+
+
+class AsyncCertificatesResourceWithStreamingResponse:
+ def __init__(self, certificates: AsyncCertificatesResource) -> None:
+ self._certificates = certificates
+
+ self.edit = async_to_streamed_response_wrapper(
+ certificates.edit,
+ )
+ self.get = async_to_streamed_response_wrapper(
+ certificates.get,
+ )
diff --git a/src/cloudflare/resources/zero_trust/devices/policies/default/default.py b/src/cloudflare/resources/zero_trust/devices/policies/default/default.py
index 1c8ce73a1de..5c0f7e71e53 100644
--- a/src/cloudflare/resources/zero_trust/devices/policies/default/default.py
+++ b/src/cloudflare/resources/zero_trust/devices/policies/default/default.py
@@ -28,6 +28,14 @@
async_maybe_transform,
)
from ......_compat import cached_property
+from .certificates import (
+ CertificatesResource,
+ AsyncCertificatesResource,
+ CertificatesResourceWithRawResponse,
+ AsyncCertificatesResourceWithRawResponse,
+ CertificatesResourceWithStreamingResponse,
+ AsyncCertificatesResourceWithStreamingResponse,
+)
from ......_resource import SyncAPIResource, AsyncAPIResource
from ......_response import (
to_raw_response_wrapper,
@@ -65,6 +73,10 @@ def includes(self) -> IncludesResource:
def fallback_domains(self) -> FallbackDomainsResource:
return FallbackDomainsResource(self._client)
+ @cached_property
+ def certificates(self) -> CertificatesResource:
+ return CertificatesResource(self._client)
+
@cached_property
def with_raw_response(self) -> DefaultResourceWithRawResponse:
"""
@@ -222,6 +234,10 @@ def includes(self) -> AsyncIncludesResource:
def fallback_domains(self) -> AsyncFallbackDomainsResource:
return AsyncFallbackDomainsResource(self._client)
+ @cached_property
+ def certificates(self) -> AsyncCertificatesResource:
+ return AsyncCertificatesResource(self._client)
+
@cached_property
def with_raw_response(self) -> AsyncDefaultResourceWithRawResponse:
"""
@@ -389,6 +405,10 @@ def includes(self) -> IncludesResourceWithRawResponse:
def fallback_domains(self) -> FallbackDomainsResourceWithRawResponse:
return FallbackDomainsResourceWithRawResponse(self._default.fallback_domains)
+ @cached_property
+ def certificates(self) -> CertificatesResourceWithRawResponse:
+ return CertificatesResourceWithRawResponse(self._default.certificates)
+
class AsyncDefaultResourceWithRawResponse:
def __init__(self, default: AsyncDefaultResource) -> None:
@@ -413,6 +433,10 @@ def includes(self) -> AsyncIncludesResourceWithRawResponse:
def fallback_domains(self) -> AsyncFallbackDomainsResourceWithRawResponse:
return AsyncFallbackDomainsResourceWithRawResponse(self._default.fallback_domains)
+ @cached_property
+ def certificates(self) -> AsyncCertificatesResourceWithRawResponse:
+ return AsyncCertificatesResourceWithRawResponse(self._default.certificates)
+
class DefaultResourceWithStreamingResponse:
def __init__(self, default: DefaultResource) -> None:
@@ -437,6 +461,10 @@ def includes(self) -> IncludesResourceWithStreamingResponse:
def fallback_domains(self) -> FallbackDomainsResourceWithStreamingResponse:
return FallbackDomainsResourceWithStreamingResponse(self._default.fallback_domains)
+ @cached_property
+ def certificates(self) -> CertificatesResourceWithStreamingResponse:
+ return CertificatesResourceWithStreamingResponse(self._default.certificates)
+
class AsyncDefaultResourceWithStreamingResponse:
def __init__(self, default: AsyncDefaultResource) -> None:
@@ -460,3 +488,7 @@ def includes(self) -> AsyncIncludesResourceWithStreamingResponse:
@cached_property
def fallback_domains(self) -> AsyncFallbackDomainsResourceWithStreamingResponse:
return AsyncFallbackDomainsResourceWithStreamingResponse(self._default.fallback_domains)
+
+ @cached_property
+ def certificates(self) -> AsyncCertificatesResourceWithStreamingResponse:
+ return AsyncCertificatesResourceWithStreamingResponse(self._default.certificates)
diff --git a/src/cloudflare/types/zero_trust/devices/policies/default/__init__.py b/src/cloudflare/types/zero_trust/devices/policies/default/__init__.py
index cb8c3df70ca..02bf1198370 100644
--- a/src/cloudflare/types/zero_trust/devices/policies/default/__init__.py
+++ b/src/cloudflare/types/zero_trust/devices/policies/default/__init__.py
@@ -6,8 +6,11 @@
from .include_get_response import IncludeGetResponse as IncludeGetResponse
from .exclude_update_params import ExcludeUpdateParams as ExcludeUpdateParams
from .include_update_params import IncludeUpdateParams as IncludeUpdateParams
+from .certificate_edit_params import CertificateEditParams as CertificateEditParams
from .exclude_update_response import ExcludeUpdateResponse as ExcludeUpdateResponse
from .include_update_response import IncludeUpdateResponse as IncludeUpdateResponse
+from .certificate_get_response import CertificateGetResponse as CertificateGetResponse
+from .certificate_edit_response import CertificateEditResponse as CertificateEditResponse
from .fallback_domain_get_response import FallbackDomainGetResponse as FallbackDomainGetResponse
from .fallback_domain_update_params import FallbackDomainUpdateParams as FallbackDomainUpdateParams
from .fallback_domain_update_response import FallbackDomainUpdateResponse as FallbackDomainUpdateResponse
diff --git a/src/cloudflare/types/zero_trust/devices/policies/default/certificate_edit_params.py b/src/cloudflare/types/zero_trust/devices/policies/default/certificate_edit_params.py
new file mode 100644
index 00000000000..5660da8891b
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/devices/policies/default/certificate_edit_params.py
@@ -0,0 +1,17 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Required, TypedDict
+
+__all__ = ["CertificateEditParams"]
+
+
+class CertificateEditParams(TypedDict, total=False):
+ zone_id: Required[str]
+
+ enabled: Required[bool]
+ """
+ The current status of the device policy certificate provisioning feature for
+ WARP clients.
+ """
diff --git a/src/cloudflare/types/zero_trust/devices/policies/default/certificate_edit_response.py b/src/cloudflare/types/zero_trust/devices/policies/default/certificate_edit_response.py
new file mode 100644
index 00000000000..0cd113c6420
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/devices/policies/default/certificate_edit_response.py
@@ -0,0 +1,8 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Union, Optional
+from typing_extensions import TypeAlias
+
+__all__ = ["CertificateEditResponse"]
+
+CertificateEditResponse: TypeAlias = Union[Optional[str], Optional[object]]
diff --git a/src/cloudflare/types/zero_trust/devices/policies/default/certificate_get_response.py b/src/cloudflare/types/zero_trust/devices/policies/default/certificate_get_response.py
new file mode 100644
index 00000000000..055be51f531
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/devices/policies/default/certificate_get_response.py
@@ -0,0 +1,8 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Union, Optional
+from typing_extensions import TypeAlias
+
+__all__ = ["CertificateGetResponse"]
+
+CertificateGetResponse: TypeAlias = Union[Optional[str], Optional[object]]
diff --git a/tests/api_resources/zero_trust/devices/policies/default/test_certificates.py b/tests/api_resources/zero_trust/devices/policies/default/test_certificates.py
new file mode 100644
index 00000000000..f616978a857
--- /dev/null
+++ b/tests/api_resources/zero_trust/devices/policies/default/test_certificates.py
@@ -0,0 +1,185 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare.types.zero_trust.devices.policies.default import (
+ CertificateGetResponse,
+ CertificateEditResponse,
+)
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestCertificates:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_edit(self, client: Cloudflare) -> None:
+ certificate = client.zero_trust.devices.policies.default.certificates.edit(
+ zone_id="699d98642c564d2e855e9661899b7252",
+ enabled=True,
+ )
+ assert_matches_type(CertificateEditResponse, certificate, path=["response"])
+
+ @parametrize
+ def test_raw_response_edit(self, client: Cloudflare) -> None:
+ response = client.zero_trust.devices.policies.default.certificates.with_raw_response.edit(
+ zone_id="699d98642c564d2e855e9661899b7252",
+ enabled=True,
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ certificate = response.parse()
+ assert_matches_type(CertificateEditResponse, certificate, path=["response"])
+
+ @parametrize
+ def test_streaming_response_edit(self, client: Cloudflare) -> None:
+ with client.zero_trust.devices.policies.default.certificates.with_streaming_response.edit(
+ zone_id="699d98642c564d2e855e9661899b7252",
+ enabled=True,
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ certificate = response.parse()
+ assert_matches_type(CertificateEditResponse, certificate, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_edit(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
+ client.zero_trust.devices.policies.default.certificates.with_raw_response.edit(
+ zone_id="",
+ enabled=True,
+ )
+
+ @parametrize
+ def test_method_get(self, client: Cloudflare) -> None:
+ certificate = client.zero_trust.devices.policies.default.certificates.get(
+ zone_id="699d98642c564d2e855e9661899b7252",
+ )
+ assert_matches_type(CertificateGetResponse, certificate, path=["response"])
+
+ @parametrize
+ def test_raw_response_get(self, client: Cloudflare) -> None:
+ response = client.zero_trust.devices.policies.default.certificates.with_raw_response.get(
+ zone_id="699d98642c564d2e855e9661899b7252",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ certificate = response.parse()
+ assert_matches_type(CertificateGetResponse, certificate, path=["response"])
+
+ @parametrize
+ def test_streaming_response_get(self, client: Cloudflare) -> None:
+ with client.zero_trust.devices.policies.default.certificates.with_streaming_response.get(
+ zone_id="699d98642c564d2e855e9661899b7252",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ certificate = response.parse()
+ assert_matches_type(CertificateGetResponse, certificate, 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 `zone_id` but received ''"):
+ client.zero_trust.devices.policies.default.certificates.with_raw_response.get(
+ zone_id="",
+ )
+
+
+class TestAsyncCertificates:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_edit(self, async_client: AsyncCloudflare) -> None:
+ certificate = await async_client.zero_trust.devices.policies.default.certificates.edit(
+ zone_id="699d98642c564d2e855e9661899b7252",
+ enabled=True,
+ )
+ assert_matches_type(CertificateEditResponse, certificate, path=["response"])
+
+ @parametrize
+ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.zero_trust.devices.policies.default.certificates.with_raw_response.edit(
+ zone_id="699d98642c564d2e855e9661899b7252",
+ enabled=True,
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ certificate = await response.parse()
+ assert_matches_type(CertificateEditResponse, certificate, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.zero_trust.devices.policies.default.certificates.with_streaming_response.edit(
+ zone_id="699d98642c564d2e855e9661899b7252",
+ enabled=True,
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ certificate = await response.parse()
+ assert_matches_type(CertificateEditResponse, certificate, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
+ await async_client.zero_trust.devices.policies.default.certificates.with_raw_response.edit(
+ zone_id="",
+ enabled=True,
+ )
+
+ @parametrize
+ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
+ certificate = await async_client.zero_trust.devices.policies.default.certificates.get(
+ zone_id="699d98642c564d2e855e9661899b7252",
+ )
+ assert_matches_type(CertificateGetResponse, certificate, path=["response"])
+
+ @parametrize
+ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.zero_trust.devices.policies.default.certificates.with_raw_response.get(
+ zone_id="699d98642c564d2e855e9661899b7252",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ certificate = await response.parse()
+ assert_matches_type(CertificateGetResponse, certificate, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.zero_trust.devices.policies.default.certificates.with_streaming_response.get(
+ zone_id="699d98642c564d2e855e9661899b7252",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ certificate = await response.parse()
+ assert_matches_type(CertificateGetResponse, certificate, 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 `zone_id` but received ''"):
+ await async_client.zero_trust.devices.policies.default.certificates.with_raw_response.get(
+ zone_id="",
+ )