@@ -23,31 +23,37 @@ def update():
2323@opt_duration_partial (required = False )
2424@opt_begin_time
2525@click .option (
26- "--client" ,
26+ "--to- client" ,
2727 type = str ,
2828 default = None ,
29- help = "Transfer lease to a different client (format: namespaces/{ namespace}/clients/{client}) " ,
29+ help = "Transfer lease to a different client in the same namespace" ,
3030)
3131@opt_output_all
3232@handle_exceptions_with_reauthentication (relogin_client )
3333def update_lease (
34- config , name : str , duration : timedelta | None , begin_time : datetime | None , client : str | None , output : OutputType
34+ config ,
35+ name : str ,
36+ duration : timedelta | None ,
37+ begin_time : datetime | None ,
38+ to_client : str | None ,
39+ output : OutputType ,
3540):
3641 """
3742 Update a lease
3843
3944 Update the duration, begin time, and/or owner of an existing lease.
40- At least one of --duration, --begin-time, or --client must be specified.
45+ At least one of --duration, --begin-time, or --to_client must be specified.
4146
42- To transfer a lease to another client, use the --client option with the
43- full client identifier (e.g., namespaces/default/clients/other-client).
47+ To transfer a lease to another client in the same namespace, use the --to_client option.
4448
4549 Updating the begin time of an already active lease is not allowed.
4650 """
4751
48- if duration is None and begin_time is None and client is None :
52+ if duration is None and begin_time is None and to_client is None :
4953 raise click .UsageError ("At least one of --duration, --begin-time, or --client must be specified" )
5054
51- lease = config .update_lease (name , duration = duration , begin_time = begin_time , client = client )
55+ client_path = f"namespaces/{ config .metadata .namespace } /clients/{ to_client } " if to_client else None
56+
57+ lease = config .update_lease (name , duration = duration , begin_time = begin_time , client = client_path )
5258
5359 model_print (lease , output )
0 commit comments