diff --git a/.stats.yml b/.stats.yml
index a064b0786f7..26db3db11f5 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 1489
+configured_endpoints: 1490
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-d52d1344e2e65f3eda2fe8fff8c7d95cebf7cad134af21eaf9d6d5b6a04d783a.yml
diff --git a/api.md b/api.md
index ae477247385..d276b44b38e 100644
--- a/api.md
+++ b/api.md
@@ -7792,11 +7792,15 @@ Methods:
Types:
```python
-from cloudflare.types.origin_post_quantum_encryption import OriginPostQuantumEncryptionGetResponse
+from cloudflare.types.origin_post_quantum_encryption import (
+ OriginPostQuantumEncryptionEditResponse,
+ OriginPostQuantumEncryptionGetResponse,
+)
```
Methods:
+- client.origin_post_quantum_encryption.edit(\*, zone_id, \*\*params) -> Optional[OriginPostQuantumEncryptionEditResponse]
- client.origin_post_quantum_encryption.get(\*, zone_id) -> Optional[OriginPostQuantumEncryptionGetResponse]
# Speed
diff --git a/src/cloudflare/resources/origin_post_quantum_encryption.py b/src/cloudflare/resources/origin_post_quantum_encryption.py
index 496eaf5495f..a59a30d9108 100644
--- a/src/cloudflare/resources/origin_post_quantum_encryption.py
+++ b/src/cloudflare/resources/origin_post_quantum_encryption.py
@@ -3,10 +3,15 @@
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 (
@@ -17,9 +22,13 @@
)
from .._wrappers import ResultWrapper
from .._base_client import make_request_options
+from ..types.origin_post_quantum_encryption import origin_post_quantum_encryption_edit_params
from ..types.origin_post_quantum_encryption.origin_post_quantum_encryption_get_response import (
OriginPostQuantumEncryptionGetResponse,
)
+from ..types.origin_post_quantum_encryption.origin_post_quantum_encryption_edit_response import (
+ OriginPostQuantumEncryptionEditResponse,
+)
__all__ = ["OriginPostQuantumEncryptionResource", "AsyncOriginPostQuantumEncryptionResource"]
@@ -44,6 +53,59 @@ def with_streaming_response(self) -> OriginPostQuantumEncryptionResourceWithStre
"""
return OriginPostQuantumEncryptionResourceWithStreamingResponse(self)
+ def edit(
+ self,
+ *,
+ zone_id: str,
+ value: Literal["preferred", "supported", "off"],
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this 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[OriginPostQuantumEncryptionEditResponse]:
+ """
+ Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when
+ connecting to your origin. Preferred instructs Cloudflare to opportunistically
+ send a Post-Quantum keyshare in the first message to the origin (for fastest
+ connections when the origin supports and prefers PQ), supported means that PQ
+ algorithms are advertised but only used when requested by the origin, and off
+ means that PQ algorithms are not advertised
+
+ Args:
+ zone_id: Identifier
+
+ value: Value of the Origin Post Quantum Encryption Setting.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters 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 self._patch(
+ f"/zones/{zone_id}/cache/origin_post_quantum_encryption",
+ body=maybe_transform(
+ {"value": value}, origin_post_quantum_encryption_edit_params.OriginPostQuantumEncryptionEditParams
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[OriginPostQuantumEncryptionEditResponse]]._unwrapper,
+ ),
+ cast_to=cast(
+ Type[Optional[OriginPostQuantumEncryptionEditResponse]],
+ ResultWrapper[OriginPostQuantumEncryptionEditResponse],
+ ),
+ )
+
def get(
self,
*,
@@ -112,6 +174,59 @@ def with_streaming_response(self) -> AsyncOriginPostQuantumEncryptionResourceWit
"""
return AsyncOriginPostQuantumEncryptionResourceWithStreamingResponse(self)
+ async def edit(
+ self,
+ *,
+ zone_id: str,
+ value: Literal["preferred", "supported", "off"],
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this 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[OriginPostQuantumEncryptionEditResponse]:
+ """
+ Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when
+ connecting to your origin. Preferred instructs Cloudflare to opportunistically
+ send a Post-Quantum keyshare in the first message to the origin (for fastest
+ connections when the origin supports and prefers PQ), supported means that PQ
+ algorithms are advertised but only used when requested by the origin, and off
+ means that PQ algorithms are not advertised
+
+ Args:
+ zone_id: Identifier
+
+ value: Value of the Origin Post Quantum Encryption Setting.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters 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 await self._patch(
+ f"/zones/{zone_id}/cache/origin_post_quantum_encryption",
+ body=await async_maybe_transform(
+ {"value": value}, origin_post_quantum_encryption_edit_params.OriginPostQuantumEncryptionEditParams
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[OriginPostQuantumEncryptionEditResponse]]._unwrapper,
+ ),
+ cast_to=cast(
+ Type[Optional[OriginPostQuantumEncryptionEditResponse]],
+ ResultWrapper[OriginPostQuantumEncryptionEditResponse],
+ ),
+ )
+
async def get(
self,
*,
@@ -164,6 +279,9 @@ class OriginPostQuantumEncryptionResourceWithRawResponse:
def __init__(self, origin_post_quantum_encryption: OriginPostQuantumEncryptionResource) -> None:
self._origin_post_quantum_encryption = origin_post_quantum_encryption
+ self.edit = to_raw_response_wrapper(
+ origin_post_quantum_encryption.edit,
+ )
self.get = to_raw_response_wrapper(
origin_post_quantum_encryption.get,
)
@@ -173,6 +291,9 @@ class AsyncOriginPostQuantumEncryptionResourceWithRawResponse:
def __init__(self, origin_post_quantum_encryption: AsyncOriginPostQuantumEncryptionResource) -> None:
self._origin_post_quantum_encryption = origin_post_quantum_encryption
+ self.edit = async_to_raw_response_wrapper(
+ origin_post_quantum_encryption.edit,
+ )
self.get = async_to_raw_response_wrapper(
origin_post_quantum_encryption.get,
)
@@ -182,6 +303,9 @@ class OriginPostQuantumEncryptionResourceWithStreamingResponse:
def __init__(self, origin_post_quantum_encryption: OriginPostQuantumEncryptionResource) -> None:
self._origin_post_quantum_encryption = origin_post_quantum_encryption
+ self.edit = to_streamed_response_wrapper(
+ origin_post_quantum_encryption.edit,
+ )
self.get = to_streamed_response_wrapper(
origin_post_quantum_encryption.get,
)
@@ -191,6 +315,9 @@ class AsyncOriginPostQuantumEncryptionResourceWithStreamingResponse:
def __init__(self, origin_post_quantum_encryption: AsyncOriginPostQuantumEncryptionResource) -> None:
self._origin_post_quantum_encryption = origin_post_quantum_encryption
+ self.edit = async_to_streamed_response_wrapper(
+ origin_post_quantum_encryption.edit,
+ )
self.get = async_to_streamed_response_wrapper(
origin_post_quantum_encryption.get,
)
diff --git a/src/cloudflare/types/origin_post_quantum_encryption/__init__.py b/src/cloudflare/types/origin_post_quantum_encryption/__init__.py
index 273631df76f..2b3fa07fabc 100644
--- a/src/cloudflare/types/origin_post_quantum_encryption/__init__.py
+++ b/src/cloudflare/types/origin_post_quantum_encryption/__init__.py
@@ -2,6 +2,12 @@
from __future__ import annotations
+from .origin_post_quantum_encryption_edit_params import (
+ OriginPostQuantumEncryptionEditParams as OriginPostQuantumEncryptionEditParams,
+)
from .origin_post_quantum_encryption_get_response import (
OriginPostQuantumEncryptionGetResponse as OriginPostQuantumEncryptionGetResponse,
)
+from .origin_post_quantum_encryption_edit_response import (
+ OriginPostQuantumEncryptionEditResponse as OriginPostQuantumEncryptionEditResponse,
+)
diff --git a/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_edit_params.py b/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_edit_params.py
new file mode 100644
index 00000000000..ff276589cf3
--- /dev/null
+++ b/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_edit_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 Literal, Required, TypedDict
+
+__all__ = ["OriginPostQuantumEncryptionEditParams"]
+
+
+class OriginPostQuantumEncryptionEditParams(TypedDict, total=False):
+ zone_id: Required[str]
+ """Identifier"""
+
+ value: Required[Literal["preferred", "supported", "off"]]
+ """Value of the Origin Post Quantum Encryption Setting."""
diff --git a/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_edit_response.py b/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_edit_response.py
new file mode 100644
index 00000000000..34c81bb373e
--- /dev/null
+++ b/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_edit_response.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 typing_extensions import Literal
+
+from ..._models import BaseModel
+
+__all__ = ["OriginPostQuantumEncryptionEditResponse"]
+
+
+class OriginPostQuantumEncryptionEditResponse(BaseModel):
+ id: Literal["origin_pqe"]
+ """Value of the zone setting."""
+
+ editable: bool
+ """Whether the setting is editable"""
+
+ value: Literal["preferred", "supported", "off"]
+ """The value of the feature"""
+
+ modified_on: Optional[datetime] = None
+ """Last time this setting was modified."""
diff --git a/tests/api_resources/test_origin_post_quantum_encryption.py b/tests/api_resources/test_origin_post_quantum_encryption.py
index 68dff01d3e0..c3be9266319 100644
--- a/tests/api_resources/test_origin_post_quantum_encryption.py
+++ b/tests/api_resources/test_origin_post_quantum_encryption.py
@@ -9,7 +9,10 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
-from cloudflare.types.origin_post_quantum_encryption import OriginPostQuantumEncryptionGetResponse
+from cloudflare.types.origin_post_quantum_encryption import (
+ OriginPostQuantumEncryptionGetResponse,
+ OriginPostQuantumEncryptionEditResponse,
+)
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -17,6 +20,58 @@
class TestOriginPostQuantumEncryption:
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+ @pytest.mark.skip(reason="TODO: investigate broken test")
+ @parametrize
+ def test_method_edit(self, client: Cloudflare) -> None:
+ origin_post_quantum_encryption = client.origin_post_quantum_encryption.edit(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ value="preferred",
+ )
+ assert_matches_type(
+ Optional[OriginPostQuantumEncryptionEditResponse], origin_post_quantum_encryption, path=["response"]
+ )
+
+ @pytest.mark.skip(reason="TODO: investigate broken test")
+ @parametrize
+ def test_raw_response_edit(self, client: Cloudflare) -> None:
+ response = client.origin_post_quantum_encryption.with_raw_response.edit(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ value="preferred",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ origin_post_quantum_encryption = response.parse()
+ assert_matches_type(
+ Optional[OriginPostQuantumEncryptionEditResponse], origin_post_quantum_encryption, path=["response"]
+ )
+
+ @pytest.mark.skip(reason="TODO: investigate broken test")
+ @parametrize
+ def test_streaming_response_edit(self, client: Cloudflare) -> None:
+ with client.origin_post_quantum_encryption.with_streaming_response.edit(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ value="preferred",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ origin_post_quantum_encryption = response.parse()
+ assert_matches_type(
+ Optional[OriginPostQuantumEncryptionEditResponse], origin_post_quantum_encryption, path=["response"]
+ )
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="TODO: investigate broken test")
+ @parametrize
+ def test_path_params_edit(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
+ client.origin_post_quantum_encryption.with_raw_response.edit(
+ zone_id="",
+ value="preferred",
+ )
+
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
def test_method_get(self, client: Cloudflare) -> None:
@@ -69,6 +124,58 @@ def test_path_params_get(self, client: Cloudflare) -> None:
class TestAsyncOriginPostQuantumEncryption:
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+ @pytest.mark.skip(reason="TODO: investigate broken test")
+ @parametrize
+ async def test_method_edit(self, async_client: AsyncCloudflare) -> None:
+ origin_post_quantum_encryption = await async_client.origin_post_quantum_encryption.edit(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ value="preferred",
+ )
+ assert_matches_type(
+ Optional[OriginPostQuantumEncryptionEditResponse], origin_post_quantum_encryption, path=["response"]
+ )
+
+ @pytest.mark.skip(reason="TODO: investigate broken test")
+ @parametrize
+ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.origin_post_quantum_encryption.with_raw_response.edit(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ value="preferred",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ origin_post_quantum_encryption = await response.parse()
+ assert_matches_type(
+ Optional[OriginPostQuantumEncryptionEditResponse], origin_post_quantum_encryption, path=["response"]
+ )
+
+ @pytest.mark.skip(reason="TODO: investigate broken test")
+ @parametrize
+ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.origin_post_quantum_encryption.with_streaming_response.edit(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ value="preferred",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ origin_post_quantum_encryption = await response.parse()
+ assert_matches_type(
+ Optional[OriginPostQuantumEncryptionEditResponse], origin_post_quantum_encryption, path=["response"]
+ )
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="TODO: investigate broken test")
+ @parametrize
+ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
+ await async_client.origin_post_quantum_encryption.with_raw_response.edit(
+ zone_id="",
+ value="preferred",
+ )
+
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
async def test_method_get(self, async_client: AsyncCloudflare) -> None: