@@ -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,12 @@ async def create_lease(
202217 duration : timedelta ,
203218 begin_time : datetime | None = None ,
204219 ):
220+ """Creates a lease request.
221+ Args:
222+ selector: The selector to use to create the lease.
223+ * duration: The duration of the lease.
224+ * begin_time: The beginning time of the lease.
225+ """
205226 svc = ClientService (channel = await self .channel (), namespace = self .metadata .namespace )
206227 return await svc .CreateLease (
207228 selector = selector ,
@@ -215,6 +236,7 @@ async def delete_lease(
215236 self ,
216237 name : str ,
217238 ):
239+ """Deletes a lease by name."""
218240 svc = ClientService (channel = await self .channel (), namespace = self .metadata .namespace )
219241 await svc .DeleteLease (
220242 name = name ,
@@ -229,6 +251,17 @@ async def list_leases(
229251 filter : str | None = None ,
230252 only_active : bool = True ,
231253 ):
254+ """Lists leases.
255+
256+ Args:
257+ * page_size: The number of leases to return.
258+ * page_token: The token to use to get the next page of leases.
259+ * filter: A filter to apply to the list of leases.
260+ * only_active: Whether to only include active leases.
261+ Returns:
262+ .leases: list[Lease]
263+ .next_page_token: str | None
264+ """
232265 svc = ClientService (channel = await self .channel (), namespace = self .metadata .namespace )
233266 return await svc .ListLeases (
234267 page_size = page_size ,
@@ -245,6 +278,14 @@ async def update_lease(
245278 duration : timedelta | None = None ,
246279 begin_time : datetime | None = None ,
247280 ):
281+ """Updates a lease by name.
282+ Can be used to extend the duration of an active lease, or modify the desired begin
283+ time and duration of a lease request.
284+ Args:
285+ * name: The name of the lease to update.
286+ * duration: The duration of the lease.
287+ * begin_time: The beginning time of the lease.
288+ """
248289 svc = ClientService (channel = await self .channel (), namespace = self .metadata .namespace )
249290 return await svc .UpdateLease (name = name , duration = duration , begin_time = begin_time )
250291
@@ -290,6 +331,7 @@ async def lease_async(
290331
291332 @classmethod
292333 def from_file (cls , path : os .PathLike ):
334+ """Loads a client config from a file path."""
293335 with open (path ) as f :
294336 v = cls .model_validate (yaml .safe_load (f ))
295337 v .alias = os .path .basename (path ).split ("." )[0 ]
@@ -310,6 +352,7 @@ def try_from_env(cls):
310352
311353 @classmethod
312354 def from_env (cls ):
355+ """Loads a client config from the environment variables."""
313356 return cls ()
314357
315358 @classmethod
@@ -341,6 +384,7 @@ def save(cls, config: Self, path: Optional[os.PathLike] = None) -> Path:
341384
342385 @classmethod
343386 def dump_yaml (cls , config : Self ) -> str :
387+ """Dumps a client config as YAML."""
344388 return yaml .safe_dump (config .model_dump (mode = "json" , exclude = {"path" , "alias" }), sort_keys = False )
345389
346390 @classmethod
0 commit comments