@@ -148,6 +148,7 @@ async def get_exporter(
148148 self ,
149149 name : str ,
150150 ):
151+ """Gets an exporter by name."""
151152 svc = ClientService (channel = await self .channel (), namespace = self .metadata .namespace )
152153 return await svc .GetExporter (name = name )
153154
@@ -161,6 +162,20 @@ async def list_exporters(
161162 include_leases : bool = False ,
162163 include_online : bool = False ,
163164 ):
165+ """Lists exporters.
166+
167+ Args:
168+ * page_size: The number of exporters to return.
169+ * page_token: The token to use to get the next page of exporters.
170+ * filter: A filter to apply to the list of exporters.
171+ * include_leases: Whether to include leases in the response.
172+ * include_online: Whether to include online status in the response.
173+ Returns:
174+ .exporters: list[Exporter]
175+ .next_page_token: str | None
176+ .include_online: bool : Whether to include online status in the response.
177+ .include_leases: bool : Whether to include leases in the response.
178+ """
164179 svc = ClientService (channel = await self .channel (), namespace = self .metadata .namespace )
165180 exporters_response = await svc .ListExporters (page_size = page_size , page_token = page_token , filter = filter )
166181
@@ -202,6 +217,13 @@ async def create_lease(
202217 duration : timedelta ,
203218 begin_time : datetime | None = None ,
204219 ):
220+ """Creates a lease request.
221+
222+ Args:
223+ * selector: The selector to use to create the lease.
224+ * duration: The duration of the lease.
225+ * begin_time: The beginning time of the lease.
226+ """
205227 svc = ClientService (channel = await self .channel (), namespace = self .metadata .namespace )
206228 return await svc .CreateLease (
207229 selector = selector ,
@@ -215,6 +237,7 @@ async def delete_lease(
215237 self ,
216238 name : str ,
217239 ):
240+ """Deletes a lease by name."""
218241 svc = ClientService (channel = await self .channel (), namespace = self .metadata .namespace )
219242 await svc .DeleteLease (
220243 name = name ,
@@ -229,6 +252,17 @@ async def list_leases(
229252 filter : str | None = None ,
230253 only_active : bool = True ,
231254 ):
255+ """Lists leases.
256+
257+ Args:
258+ * page_size: The number of leases to return.
259+ * page_token: The token to use to get the next page of leases.
260+ * filter: A filter to apply to the list of leases.
261+ * only_active: Whether to only include active leases.
262+ Returns:
263+ .leases: list[Lease]
264+ .next_page_token: str | None
265+ """
232266 svc = ClientService (channel = await self .channel (), namespace = self .metadata .namespace )
233267 return await svc .ListLeases (
234268 page_size = page_size ,
@@ -245,6 +279,15 @@ async def update_lease(
245279 duration : timedelta | None = None ,
246280 begin_time : datetime | None = None ,
247281 ):
282+ """Updates a lease by name.
283+ Can be used to extend the duration of an active lease, or modify the desired begin
284+ time and duration of a lease request.
285+
286+ Args:
287+ * name: The name of the lease to update.
288+ * duration: The duration of the lease.
289+ * begin_time: The beginning time of the lease.
290+ """
248291 svc = ClientService (channel = await self .channel (), namespace = self .metadata .namespace )
249292 return await svc .UpdateLease (name = name , duration = duration , begin_time = begin_time )
250293
@@ -290,6 +333,7 @@ async def lease_async(
290333
291334 @classmethod
292335 def from_file (cls , path : os .PathLike ):
336+ """Loads a client config from a file path."""
293337 with open (path ) as f :
294338 v = cls .model_validate (yaml .safe_load (f ))
295339 v .alias = os .path .basename (path ).split ("." )[0 ]
@@ -310,6 +354,7 @@ def try_from_env(cls):
310354
311355 @classmethod
312356 def from_env (cls ):
357+ """Loads a client config from the environment variables."""
313358 return cls ()
314359
315360 @classmethod
@@ -341,6 +386,7 @@ def save(cls, config: Self, path: Optional[os.PathLike] = None) -> Path:
341386
342387 @classmethod
343388 def dump_yaml (cls , config : Self ) -> str :
389+ """Dumps a client config as YAML."""
344390 return yaml .safe_dump (config .model_dump (mode = "json" , exclude = {"path" , "alias" }), sort_keys = False )
345391
346392 @classmethod
0 commit comments