@@ -188,6 +188,56 @@ def update(
188188 cast_to = TaskIDList ,
189189 )
190190
191+ def update_and_poll (
192+ self ,
193+ router_id : str ,
194+ * ,
195+ project_id : int | None = None ,
196+ region_id : int | None = None ,
197+ external_gateway_info : router_update_params .ExternalGatewayInfo | Omit = omit ,
198+ name : str | Omit = omit ,
199+ routes : Iterable [router_update_params .Route ] | Omit = omit ,
200+ polling_interval_seconds : int | Omit = omit ,
201+ polling_timeout_seconds : int | Omit = omit ,
202+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
203+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
204+ # The extra values given here take precedence over values defined on the client or passed to this method.
205+ extra_headers : Headers | None = None ,
206+ extra_query : Query | None = None ,
207+ extra_body : Body | None = None ,
208+ ) -> Router :
209+ """
210+ Update router and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
211+ """
212+ response = self .update (
213+ router_id = router_id ,
214+ project_id = project_id ,
215+ region_id = region_id ,
216+ external_gateway_info = external_gateway_info ,
217+ name = name ,
218+ routes = routes ,
219+ extra_headers = extra_headers ,
220+ extra_query = extra_query ,
221+ extra_body = extra_body ,
222+ timeout = timeout ,
223+ )
224+ if response .tasks :
225+ self ._client .cloud .tasks .poll (
226+ task_id = response .tasks [0 ],
227+ extra_headers = extra_headers ,
228+ polling_interval_seconds = polling_interval_seconds ,
229+ polling_timeout_seconds = polling_timeout_seconds ,
230+ )
231+ return self .get (
232+ router_id = router_id ,
233+ project_id = project_id ,
234+ region_id = region_id ,
235+ extra_headers = extra_headers ,
236+ extra_query = extra_query ,
237+ extra_body = extra_body ,
238+ timeout = timeout ,
239+ )
240+
191241 def list (
192242 self ,
193243 * ,
@@ -607,6 +657,56 @@ async def update(
607657 cast_to = TaskIDList ,
608658 )
609659
660+ async def update_and_poll (
661+ self ,
662+ router_id : str ,
663+ * ,
664+ project_id : int | None = None ,
665+ region_id : int | None = None ,
666+ external_gateway_info : router_update_params .ExternalGatewayInfo | Omit = omit ,
667+ name : str | Omit = omit ,
668+ routes : Iterable [router_update_params .Route ] | Omit = omit ,
669+ polling_interval_seconds : int | Omit = omit ,
670+ polling_timeout_seconds : int | Omit = omit ,
671+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
672+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
673+ # The extra values given here take precedence over values defined on the client or passed to this method.
674+ extra_headers : Headers | None = None ,
675+ extra_query : Query | None = None ,
676+ extra_body : Body | None = None ,
677+ ) -> Router :
678+ """
679+ Update router and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
680+ """
681+ response = await self .update (
682+ router_id = router_id ,
683+ project_id = project_id ,
684+ region_id = region_id ,
685+ external_gateway_info = external_gateway_info ,
686+ name = name ,
687+ routes = routes ,
688+ extra_headers = extra_headers ,
689+ extra_query = extra_query ,
690+ extra_body = extra_body ,
691+ timeout = timeout ,
692+ )
693+ if response .tasks :
694+ await self ._client .cloud .tasks .poll (
695+ task_id = response .tasks [0 ],
696+ extra_headers = extra_headers ,
697+ polling_interval_seconds = polling_interval_seconds ,
698+ polling_timeout_seconds = polling_timeout_seconds ,
699+ )
700+ return await self .get (
701+ router_id = router_id ,
702+ project_id = project_id ,
703+ region_id = region_id ,
704+ extra_headers = extra_headers ,
705+ extra_query = extra_query ,
706+ extra_body = extra_body ,
707+ timeout = timeout ,
708+ )
709+
610710 def list (
611711 self ,
612712 * ,
@@ -881,6 +981,9 @@ def __init__(self, routers: RoutersResource) -> None:
881981 self .update = to_raw_response_wrapper (
882982 routers .update ,
883983 )
984+ self .update_and_poll = to_raw_response_wrapper (
985+ routers .update_and_poll ,
986+ )
884987 self .list = to_raw_response_wrapper (
885988 routers .list ,
886989 )
@@ -908,6 +1011,9 @@ def __init__(self, routers: AsyncRoutersResource) -> None:
9081011 self .update = async_to_raw_response_wrapper (
9091012 routers .update ,
9101013 )
1014+ self .update_and_poll = async_to_raw_response_wrapper (
1015+ routers .update_and_poll ,
1016+ )
9111017 self .list = async_to_raw_response_wrapper (
9121018 routers .list ,
9131019 )
@@ -935,6 +1041,9 @@ def __init__(self, routers: RoutersResource) -> None:
9351041 self .update = to_streamed_response_wrapper (
9361042 routers .update ,
9371043 )
1044+ self .update_and_poll = to_streamed_response_wrapper (
1045+ routers .update_and_poll ,
1046+ )
9381047 self .list = to_streamed_response_wrapper (
9391048 routers .list ,
9401049 )
@@ -962,6 +1071,9 @@ def __init__(self, routers: AsyncRoutersResource) -> None:
9621071 self .update = async_to_streamed_response_wrapper (
9631072 routers .update ,
9641073 )
1074+ self .update_and_poll = async_to_streamed_response_wrapper (
1075+ routers .update_and_poll ,
1076+ )
9651077 self .list = async_to_streamed_response_wrapper (
9661078 routers .list ,
9671079 )
0 commit comments