33from __future__ import annotations
44
55from typing import Type , Optional , cast
6+ from typing_extensions import Literal
67
78import httpx
89
910from .._types import NOT_GIVEN , Body , Query , Headers , NotGiven
11+ from .._utils import (
12+ maybe_transform ,
13+ async_maybe_transform ,
14+ )
1015from .._compat import cached_property
1116from .._resource import SyncAPIResource , AsyncAPIResource
1217from .._response import (
1722)
1823from .._wrappers import ResultWrapper
1924from .._base_client import make_request_options
25+ from ..types .origin_post_quantum_encryption import origin_post_quantum_encryption_edit_params
2026from ..types .origin_post_quantum_encryption .origin_post_quantum_encryption_get_response import (
2127 OriginPostQuantumEncryptionGetResponse ,
2228)
29+ from ..types .origin_post_quantum_encryption .origin_post_quantum_encryption_edit_response import (
30+ OriginPostQuantumEncryptionEditResponse ,
31+ )
2332
2433__all__ = ["OriginPostQuantumEncryptionResource" , "AsyncOriginPostQuantumEncryptionResource" ]
2534
@@ -44,6 +53,59 @@ def with_streaming_response(self) -> OriginPostQuantumEncryptionResourceWithStre
4453 """
4554 return OriginPostQuantumEncryptionResourceWithStreamingResponse (self )
4655
56+ def edit (
57+ self ,
58+ * ,
59+ zone_id : str ,
60+ value : Literal ["preferred" , "supported" , "off" ],
61+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
62+ # The extra values given here take precedence over values defined on the client or passed to this method.
63+ extra_headers : Headers | None = None ,
64+ extra_query : Query | None = None ,
65+ extra_body : Body | None = None ,
66+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
67+ ) -> Optional [OriginPostQuantumEncryptionEditResponse ]:
68+ """
69+ Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when
70+ connecting to your origin. Preferred instructs Cloudflare to opportunistically
71+ send a Post-Quantum keyshare in the first message to the origin (for fastest
72+ connections when the origin supports and prefers PQ), supported means that PQ
73+ algorithms are advertised but only used when requested by the origin, and off
74+ means that PQ algorithms are not advertised
75+
76+ Args:
77+ zone_id: Identifier
78+
79+ value: Value of the Origin Post Quantum Encryption Setting.
80+
81+ extra_headers: Send extra headers
82+
83+ extra_query: Add additional query parameters to the request
84+
85+ extra_body: Add additional JSON properties to the request
86+
87+ timeout: Override the client-level default timeout for this request, in seconds
88+ """
89+ if not zone_id :
90+ raise ValueError (f"Expected a non-empty value for `zone_id` but received { zone_id !r} " )
91+ return self ._patch (
92+ f"/zones/{ zone_id } /cache/origin_post_quantum_encryption" ,
93+ body = maybe_transform (
94+ {"value" : value }, origin_post_quantum_encryption_edit_params .OriginPostQuantumEncryptionEditParams
95+ ),
96+ options = make_request_options (
97+ extra_headers = extra_headers ,
98+ extra_query = extra_query ,
99+ extra_body = extra_body ,
100+ timeout = timeout ,
101+ post_parser = ResultWrapper [Optional [OriginPostQuantumEncryptionEditResponse ]]._unwrapper ,
102+ ),
103+ cast_to = cast (
104+ Type [Optional [OriginPostQuantumEncryptionEditResponse ]],
105+ ResultWrapper [OriginPostQuantumEncryptionEditResponse ],
106+ ),
107+ )
108+
47109 def get (
48110 self ,
49111 * ,
@@ -112,6 +174,59 @@ def with_streaming_response(self) -> AsyncOriginPostQuantumEncryptionResourceWit
112174 """
113175 return AsyncOriginPostQuantumEncryptionResourceWithStreamingResponse (self )
114176
177+ async def edit (
178+ self ,
179+ * ,
180+ zone_id : str ,
181+ value : Literal ["preferred" , "supported" , "off" ],
182+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
183+ # The extra values given here take precedence over values defined on the client or passed to this method.
184+ extra_headers : Headers | None = None ,
185+ extra_query : Query | None = None ,
186+ extra_body : Body | None = None ,
187+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
188+ ) -> Optional [OriginPostQuantumEncryptionEditResponse ]:
189+ """
190+ Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when
191+ connecting to your origin. Preferred instructs Cloudflare to opportunistically
192+ send a Post-Quantum keyshare in the first message to the origin (for fastest
193+ connections when the origin supports and prefers PQ), supported means that PQ
194+ algorithms are advertised but only used when requested by the origin, and off
195+ means that PQ algorithms are not advertised
196+
197+ Args:
198+ zone_id: Identifier
199+
200+ value: Value of the Origin Post Quantum Encryption Setting.
201+
202+ extra_headers: Send extra headers
203+
204+ extra_query: Add additional query parameters to the request
205+
206+ extra_body: Add additional JSON properties to the request
207+
208+ timeout: Override the client-level default timeout for this request, in seconds
209+ """
210+ if not zone_id :
211+ raise ValueError (f"Expected a non-empty value for `zone_id` but received { zone_id !r} " )
212+ return await self ._patch (
213+ f"/zones/{ zone_id } /cache/origin_post_quantum_encryption" ,
214+ body = await async_maybe_transform (
215+ {"value" : value }, origin_post_quantum_encryption_edit_params .OriginPostQuantumEncryptionEditParams
216+ ),
217+ options = make_request_options (
218+ extra_headers = extra_headers ,
219+ extra_query = extra_query ,
220+ extra_body = extra_body ,
221+ timeout = timeout ,
222+ post_parser = ResultWrapper [Optional [OriginPostQuantumEncryptionEditResponse ]]._unwrapper ,
223+ ),
224+ cast_to = cast (
225+ Type [Optional [OriginPostQuantumEncryptionEditResponse ]],
226+ ResultWrapper [OriginPostQuantumEncryptionEditResponse ],
227+ ),
228+ )
229+
115230 async def get (
116231 self ,
117232 * ,
@@ -164,6 +279,9 @@ class OriginPostQuantumEncryptionResourceWithRawResponse:
164279 def __init__ (self , origin_post_quantum_encryption : OriginPostQuantumEncryptionResource ) -> None :
165280 self ._origin_post_quantum_encryption = origin_post_quantum_encryption
166281
282+ self .edit = to_raw_response_wrapper (
283+ origin_post_quantum_encryption .edit ,
284+ )
167285 self .get = to_raw_response_wrapper (
168286 origin_post_quantum_encryption .get ,
169287 )
@@ -173,6 +291,9 @@ class AsyncOriginPostQuantumEncryptionResourceWithRawResponse:
173291 def __init__ (self , origin_post_quantum_encryption : AsyncOriginPostQuantumEncryptionResource ) -> None :
174292 self ._origin_post_quantum_encryption = origin_post_quantum_encryption
175293
294+ self .edit = async_to_raw_response_wrapper (
295+ origin_post_quantum_encryption .edit ,
296+ )
176297 self .get = async_to_raw_response_wrapper (
177298 origin_post_quantum_encryption .get ,
178299 )
@@ -182,6 +303,9 @@ class OriginPostQuantumEncryptionResourceWithStreamingResponse:
182303 def __init__ (self , origin_post_quantum_encryption : OriginPostQuantumEncryptionResource ) -> None :
183304 self ._origin_post_quantum_encryption = origin_post_quantum_encryption
184305
306+ self .edit = to_streamed_response_wrapper (
307+ origin_post_quantum_encryption .edit ,
308+ )
185309 self .get = to_streamed_response_wrapper (
186310 origin_post_quantum_encryption .get ,
187311 )
@@ -191,6 +315,9 @@ class AsyncOriginPostQuantumEncryptionResourceWithStreamingResponse:
191315 def __init__ (self , origin_post_quantum_encryption : AsyncOriginPostQuantumEncryptionResource ) -> None :
192316 self ._origin_post_quantum_encryption = origin_post_quantum_encryption
193317
318+ self .edit = async_to_streamed_response_wrapper (
319+ origin_post_quantum_encryption .edit ,
320+ )
194321 self .get = async_to_streamed_response_wrapper (
195322 origin_post_quantum_encryption .get ,
196323 )
0 commit comments