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