Interface Functions


public interface Functions
Admin interface for function management.
  • Method Details

    • getFunctions

      List<String> getFunctions(String tenant, String namespace) throws PulsarAdminException
      Get the list of functions.

      Get the list of all the Pulsar functions.

      Response Example:

       ["f1", "f2", "f3"]
       
      Throws:
      PulsarAdminException.NotAuthorizedException - Don't have admin permission
      PulsarAdminException - Unexpected error
    • getFunctionsAsync

      CompletableFuture<List<String>> getFunctionsAsync(String tenant, String namespace)
      Get the list of functions asynchronously.

      Get the list of all the Pulsar functions.

      Response Example:

       ["f1", "f2", "f3"]
       
    • getFunction

      FunctionConfig getFunction(String tenant, String namespace, String function) throws PulsarAdminException
      Get the configuration for the specified function.

      Response Example:

       { serviceUrl : "http://my-broker.example.com:8080/" }
       
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      Returns:
      the function configuration
      Throws:
      PulsarAdminException.NotAuthorizedException - You don't have admin permission to get the configuration of the cluster
      PulsarAdminException.NotFoundException - Cluster doesn't exist
      PulsarAdminException - Unexpected error
    • getFunctionAsync

      CompletableFuture<FunctionConfig> getFunctionAsync(String tenant, String namespace, String function)
      Get the configuration for the specified function asynchronously.

      Response Example:

       { serviceUrl : "http://my-broker.example.com:8080/" }
       
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      Returns:
      the function configuration
    • createFunction

      void createFunction(FunctionConfig functionConfig, String fileName) throws PulsarAdminException
      Create a new function.
      Parameters:
      functionConfig - the function configuration object
      Throws:
      PulsarAdminException - Unexpected error
    • createFunctionAsync

      CompletableFuture<Void> createFunctionAsync(FunctionConfig functionConfig, String fileName)
      Create a new function asynchronously.
      Parameters:
      functionConfig - the function configuration object
    • createFunctionWithUrl

      void createFunctionWithUrl(FunctionConfig functionConfig, String pkgUrl) throws PulsarAdminException
      Create a new function with package url.

      Create a new function by providing url from which fun-pkg can be downloaded. supported url: http/file eg: File: file:/dir/fileName.jar Http: http://www.repo.com/fileName.jar

      Parameters:
      functionConfig - the function configuration object
      pkgUrl - url from which pkg can be downloaded
      Throws:
      PulsarAdminException
    • createFunctionWithUrlAsync

      CompletableFuture<Void> createFunctionWithUrlAsync(FunctionConfig functionConfig, String pkgUrl)
      Create a new function with package url asynchronously.

      Create a new function by providing url from which fun-pkg can be downloaded. supported url: http/file eg: File: file:/dir/fileName.jar Http: http://www.repo.com/fileName.jar

      Parameters:
      functionConfig - the function configuration object
      pkgUrl - url from which pkg can be downloaded
    • updateFunction

      void updateFunction(FunctionConfig functionConfig, String fileName) throws PulsarAdminException
      Update the configuration for a function.

      Parameters:
      functionConfig - the function configuration object
      Throws:
      PulsarAdminException.NotAuthorizedException - You don't have admin permission to create the cluster
      PulsarAdminException.NotFoundException - Cluster doesn't exist
      PulsarAdminException - Unexpected error
    • updateFunctionAsync

      CompletableFuture<Void> updateFunctionAsync(FunctionConfig functionConfig, String fileName)
      Update the configuration for a function asynchronously.

      Parameters:
      functionConfig - the function configuration object
    • updateFunction

      void updateFunction(FunctionConfig functionConfig, String fileName, UpdateOptions updateOptions) throws PulsarAdminException
      Update the configuration for a function.

      Parameters:
      functionConfig - the function configuration object
      updateOptions - options for the update operations
      Throws:
      PulsarAdminException.NotAuthorizedException - You don't have admin permission to create the cluster
      PulsarAdminException.NotFoundException - Cluster doesn't exist
      PulsarAdminException - Unexpected error
    • updateFunctionAsync

      CompletableFuture<Void> updateFunctionAsync(FunctionConfig functionConfig, String fileName, UpdateOptions updateOptions)
      Update the configuration for a function asynchronously.

      Parameters:
      functionConfig - the function configuration object
      updateOptions - options for the update operations
    • updateFunctionWithUrl

      void updateFunctionWithUrl(FunctionConfig functionConfig, String pkgUrl) throws PulsarAdminException
      Update the configuration for a function.

      Update a function by providing url from which fun-pkg can be downloaded. supported url: http/file eg: File: file:/dir/fileName.jar Http: http://www.repo.com/fileName.jar

      Parameters:
      functionConfig - the function configuration object
      pkgUrl - url from which pkg can be downloaded
      Throws:
      PulsarAdminException.NotAuthorizedException - You don't have admin permission to create the cluster
      PulsarAdminException.NotFoundException - Cluster doesn't exist
      PulsarAdminException - Unexpected error
    • updateFunctionWithUrlAsync

      CompletableFuture<Void> updateFunctionWithUrlAsync(FunctionConfig functionConfig, String pkgUrl)
      Update the configuration for a function asynchronously.

      Update a function by providing url from which fun-pkg can be downloaded. supported url: http/file eg: File: file:/dir/fileName.jar Http: http://www.repo.com/fileName.jar

      Parameters:
      functionConfig - the function configuration object
      pkgUrl - url from which pkg can be downloaded
    • updateFunctionWithUrl

      void updateFunctionWithUrl(FunctionConfig functionConfig, String pkgUrl, UpdateOptions updateOptions) throws PulsarAdminException
      Update the configuration for a function.

      Update a function by providing url from which fun-pkg can be downloaded. supported url: http/file eg: File: file:/dir/fileName.jar Http: http://www.repo.com/fileName.jar

      Parameters:
      functionConfig - the function configuration object
      pkgUrl - url from which pkg can be downloaded
      updateOptions - options for the update operations
      Throws:
      PulsarAdminException.NotAuthorizedException - You don't have admin permission to create the cluster
      PulsarAdminException.NotFoundException - Cluster doesn't exist
      PulsarAdminException - Unexpected error
    • updateFunctionWithUrlAsync

      CompletableFuture<Void> updateFunctionWithUrlAsync(FunctionConfig functionConfig, String pkgUrl, UpdateOptions updateOptions)
      Update the configuration for a function asynchronously.

      Update a function by providing url from which fun-pkg can be downloaded. supported url: http/file eg: File: file:/dir/fileName.jar Http: http://www.repo.com/fileName.jar

      Parameters:
      functionConfig - the function configuration object
      pkgUrl - url from which pkg can be downloaded
      updateOptions - options for the update operations
    • deleteFunction

      void deleteFunction(String tenant, String namespace, String function) throws PulsarAdminException
      Delete an existing function.

      Delete a function

      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      Throws:
      PulsarAdminException.NotAuthorizedException - You don't have admin permission
      PulsarAdminException.NotFoundException - Cluster does not exist
      PulsarAdminException.PreconditionFailedException - Cluster is not empty
      PulsarAdminException - Unexpected error
    • deleteFunctionAsync

      CompletableFuture<Void> deleteFunctionAsync(String tenant, String namespace, String function)
      Delete an existing function asynchronously.

      Delete a function

      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
    • getFunctionStatus

      FunctionStatus getFunctionStatus(String tenant, String namespace, String function) throws PulsarAdminException
      Gets the current status of a function.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      Throws:
      PulsarAdminException - Unexpected error
    • getFunctionStatusAsync

      CompletableFuture<FunctionStatus> getFunctionStatusAsync(String tenant, String namespace, String function)
      Gets the current status of a function asynchronously.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
    • getFunctionStatus

      FunctionStatus.FunctionInstanceStatus.FunctionInstanceStatusData getFunctionStatus(String tenant, String namespace, String function, int id) throws PulsarAdminException
      Gets the current status of a function instance.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      id - Function instance-id
      Returns:
      Throws:
      PulsarAdminException
    • getFunctionStatusAsync

      CompletableFuture<FunctionStatus.FunctionInstanceStatus.FunctionInstanceStatusData> getFunctionStatusAsync(String tenant, String namespace, String function, int id)
      Gets the current status of a function instance asynchronously.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      id - Function instance-id
      Returns:
    • getFunctionStats

      FunctionInstanceStatsData getFunctionStats(String tenant, String namespace, String function, int id) throws PulsarAdminException
      Gets the current stats of a function instance.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      id - Function instance-id
      Returns:
      Throws:
      PulsarAdminException
    • getFunctionStatsAsync

      CompletableFuture<FunctionInstanceStatsData> getFunctionStatsAsync(String tenant, String namespace, String function, int id)
      Gets the current stats of a function instance asynchronously.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      id - Function instance-id
      Returns:
    • getFunctionStats

      FunctionStats getFunctionStats(String tenant, String namespace, String function) throws PulsarAdminException
      Gets the current stats of a function.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      Returns:
      Throws:
      PulsarAdminException
    • getFunctionStatsAsync

      CompletableFuture<FunctionStats> getFunctionStatsAsync(String tenant, String namespace, String function)
      Gets the current stats of a function asynchronously.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      Returns:
    • restartFunction

      void restartFunction(String tenant, String namespace, String function, int instanceId) throws PulsarAdminException
      Restart function instance.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      instanceId - Function instanceId
      Throws:
      PulsarAdminException - Unexpected error
    • restartFunctionAsync

      CompletableFuture<Void> restartFunctionAsync(String tenant, String namespace, String function, int instanceId)
      Restart function instance asynchronously.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      instanceId - Function instanceId
    • restartFunction

      void restartFunction(String tenant, String namespace, String function) throws PulsarAdminException
      Restart all function instances.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      Throws:
      PulsarAdminException - Unexpected error
    • restartFunctionAsync

      CompletableFuture<Void> restartFunctionAsync(String tenant, String namespace, String function)
      Restart all function instances asynchronously.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
    • stopFunction

      void stopFunction(String tenant, String namespace, String function, int instanceId) throws PulsarAdminException
      Stop function instance.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      instanceId - Function instanceId
      Throws:
      PulsarAdminException - Unexpected error
    • stopFunctionAsync

      CompletableFuture<Void> stopFunctionAsync(String tenant, String namespace, String function, int instanceId)
      Stop function instance asynchronously.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      instanceId - Function instanceId
    • startFunction

      void startFunction(String tenant, String namespace, String function) throws PulsarAdminException
      Start all function instances.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      Throws:
      PulsarAdminException - Unexpected error
    • startFunctionAsync

      CompletableFuture<Void> startFunctionAsync(String tenant, String namespace, String function)
      Start all function instances asynchronously.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
    • startFunction

      void startFunction(String tenant, String namespace, String function, int instanceId) throws PulsarAdminException
      Start function instance.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      instanceId - Function instanceId
      Throws:
      PulsarAdminException - Unexpected error
    • startFunctionAsync

      CompletableFuture<Void> startFunctionAsync(String tenant, String namespace, String function, int instanceId)
      Start function instance asynchronously.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      instanceId - Function instanceId
    • stopFunction

      void stopFunction(String tenant, String namespace, String function) throws PulsarAdminException
      Stop all function instances.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      Throws:
      PulsarAdminException - Unexpected error
    • stopFunctionAsync

      CompletableFuture<Void> stopFunctionAsync(String tenant, String namespace, String function)
      Stop all function instances asynchronously.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
    • triggerFunction

      String triggerFunction(String tenant, String namespace, String function, String topic, String triggerValue, String triggerFile) throws PulsarAdminException
      Triggers the function by writing to the input topic.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      triggerValue - The input that will be written to input topic
      triggerFile - The file which contains the input that will be written to input topic
      Throws:
      PulsarAdminException - Unexpected error
    • triggerFunctionAsync

      CompletableFuture<String> triggerFunctionAsync(String tenant, String namespace, String function, String topic, String triggerValue, String triggerFile)
      Triggers the function by writing to the input topic asynchronously.
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      triggerValue - The input that will be written to input topic
      triggerFile - The file which contains the input that will be written to input topic
    • uploadFunction

      void uploadFunction(String sourceFile, String path) throws PulsarAdminException
      Upload Data.
      Parameters:
      sourceFile - dataFile that needs to be uploaded
      path - Path where data should be stored
      Throws:
      PulsarAdminException - Unexpected error
    • uploadFunctionAsync

      CompletableFuture<Void> uploadFunctionAsync(String sourceFile, String path)
      Upload Data asynchronously.
      Parameters:
      sourceFile - dataFile that needs to be uploaded
      path - Path where data should be stored
    • downloadFunction

      void downloadFunction(String destinationFile, String path) throws PulsarAdminException
      Download Function Code.
      Parameters:
      destinationFile - file where data should be downloaded to
      path - Path where data is located
      Throws:
      PulsarAdminException - Unexpected error
    • downloadFunctionAsync

      CompletableFuture<Void> downloadFunctionAsync(String destinationFile, String path)
      Download Function Code.
      Parameters:
      destinationFile - file where data should be downloaded to
      path - Path where data is located
    • downloadFunction

      void downloadFunction(String destinationFile, String tenant, String namespace, String function) throws PulsarAdminException
      Download Function Code.
      Parameters:
      destinationFile - file where data should be downloaded to
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      Throws:
      PulsarAdminException
    • downloadFunctionAsync

      CompletableFuture<Void> downloadFunctionAsync(String destinationFile, String tenant, String namespace, String function)
      Download Function Code asynchronously.
      Parameters:
      destinationFile - file where data should be downloaded to
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
    • getConnectorsList

      Deprecated.
      Deprecated in favor of getting sources and sinks for their own APIs.

      Fetches a list of supported Pulsar IO connectors currently running in cluster mode

      Throws:
      PulsarAdminException - Unexpected error
    • getSources

      Deprecated.
      Deprecated in favor of getting sources and sinks for their own APIs.

      Fetches a list of supported Pulsar IO sources currently running in cluster mode

      Throws:
      PulsarAdminException - Unexpected error
    • getSinks

      Deprecated.
      Deprecated in favor of getting sources and sinks for their own APIs.

      Fetches a list of supported Pulsar IO sinks currently running in cluster mode

      Throws:
      PulsarAdminException - Unexpected error
    • getFunctionState

      FunctionState getFunctionState(String tenant, String namespace, String function, String key) throws PulsarAdminException
      Fetch the current state associated with a Pulsar Function.

      Response Example:

       { "value : 12, version : 2"}
       
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      key - Key name of State
      Returns:
      the function configuration
      Throws:
      PulsarAdminException.NotAuthorizedException - You don't have admin permission to get the configuration of the cluster
      PulsarAdminException.NotFoundException - Cluster doesn't exist
      PulsarAdminException - Unexpected error
    • getFunctionStateAsync

      CompletableFuture<FunctionState> getFunctionStateAsync(String tenant, String namespace, String function, String key)
      Fetch the current state associated with a Pulsar Function asynchronously.

      Response Example:

       { "value : 12, version : 2"}
       
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      key - Key name of State
      Returns:
      the function configuration
    • putFunctionState

      void putFunctionState(String tenant, String namespace, String function, FunctionState state) throws PulsarAdminException
      Puts the given state associated with a Pulsar Function.

      Response Example:

       { "value : 12, version : 2"}
       
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      state - FunctionState
      Throws:
      PulsarAdminException.NotAuthorizedException - You don't have admin permission to get the configuration of the cluster
      PulsarAdminException.NotFoundException - Cluster doesn't exist
      PulsarAdminException - Unexpected error
    • putFunctionStateAsync

      CompletableFuture<Void> putFunctionStateAsync(String tenant, String namespace, String function, FunctionState state)
      Puts the given state associated with a Pulsar Function asynchronously.

      Response Example:

       { "value : 12, version : 2"}
       
      Parameters:
      tenant - Tenant name
      namespace - Namespace name
      function - Function name
      state - FunctionState