@@ -264,6 +264,68 @@ def remove(self, name):
264
264
Endpoint name to remove'''
265
265
self ._service .remove_endpoint (name )
266
266
267
+ def update_endpoint_info (self , name , description = None , schema = None , is_public = None ):
268
+ '''Updates description, schema, or is public for an existing endpoint
269
+
270
+ Parameters
271
+ ----------
272
+ name : str
273
+ Name of the endpoint that to be updated. If endpoint does not exist
274
+ runtime error will be thrown
275
+
276
+ description : str, optional
277
+ The description for the endpoint. This string will be returned by
278
+ the ``endpoints`` API.
279
+
280
+ schema : dict, optional
281
+ The schema of the function, containing information about input and
282
+ output parameters, and respective examples. Providing a schema for
283
+ a deployed function lets other users of the service discover how to
284
+ use it. Refer to schema.generate_schema for more information on
285
+ how to generate the schema.
286
+
287
+ is_public : bool, optional
288
+ Whether a function should be public for viewing from within tableau. If
289
+ False, function will not appear in the custom functions explorer within
290
+ Tableau. If True, function will be visible to anyone on a site with this
291
+ analytics extension configured
292
+ '''
293
+
294
+ endpoint = self .get_endpoints ().get (name )
295
+
296
+ if not endpoint :
297
+ raise RuntimeError (
298
+ f"No endpoint with that name ({ name } ) exists"
299
+ " Please select an existing endpoint to update"
300
+ )
301
+
302
+ if description is not None :
303
+ if type (description ) is not str :
304
+ raise RuntimeError (
305
+ f"Type of description must be string"
306
+ )
307
+ endpoint .description = description
308
+ if schema is not None :
309
+ if type (schema ) is not dict :
310
+ raise RuntimeError (
311
+ f"Type of schema must be dictionary"
312
+ )
313
+ endpoint .schema = schema
314
+ if is_public is not None :
315
+ if type (is_public ) is not bool :
316
+ raise RuntimeError (
317
+ f"Type of is_public must be bool"
318
+ )
319
+ endpoint .is_public = is_public
320
+
321
+ dest_path = self ._get_endpoint_upload_destination ()
322
+
323
+ endpoint .src_path = os .path .join (
324
+ dest_path , "endpoints" , endpoint .name , str (endpoint .version )
325
+ )
326
+
327
+ self ._service .set_endpoint (endpoint )
328
+
267
329
def _gen_endpoint (self , name , obj , description , version = 1 , schema = None , is_public = False ):
268
330
"""Generates an endpoint dict.
269
331
0 commit comments