3
3
from __future__ import annotations
4
4
5
5
from typing import Type , Optional , cast
6
+ from typing_extensions import Literal
6
7
7
8
import httpx
8
9
9
10
from .._types import NOT_GIVEN , Body , Query , Headers , NotGiven
11
+ from .._utils import (
12
+ maybe_transform ,
13
+ async_maybe_transform ,
14
+ )
10
15
from .._compat import cached_property
11
16
from .._resource import SyncAPIResource , AsyncAPIResource
12
17
from .._response import (
17
22
)
18
23
from .._wrappers import ResultWrapper
19
24
from .._base_client import make_request_options
25
+ from ..types .origin_post_quantum_encryption import origin_post_quantum_encryption_edit_params
20
26
from ..types .origin_post_quantum_encryption .origin_post_quantum_encryption_get_response import (
21
27
OriginPostQuantumEncryptionGetResponse ,
22
28
)
29
+ from ..types .origin_post_quantum_encryption .origin_post_quantum_encryption_edit_response import (
30
+ OriginPostQuantumEncryptionEditResponse ,
31
+ )
23
32
24
33
__all__ = ["OriginPostQuantumEncryptionResource" , "AsyncOriginPostQuantumEncryptionResource" ]
25
34
@@ -44,6 +53,59 @@ def with_streaming_response(self) -> OriginPostQuantumEncryptionResourceWithStre
44
53
"""
45
54
return OriginPostQuantumEncryptionResourceWithStreamingResponse (self )
46
55
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
+
47
109
def get (
48
110
self ,
49
111
* ,
@@ -112,6 +174,59 @@ def with_streaming_response(self) -> AsyncOriginPostQuantumEncryptionResourceWit
112
174
"""
113
175
return AsyncOriginPostQuantumEncryptionResourceWithStreamingResponse (self )
114
176
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
+
115
230
async def get (
116
231
self ,
117
232
* ,
@@ -164,6 +279,9 @@ class OriginPostQuantumEncryptionResourceWithRawResponse:
164
279
def __init__ (self , origin_post_quantum_encryption : OriginPostQuantumEncryptionResource ) -> None :
165
280
self ._origin_post_quantum_encryption = origin_post_quantum_encryption
166
281
282
+ self .edit = to_raw_response_wrapper (
283
+ origin_post_quantum_encryption .edit ,
284
+ )
167
285
self .get = to_raw_response_wrapper (
168
286
origin_post_quantum_encryption .get ,
169
287
)
@@ -173,6 +291,9 @@ class AsyncOriginPostQuantumEncryptionResourceWithRawResponse:
173
291
def __init__ (self , origin_post_quantum_encryption : AsyncOriginPostQuantumEncryptionResource ) -> None :
174
292
self ._origin_post_quantum_encryption = origin_post_quantum_encryption
175
293
294
+ self .edit = async_to_raw_response_wrapper (
295
+ origin_post_quantum_encryption .edit ,
296
+ )
176
297
self .get = async_to_raw_response_wrapper (
177
298
origin_post_quantum_encryption .get ,
178
299
)
@@ -182,6 +303,9 @@ class OriginPostQuantumEncryptionResourceWithStreamingResponse:
182
303
def __init__ (self , origin_post_quantum_encryption : OriginPostQuantumEncryptionResource ) -> None :
183
304
self ._origin_post_quantum_encryption = origin_post_quantum_encryption
184
305
306
+ self .edit = to_streamed_response_wrapper (
307
+ origin_post_quantum_encryption .edit ,
308
+ )
185
309
self .get = to_streamed_response_wrapper (
186
310
origin_post_quantum_encryption .get ,
187
311
)
@@ -191,6 +315,9 @@ class AsyncOriginPostQuantumEncryptionResourceWithStreamingResponse:
191
315
def __init__ (self , origin_post_quantum_encryption : AsyncOriginPost
F438
QuantumEncryptionResource ) -> None :
192
316
self ._origin_post_quantum_encryption = origin_post_quantum_encryption
193
317
318
+ self .edit = async_to_streamed_response_wrapper (
319
+ origin_post_quantum_encryption .edit ,
320
+ )
194
321
self .get = async_to_streamed_response_wrapper (
195
322
origin_post_quantum_encryption .get ,
196
323
)
0 commit comments