public class FunctionsImpl extends BaseResource implements Functions
| Constructor and Description |
|---|
FunctionsImpl(javax.ws.rs.client.WebTarget web,
Authentication auth) |
| Modifier and Type | Method and Description |
|---|---|
void |
createFunction(org.apache.pulsar.functions.shaded.proto.Function.FunctionDetails functionDetails,
String fileName)
Create a new function.
|
void |
deleteFunction(String cluster,
String namespace,
String function)
Delete an existing function
|
void |
downloadFunction(String destinationPath,
String path)
Download Function Code.
|
org.apache.pulsar.functions.shaded.proto.Function.FunctionDetails |
getFunction(String tenant,
String namespace,
String function)
Get the configuration for the specified function.
|
List<String> |
getFunctions(String tenant,
String namespace)
Get the list of functions.
|
org.apache.pulsar.functions.shaded.proto.InstanceCommunication.FunctionStatusList |
getFunctionStatus(String tenant,
String namespace,
String function)
Gets the current status of a function.
|
static void |
mergeJson(String json,
org.apache.pulsar.functions.shaded.com.google.protobuf.AbstractMessage.Builder builder) |
static String |
printJson(org.apache.pulsar.functions.shaded.com.google.protobuf.MessageOrBuilder msg) |
String |
triggerFunction(String tenant,
String namespace,
String functionName,
String topic,
String triggerValue,
String triggerFile)
Triggers the function by writing to the input topic.
|
void |
updateFunction(org.apache.pulsar.functions.shaded.proto.Function.FunctionDetails functionDetails,
String fileName)
Update the configuration for a function.
|
void |
uploadFunction(String sourceFile,
String path)
Upload Data.
|
asyncDeleteRequest, asyncGetRequest, asyncPostRequest, asyncPutRequest, getApiException, requestpublic FunctionsImpl(javax.ws.rs.client.WebTarget web,
Authentication auth)
public List<String> getFunctions(String tenant, String namespace) throws PulsarAdminException
FunctionsGet the list of all the Pulsar functions.
Response Example:
["f1", "f2", "f3"]
getFunctions in interface FunctionsPulsarAdminException.NotAuthorizedException - Don't have admin permissionPulsarAdminException - Unexpected errorpublic org.apache.pulsar.functions.shaded.proto.Function.FunctionDetails getFunction(String tenant, String namespace, String function) throws PulsarAdminException
FunctionsResponse Example:
{ serviceUrl : "http://my-broker.example.com:8080/" }
getFunction in interface Functionstenant - Tenant namenamespace - Namespace namefunction - Function namePulsarAdminException.NotAuthorizedException - You don't have admin permission to get the configuration of the clusterPulsarAdminException.NotFoundException - Cluster doesn't existPulsarAdminException - Unexpected errorpublic org.apache.pulsar.functions.shaded.proto.InstanceCommunication.FunctionStatusList getFunctionStatus(String tenant, String namespace, String function) throws PulsarAdminException
FunctionsgetFunctionStatus in interface Functionstenant - Tenant namenamespace - Namespace namefunction - Function namePulsarAdminException - Unexpected errorpublic void createFunction(org.apache.pulsar.functions.shaded.proto.Function.FunctionDetails functionDetails,
String fileName)
throws PulsarAdminException
FunctionscreateFunction in interface FunctionsfunctionDetails - the function configuration objectPulsarAdminException - Unexpected errorpublic void deleteFunction(String cluster, String namespace, String function) throws PulsarAdminException
FunctionsDelete a function
deleteFunction in interface Functionscluster - Tenant namenamespace - Namespace namefunction - Function namePulsarAdminException.NotAuthorizedException - You don't have admin permissionPulsarAdminException.NotFoundException - Cluster does not existPulsarAdminException.PreconditionFailedException - Cluster is not emptyPulsarAdminException - Unexpected errorpublic void updateFunction(org.apache.pulsar.functions.shaded.proto.Function.FunctionDetails functionDetails,
String fileName)
throws PulsarAdminException
FunctionsupdateFunction in interface FunctionsfunctionDetails - the function configuration objectPulsarAdminException.NotAuthorizedException - You don't have admin permission to create the clusterPulsarAdminException.NotFoundException - Cluster doesn't existPulsarAdminException - Unexpected errorpublic String triggerFunction(String tenant, String namespace, String functionName, String topic, String triggerValue, String triggerFile) throws PulsarAdminException
FunctionstriggerFunction in interface Functionstenant - Tenant namenamespace - Namespace namefunctionName - Function nametriggerValue - The input that will be written to input topictriggerFile - The file which contains the input that will be written to input topicPulsarAdminException - Unexpected errorpublic void uploadFunction(String sourceFile, String path) throws PulsarAdminException
FunctionsuploadFunction in interface FunctionssourceFile - dataFile that needs to be uploadedpath - Path where data should be storedPulsarAdminException - Unexpected errorpublic void downloadFunction(String destinationPath, String path) throws PulsarAdminException
FunctionsdownloadFunction in interface FunctionsdestinationPath - file where data should be downloaded topath - Path where data is locatedPulsarAdminException - Unexpected errorpublic static void mergeJson(String json, org.apache.pulsar.functions.shaded.com.google.protobuf.AbstractMessage.Builder builder) throws IOException
IOExceptionpublic static String printJson(org.apache.pulsar.functions.shaded.com.google.protobuf.MessageOrBuilder msg) throws IOException
IOExceptionCopyright © 2017–2018 Apache Software Foundation. All rights reserved.