1919from ..._wrappers import ResultWrapper
2020from ...pagination import SyncSinglePage , AsyncSinglePage
2121from ..._base_client import AsyncPaginator , make_request_options
22- from ...types .magic_transit import app_create_params , app_update_params
22+ from ...types .magic_transit import app_edit_params , app_create_params , app_update_params
23+ from ...types .magic_transit .app_edit_response import AppEditResponse
2324from ...types .magic_transit .app_list_response import AppListResponse
2425from ...types .magic_transit .app_create_response import AppCreateResponse
2526from ...types .magic_transit .app_delete_response import AppDeleteResponse
@@ -253,6 +254,71 @@ def delete(
253254 cast_to = cast (Type [Optional [AppDeleteResponse ]], ResultWrapper [AppDeleteResponse ]),
254255 )
255256
257+ def edit (
258+ self ,
259+ account_app_id : str ,
260+ * ,
261+ account_id : str ,
262+ hostnames : List [str ] | NotGiven = NOT_GIVEN ,
263+ ip_subnets : List [str ] | NotGiven = NOT_GIVEN ,
264+ name : str | NotGiven = NOT_GIVEN ,
265+ type : str | NotGiven = NOT_GIVEN ,
266+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
267+ # The extra values given here take precedence over values defined on the client or passed to this method.
268+ extra_headers : Headers | None = None ,
269+ extra_query : Query | None = None ,
270+ extra_body : Body | None = None ,
271+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
272+ ) -> Optional [AppEditResponse ]:
273+ """
274+ Updates an Account App
275+
276+ Args:
277+ account_id: Identifier
278+
279+ account_app_id: Identifier
280+
281+ hostnames: FQDNs to associate with traffic decisions.
282+
283+ ip_subnets: CIDRs to associate with traffic decisions.
284+
285+ name: Display name for the app.
286+
287+ type: Category of the app.
288+
289+ extra_headers: Send extra headers
290+
291+ extra_query: Add additional query parameters to the request
292+
293+ extra_body: Add additional JSON properties to the request
294+
295+ timeout: Override the client-level default timeout for this request, in seconds
296+ """
297+ if not account_id :
298+ raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
299+ if not account_app_id :
300+ raise ValueError (f"Expected a non-empty value for `account_app_id` but received { account_app_id !r} " )
301+ return self ._patch (
302+ f"/accounts/{ account_id } /magic/apps/{ account_app_id } " ,
303+ body = maybe_transform (
304+ {
305+ "hostnames" : hostnames ,
306+ "ip_subnets" : ip_subnets ,
307+ "name" : name ,
308+ "type" : type ,
309+ },
310+ app_edit_params .AppEditParams ,
311+ ),
312+ options = make_request_options (
313+ extra_headers = extra_headers ,
314+ extra_query = extra_query ,
315+ extra_body = extra_body ,
316+ timeout = timeout ,
317+ post_parser = ResultWrapper [Optional [AppEditResponse ]]._unwrapper ,
318+ ),
319+ cast_to = cast (Type [Optional [AppEditResponse ]], ResultWrapper [AppEditResponse ]),
320+ )
321+
256322
257323class AsyncAppsResource (AsyncAPIResource ):
258324 @cached_property
@@ -479,6 +545,71 @@ async def delete(
479545 cast_to = cast (Type [Optional [AppDeleteResponse ]], ResultWrapper [AppDeleteResponse ]),
480546 )
481547
548+ async def edit (
549+ self ,
550+ account_app_id : str ,
551+ * ,
552+ account_id : str ,
553+ hostnames : List [str ] | NotGiven = NOT_GIVEN ,
554+ ip_subnets : List [str ] | NotGiven = NOT_GIVEN ,
555+ name : str | NotGiven = NOT_GIVEN ,
556+ type : str | NotGiven = NOT_GIVEN ,
557+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
558+ # The extra values given here take precedence over values defined on the client or passed to this method.
559+ extra_headers : Headers | None = None ,
560+ extra_query : Query | None = None ,
561+ extra_body : Body | None = None ,
562+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
563+ ) -> Optional [AppEditResponse ]:
564+ """
565+ Updates an Account App
566+
567+ Args:
568+ account_id: Identifier
569+
570+ account_app_id: Identifier
571+
572+ hostnames: FQDNs to associate with traffic decisions.
573+
574+ ip_subnets: CIDRs to associate with traffic decisions.
575+
576+ name: Display name for the app.
577+
578+ type: Category of the app.
579+
580+ extra_headers: Send extra headers
581+
582+ extra_query: Add additional query parameters to the request
583+
584+ extra_body: Add additional JSON properties to the request
585+
586+ timeout: Override the client-level default timeout for this request, in seconds
587+ """
588+ if not account_id :
589+ raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
590+ if not account_app_id :
591+ raise ValueError (f"Expected a non-empty value for `account_app_id` but received { account_app_id !r} " )
592+ return await self ._patch (
593+ f"/accounts/{ account_id } /magic/apps/{ account_app_id } " ,
594+ body = await async_maybe_transform (
595+ {
596+ "hostnames" : hostnames ,
597+ "ip_subnets" : ip_subnets ,
598+ "name" : name ,
599+ "type" : type ,
600+ },
601+ app_edit_params .AppEditParams ,
602+ ),
603+ options = make_request_options (
604+ extra_headers = extra_headers ,
605+ extra_query = extra_query ,
606+ extra_body = extra_body ,
607+ timeout = timeout ,
608+ post_parser = ResultWrapper [Optional [AppEditResponse ]]._unwrapper ,
609+ ),
610+ cast_to = cast (Type [Optional [AppEditResponse ]], ResultWrapper [AppEditResponse ]),
611+ )
612+
482613
483614class AppsResourceWithRawResponse :
484615 def __init__ (self , apps : AppsResource ) -> None :
@@ -496,6 +627,9 @@ def __init__(self, apps: AppsResource) -> None:
496627 self .delete = to_raw_response_wrapper (
497628 apps .delete ,
498629 )
630+ self .edit = to_raw_response_wrapper (
631+ apps .edit ,
632+ )
499633
500634
501635class AsyncAppsResourceWithRawResponse :
@@ -514,6 +648,9 @@ def __init__(self, apps: AsyncAppsResource) -> None:
514648 self .delete = async_to_raw_response_wrapper (
515649 apps .delete ,
516650 )
651+ self .edit = async_to_raw_response_wrapper (
652+ apps .edit ,
653+ )
517654
518655
519656class AppsResourceWithStreamingResponse :
@@ -532,6 +669,9 @@ def __init__(self, apps: AppsResource) -> None:
532669 self .delete = to_streamed_response_wrapper (
533670 apps .delete ,
534671 )
672+ self .edit = to_streamed_response_wrapper (
673+ apps .edit ,
674+ )
535675
536676
537677class AsyncAppsResourceWithStreamingResponse :
@@ -550,3 +690,6 @@ def __init__(self, apps: AsyncAppsResource) -> None:
550690 self .delete = async_to_streamed_response_wrapper (
551691 apps .delete ,
552692 )
693+ self .edit = async_to_streamed_response_wrapper (
694+ apps .edit ,
695+ )
0 commit comments