Skip to content

Commit f43f392

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(zero_trust_device_certificates): update path placeholders (#2204)
1 parent 1c97b11 commit f43f392

File tree

10 files changed

+584
-1
lines changed

10 files changed

+584
-1
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 1449
1+
configured_endpoints: 1451
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-1c6fe7515b7879a7cd51bbe9433aeee5d3d30feaf519f42d0d81c64b19f45875.yml

api.md

+16
Original file line numberDiff line numberDiff line change
@@ -4960,6 +4960,22 @@ Methods:
49604960
- <code title="put /accounts/{account_id}/devices/policy/fallback_domains">client.zero_trust.devices.policies.default.fallback_domains.<a href="./src/cloudflare/resources/zero_trust/devices/policies/default/fallback_domains.py">update</a>(\*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/devices/policies/default/fallback_domain_update_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/devices/policies/default/fallback_domain_update_response.py">Optional</a></code>
49614961
- <code title="get /accounts/{account_id}/devices/policy/fallback_domains">client.zero_trust.devices.policies.default.fallback_domains.<a href="./src/cloudflare/resources/zero_trust/devices/policies/default/fallback_domains.py">get</a>(\*, account_id) -> <a href="./src/cloudflare/types/zero_trust/devices/policies/default/fallback_domain_get_response.py">Optional</a></code>
49624962

4963+
##### Certificates
4964+
4965+
Types:
4966+
4967+
```python
4968+
from cloudflare.types.zero_trust.devices.policies.default import (
4969+
CertificateEditResponse,
4970+
CertificateGetResponse,
4971+
)
4972+
```
4973+
4974+
Methods:
4975+
4976+
- <code title="patch /zones/{zone_id}/devices/policy/certificates">client.zero_trust.devices.policies.default.certificates.<a href="./src/cloudflare/resources/zero_trust/devices/policies/default/certificates.py">edit</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/zero_trust/devices/policies/default/certificate_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/devices/policies/default/certificate_edit_response.py">CertificateEditResponse</a></code>
4977+
- <code title="get /zones/{zone_id}/devices/policy/certificates">client.zero_trust.devices.policies.default.certificates.<a href="./src/cloudflare/resources/zero_trust/devices/policies/default/certificates.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/zero_trust/devices/policies/default/certificate_get_response.py">CertificateGetResponse</a></code>
4978+
49634979
#### Custom
49644980

49654981
Types:

src/cloudflare/resources/zero_trust/devices/policies/default/__init__.py

+14
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@
2424
IncludesResourceWithStreamingResponse,
2525
AsyncIncludesResourceWithStreamingResponse,
2626
)
27+
from .certificates import (
28+
CertificatesResource,
29+
AsyncCertificatesResource,
30+
CertificatesResourceWithRawResponse,
31+
AsyncCertificatesResourceWithRawResponse,
32+
CertificatesResourceWithStreamingResponse,
33+
AsyncCertificatesResourceWithStreamingResponse,
34+
)
2735
from .fallback_domains import (
2836
FallbackDomainsResource,
2937
AsyncFallbackDomainsResource,
@@ -52,6 +60,12 @@
5260
"AsyncFallbackDomainsResourceWithRawResponse",
5361
"FallbackDomainsResourceWithStreamingResponse",
5462
"AsyncFallbackDomainsResourceWithStreamingResponse",
63+
"CertificatesResource",
64+
"AsyncCertificatesResource",
65+
"CertificatesResourceWithRawResponse",
66+
"AsyncCertificatesResourceWithRawResponse",
67+
"CertificatesResourceWithStreamingResponse",
68+
"AsyncCertificatesResourceWithStreamingResponse",
5569
"DefaultResource",
5670
"AsyncDefaultResource",
5771
"DefaultResourceWithRawResponse",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,300 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Any, cast
6+
7+
import httpx
8+
9+
from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven
10+
from ......_utils import (
11+
maybe_transform,
12+
async_maybe_transform,
13+
)
14+
from ......_compat import cached_property
15+
from ......_resource import SyncAPIResource, AsyncAPIResource
16+
from ......_response import (
17+
to_raw_response_wrapper,
18+
to_streamed_response_wrapper,
19+
async_to_raw_response_wrapper,
20+
async_to_streamed_response_wrapper,
21+
)
22+
from ......_wrappers import ResultWrapper
23+
from ......_base_client import make_request_options
24+
from ......types.zero_trust.devices.policies.default import certificate_edit_params
25+
from ......types.zero_trust.devices.policies.default.certificate_get_response import CertificateGetResponse
26+
from ......types.zero_trust.devices.policies.default.certificate_edit_response import CertificateEditResponse
27+
28+
__all__ = ["CertificatesResource", "AsyncCertificatesResource"]
29+
30+
31+
class CertificatesResource(SyncAPIResource):
32+
@cached_property
33+
def with_raw_response(self) -> CertificatesResourceWithRawResponse:
34+
"""
35+
This property can be used as a prefix for any HTTP method call to return the
36+
the raw response object instead of the parsed content.
37+
38+
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
39+
"""
40+
return CertificatesResourceWithRawResponse(self)
41+
42+
@cached_property
43+
def with_streaming_response(self) -> CertificatesResourceWithStreamingResponse:
44+
"""
45+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
46+
47+
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
48+
"""
49+
return CertificatesResourceWithStreamingResponse(self)
50+
51+
def edit(
52+
self,
53+
*,
54+
zone_id: str,
55+
enabled: bool,
56+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
57+
# The extra values given here take precedence over values defined on the client or passed to this method.
58+
extra_headers: Headers | None = None,
59+
extra_query: Query | None = None,
60+
extra_body: Body | None = None,
61+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
62+
) -> CertificateEditResponse:
63+
"""
64+
Enable Zero Trust Clients to provision a certificate, containing a x509 subject,
65+
and referenced by Access device posture policies when the client visits MTLS
66+
protected domains. This facilitates device posture without a WARP session.
67+
68+
Args:
69+
enabled: The current status of the device policy certificate provisioning feature for
70+
WARP clients.
71+
72+
extra_headers: Send extra headers
73+
74+
extra_query: Add additional query parameters to the request
75+
76+
extra_body: Add additional JSON properties to the request
77+
78+
timeout: Override the client-level default timeout for this request, in seconds
79+
"""
80+
if not zone_id:
81+
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
82+
return cast(
83+
CertificateEditResponse,
84+
self._patch(
85+
f"/zones/{zone_id}/devices/policy/certificates",
86+
body=maybe_transform({"enabled": enabled}, certificate_edit_params.CertificateEditParams),
87+
options=make_request_options(
88+
extra_headers=extra_headers,
89+
extra_query=extra_query,
90+
extra_body=extra_body,
91+
timeout=timeout,
92+
post_parser=ResultWrapper[CertificateEditResponse]._unwrapper,
93+
),
94+
cast_to=cast(
95+
Any, ResultWrapper[CertificateEditResponse]
96+
), # Union types cannot be passed in as arguments in the type system
97+
),
98+
)
99+
100+
def get(
101+
self,
102+
*,
103+
zone_id: str,
104+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
105+
# The extra values given here take precedence over values defined on the client or passed to this method.
106+
extra_headers: Headers | None = None,
107+
extra_query: Query | None = None,
108+
extra_body: Body | None = None,
109+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
110+
) -> CertificateGetResponse:
111+
"""
112+
Fetches device certificate provisioning
113+
114+
Args:
115+
extra_headers: Send extra headers
116+
117+
extra_query: Add additional query parameters to the request
118+
119+
extra_body: Add additional JSON properties to the request
120+
121+
timeout: Override the client-level default timeout for this request, in seconds
122+
"""
123+
if not zone_id:
124+
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
125+
return cast(
126+
CertificateGetResponse,
127+
self._get(
128+
f"/zones/{zone_id}/devices/policy/certificates",
129+
options=make_request_options(
130+
extra_headers=extra_headers,
131+
extra_query=extra_query,
132+
extra_body=extra_body,
133+
timeout=timeout,
134+
post_parser=ResultWrapper[CertificateGetResponse]._unwrapper,
135+
),
136+
cast_to=cast(
137+
Any, ResultWrapper[CertificateGetResponse]
138+
), # Union types cannot be passed in as arguments in the type system
139+
),
140+
)
141+
142+
143+
class AsyncCertificatesResource(AsyncAPIResource):
144+
@cached_property
145+
def with_raw_response(self) -> AsyncCertificatesResourceWithRawResponse:
146+
"""
147+
This property can be used as a prefix for any HTTP method call to return the
148+
the raw response object instead of the parsed content.
149+
150+
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
151+
"""
152+
return AsyncCertificatesResourceWithRawResponse(self)
153+
154+
@cached_property
155+
def with_streaming_response(self) -> AsyncCertificatesResourceWithStreamingResponse:
156+
"""
157+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
158+
159+
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
160+
"""
161+
return AsyncCertificatesResourceWithStreamingResponse(self)
162+
163+
async def edit(
164+
self,
165+
*,
166+
zone_id: str,
167+
enabled: bool,
168+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
169+
# The extra values given here take precedence over values defined on the client or passed to this method.
170+
extra_headers: Headers | None = None,
171+
extra_query: Query | None = None,
172+
extra_body: Body | None = None,
173+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
174+
) -> CertificateEditResponse:
175+
"""
176+
Enable Zero Trust Clients to provision a certificate, containing a x509 subject,
177+
and referenced by Access device posture policies when the client visits MTLS
178+
protected domains. This facilitates device posture without a WARP session.
179+
180+
Args:
181+
enabled: The current status of the device policy certificate provisioning feature for
182+
WARP clients.
183+
184+
extra_headers: Send extra headers
185+
186+
extra_query: Add additional query parameters to the request
187+
188+
extra_body: Add additional JSON properties to the request
189+
190+
timeout: Override the client-level default timeout for this request, in seconds
191+
"""
192+
if not zone_id:
193+
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
194+
return cast(
195+
CertificateEditResponse,
196+
await self._patch(
197+
f"/zones/{zone_id}/devices/policy/certificates",
198+
body=await async_maybe_transform({"enabled": enabled}, certificate_edit_params.CertificateEditParams),
199+
options=make_request_options(
200+
extra_headers=extra_headers,
201+
extra_query=extra_query,
202+
extra_body=extra_body,
203+
timeout=timeout,
204+
post_parser=ResultWrapper[CertificateEditResponse]._unwrapper,
205+
),
206+
cast_to=cast(
207+
Any, ResultWrapper[CertificateEditResponse]
208+
), # Union types cannot be passed in as arguments in the type system
209+
),
210+
)
211+
212+
async def get(
213+
self,
214+
*,
215+
zone_id: str,
216+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
217+
# The extra values given here take precedence over values defined on the client or passed to this method.
218+
extra_headers: Headers | None = None,
219+
extra_query: Query | None = None,
220+
extra_body: Body | None = None,
221+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
222+
) -> CertificateGetResponse:
223+
"""
224+
Fetches device certificate provisioning
225+
226+
Args:
227+
extra_headers: Send extra headers
228+
229+
extra_query: Add additional query parameters to the request
230+
231+
extra_body: Add additional JSON properties to the request
232+
233+
timeout: Override the client-level default timeout for this request, in seconds
234+
"""
235+
if not zone_id:
236+
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
237+
return cast(
238+
CertificateGetResponse,
239+
await self._get(
240+
f"/zones/{zone_id}/devices/policy/certificates",
241+
options=make_request_options(
242+
extra_headers=extra_headers,
243+
extra_query=extra_query,
244+
extra_body=extra_body,
245+
timeout=timeout,
246+
post_parser=ResultWrapper[CertificateGetResponse]._unwrapper,
247+
),
248+
cast_to=cast(
249+
Any, ResultWrapper[CertificateGetResponse]
250+
), # Union types cannot be passed in as arguments in the type system
251+
),
252+
)
253+
254+
255+
class CertificatesResourceWithRawResponse:
256+
def __init__(self, certificates: CertificatesResource) -> None:
257+
self._certificates = certificates
258+
259+
self.edit = to_raw_response_wrapper(
260+
certificates.edit,
261+
)
262+
self.get = to_raw_response_wrapper(
263+
certificates.get,
264+
)
265+
266+
267+
class AsyncCertificatesResourceWithRawResponse:
268+
def __init__(self, certificates: AsyncCertificatesResource) -> None:
269+
self._certificates = certificates
270+
271+
self.edit = async_to_raw_response_wrapper(
272+
certificates.edit,
273+
)
274+
self.get = async_to_raw_response_wrapper(
275+
certificates.get,
276+
)
277+
278+
279+
class CertificatesResourceWithStreamingResponse:
280+
def __init__(self, certificates: CertificatesResource) -> None:
281+
self._certificates = certificates
282+
283+
self.edit = to_streamed_response_wrapper(
284+
certificates.edit,
285+
)
286+
self.get = to_streamed_response_wrapper(
287+
certificates.get,
288+
)
289+
290+
291+
class AsyncCertificatesResourceWithStreamingResponse:
292+
def __init__(self, certificates: AsyncCertificatesResource) -> None:
293+
self._certificates = certificates
294+
295+
self.edit = async_to_streamed_response_wrapper(
296+
certificates.edit,
297+
)
298+
self.get = async_to_streamed_response_wrapper(
299+
certificates.get,
300+
)

0 commit comments

Comments
 (0)