22
33from __future__ import annotations
44
5- from typing import Any , Optional , cast
5+ from typing import Type , Optional , cast
66
77import httpx
88
1919from ......_wrappers import ResultWrapper
2020from ......_base_client import make_request_options
2121from ......types .zero_trust .devices .policies .default import certificate_edit_params
22- from ......types .zero_trust .devices .policies .default .certificate_get_response import CertificateGetResponse
23- from ......types .zero_trust .devices .policies .default .certificate_edit_response import CertificateEditResponse
22+ from ......types .zero_trust .devices .device_policy_certificates import DevicePolicyCertificates
2423
2524__all__ = ["CertificatesResource" , "AsyncCertificatesResource" ]
2625
@@ -56,7 +55,7 @@ def edit(
5655 extra_query : Query | None = None ,
5756 extra_body : Body | None = None ,
5857 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
59- ) -> Optional [CertificateEditResponse ]:
58+ ) -> Optional [DevicePolicyCertificates ]:
6059 """
6160 Enable Zero Trust Clients to provision a certificate, containing a x509 subject,
6261 and referenced by Access device posture policies when the client visits MTLS
@@ -76,22 +75,17 @@ def edit(
7675 """
7776 if not zone_id :
7877 raise ValueError (f"Expected a non-empty value for `zone_id` but received { zone_id !r} " )
79- return cast (
80- Optional [CertificateEditResponse ],
81- self ._patch (
82- f"/zones/{ zone_id } /devices/policy/certificates" ,
83- body = maybe_transform ({"enabled" : enabled }, certificate_edit_params .CertificateEditParams ),
84- options = make_request_options (
85- extra_headers = extra_headers ,
86- extra_query = extra_query ,
87- extra_body = extra_body ,
88- timeout = timeout ,
89- post_parser = ResultWrapper [Optional [CertificateEditResponse ]]._unwrapper ,
90- ),
91- cast_to = cast (
92- Any , ResultWrapper [CertificateEditResponse ]
93- ), # Union types cannot be passed in as arguments in the type system
78+ return self ._patch (
79+ f"/zones/{ zone_id } /devices/policy/certificates" ,
80+ body = maybe_transform ({"enabled" : enabled }, certificate_edit_params .CertificateEditParams ),
81+ options = make_request_options (
82+ extra_headers = extra_headers ,
83+ extra_query = extra_query ,
84+ extra_body = extra_body ,
85+ timeout = timeout ,
86+ post_parser = ResultWrapper [Optional [DevicePolicyCertificates ]]._unwrapper ,
9487 ),
88+ cast_to = cast (Type [Optional [DevicePolicyCertificates ]], ResultWrapper [DevicePolicyCertificates ]),
9589 )
9690
9791 def get (
@@ -104,9 +98,9 @@ def get(
10498 extra_query : Query | None = None ,
10599 extra_body : Body | None = None ,
106100 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
107- ) -> Optional [CertificateGetResponse ]:
101+ ) -> Optional [DevicePolicyCertificates ]:
108102 """
109- Fetches device certificate provisioning
103+ Fetches device certificate provisioning.
110104
111105 Args:
112106 extra_headers: Send extra headers
@@ -119,21 +113,16 @@ def get(
119113 """
120114 if not zone_id :
121115 raise ValueError (f"Expected a non-empty value for `zone_id` but received { zone_id !r} " )
122- return cast (
123- Optional [CertificateGetResponse ],
124- self ._get (
125- f"/zones/{ zone_id } /devices/policy/certificates" ,
126- options = make_request_options (
127- extra_headers = extra_headers ,
128- extra_query = extra_query ,
129- extra_body = extra_body ,
130- timeout = timeout ,
131- post_parser = ResultWrapper [Optional [CertificateGetResponse ]]._unwrapper ,
132- ),
133- cast_to = cast (
134- Any , ResultWrapper [CertificateGetResponse ]
135- ), # Union types cannot be passed in as arguments in the type system
116+ return self ._get (
117+ f"/zones/{ zone_id } /devices/policy/certificates" ,
118+ options = make_request_options (
119+ extra_headers = extra_headers ,
120+ extra_query = extra_query ,
121+ extra_body = extra_body ,
122+ timeout = timeout ,
123+ post_parser = ResultWrapper [Optional [DevicePolicyCertificates ]]._unwrapper ,
136124 ),
125+ cast_to = cast (Type [Optional [DevicePolicyCertificates ]], ResultWrapper [DevicePolicyCertificates ]),
137126 )
138127
139128
@@ -168,7 +157,7 @@ async def edit(
168157 extra_query : Query | None = None ,
169158 extra_body : Body | None = None ,
170159 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
171- ) -> Optional [CertificateEditResponse ]:
160+ ) -> Optional [DevicePolicyCertificates ]:
172161 """
173162 Enable Zero Trust Clients to provision a certificate, containing a x509 subject,
174163 and referenced by Access device posture policies when the client visits MTLS
@@ -188,22 +177,17 @@ async def edit(
188177 """
189178 if not zone_id :
190179 raise ValueError (f"Expected a non-empty value for `zone_id` but received { zone_id !r} " )
191- return cast (
192- Optional [CertificateEditResponse ],
193- await self ._patch (
194- f"/zones/{ zone_id } /devices/policy/certificates" ,
195- body = await async_maybe_transform ({"enabled" : enabled }, certificate_edit_params .CertificateEditParams ),
196- options = make_request_options (
197- extra_headers = extra_headers ,
198- extra_query = extra_query ,
199- extra_body = extra_body ,
200- timeout = timeout ,
201- post_parser = ResultWrapper [Optional [CertificateEditResponse ]]._unwrapper ,
202- ),
203- cast_to = cast (
204- Any , ResultWrapper [CertificateEditResponse ]
205- ), # Union types cannot be passed in as arguments in the type system
180+ return await self ._patch (
181+ f"/zones/{ zone_id } /devices/policy/certificates" ,
182+ body = await async_maybe_transform ({"enabled" : enabled }, certificate_edit_params .CertificateEditParams ),
183+ options = make_request_options (
184+ extra_headers = extra_headers ,
185+ extra_query = extra_query ,
186+ extra_body = extra_body ,
187+ timeout = timeout ,
188+ post_parser = ResultWrapper [Optional [DevicePolicyCertificates ]]._unwrapper ,
206189 ),
190+ cast_to = cast (Type [Optional [DevicePolicyCertificates ]], ResultWrapper [DevicePolicyCertificates ]),
207191 )
208192
209193 async def get (
@@ -216,9 +200,9 @@ async def get(
216200 extra_query : Query | None = None ,
217201 extra_body : Body | None = None ,
218202 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
219- ) -> Optional [CertificateGetResponse ]:
203+ ) -> Optional [DevicePolicyCertificates ]:
220204 """
221- Fetches device certificate provisioning
205+ Fetches device certificate provisioning.
222206
223207 Args:
224208 extra_headers: Send extra headers
@@ -231,21 +215,16 @@ async def get(
231215 """
232216 if not zone_id :
233217 raise ValueError (f"Expected a non-empty value for `zone_id` but received { zone_id !r} " )
234- return cast (
235- Optional [CertificateGetResponse ],
236- await self ._get (
237- f"/zones/{ zone_id } /devices/policy/certificates" ,
238- options = make_request_options (
239- extra_headers = extra_headers ,
240- extra_query = extra_query ,
241- extra_body = extra_body ,
242- timeout = timeout ,
243- post_parser = ResultWrapper [Optional [CertificateGetResponse ]]._unwrapper ,
244- ),
245- cast_to = cast (
246- Any , ResultWrapper [CertificateGetResponse ]
247- ), # Union types cannot be passed in as arguments in the type system
218+ return await self ._get (
219+ f"/zones/{ zone_id } /devices/policy/certificates" ,
220+ options = make_request_options (
221+ extra_headers = extra_headers ,
222+ extra_query = extra_query ,
223+ extra_body = extra_body ,
224+ timeout = timeout ,
225+ post_parser = ResultWrapper [Optional [DevicePolicyCertificates ]]._unwrapper ,
248226 ),
227+ cast_to = cast (Type [Optional [DevicePolicyCertificates ]], ResultWrapper [DevicePolicyCertificates ]),
249228 )
250229
251230
0 commit comments