Class EventingFunction
- java.lang.Object
-
- com.couchbase.client.java.manager.eventing.EventingFunction
-
@Uncommitted public class EventingFunction extends Object
An immutable representation of theEventingFunctionstored or to be stored on the server.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEventingFunction.BuilderThis builder allows to customize the properties of the eventing function.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<EventingFunctionBucketBinding>bucketBindings()The bucket bindings for the function.static EventingFunction.Builderbuilder(String name, String code, EventingFunctionKeyspace sourceKeyspace, EventingFunctionKeyspace metadataKeyspace)Creates aEventingFunction.Builderthat can be used to further customize theEventingFunctionbeyond the defaults.Stringcode()The actual javascript source code of the function.List<EventingFunctionConstantBinding>constantBindings()The constant bindings for the function.static EventingFunctioncreate(String name, String code, EventingFunctionKeyspace sourceKeyspace, EventingFunctionKeyspace metadataKeyspace)Creates a newEventingFunctionwith the minimal required properties.booleanenforceSchema()True if the schema should be enforced.static List<EventingFunction>fromExportedFunctions(byte[] encoded)Creates a list ofEventingFunctions from a raw JSON, usually exported from the server UI.static EventingFunctionfromFunction(byte[] encoded)Creates aEventingFunctionfrom a raw JSON.StringfunctionInstanceId()The function instance ID, provided by the server.longhandlerUuid()The function UUID, provided by the server.EventingFunctionKeyspacemetadataKeyspace()The keyspace where eventing stores the metadata for the function.Stringname()The name of the function.EventingFunctionSettingssettings()The custom function settings applied.EventingFunctionKeyspacesourceKeyspace()The source keyspace where the actual data is accessed from.StringtoString()List<EventingFunctionUrlBinding>urlBindings()The URL bindings for the function.Stringversion()The version of the function.
-
-
-
Method Detail
-
create
public static EventingFunction create(String name, String code, EventingFunctionKeyspace sourceKeyspace, EventingFunctionKeyspace metadataKeyspace)
Creates a newEventingFunctionwith the minimal required properties.- Parameters:
name- the name of the function.code- the code body of the function.sourceKeyspace- the keyspace from where the source data is coming from.metadataKeyspace- the keyspace where the function metadata is stored.- Returns:
- the created
EventingFunction.
-
builder
public static EventingFunction.Builder builder(String name, String code, EventingFunctionKeyspace sourceKeyspace, EventingFunctionKeyspace metadataKeyspace)
Creates aEventingFunction.Builderthat can be used to further customize theEventingFunctionbeyond the defaults.- Parameters:
name- the name of the function.code- the code body of the function.sourceKeyspace- the keyspace from where the source data is coming from.metadataKeyspace- the keyspace where the function metadata is stored.- Returns:
- the builder to customize.
-
fromFunction
@Volatile public static EventingFunction fromFunction(byte[] encoded)
Creates aEventingFunctionfrom a raw JSON.Note that the server exports it as a JSON array, so you might want to consider using
fromExportedFunctions(byte[])for those.- Parameters:
encoded- the encoded function to load.- Returns:
- the created
EventingFunction.
-
fromExportedFunctions
@Volatile public static List<EventingFunction> fromExportedFunctions(byte[] encoded)
Creates a list ofEventingFunctions from a raw JSON, usually exported from the server UI.- Parameters:
encoded- the encoded functions to load.- Returns:
- the created list of
EventingFunctions.
-
name
public String name()
The name of the function.
-
code
public String code()
The actual javascript source code of the function.
-
sourceKeyspace
public EventingFunctionKeyspace sourceKeyspace()
The source keyspace where the actual data is accessed from.
-
metadataKeyspace
public EventingFunctionKeyspace metadataKeyspace()
The keyspace where eventing stores the metadata for the function.
-
version
public String version()
The version of the function.
-
enforceSchema
public boolean enforceSchema()
True if the schema should be enforced.
-
handlerUuid
public long handlerUuid()
The function UUID, provided by the server.
-
functionInstanceId
public String functionInstanceId()
The function instance ID, provided by the server.
-
settings
public EventingFunctionSettings settings()
The custom function settings applied.
-
bucketBindings
public List<EventingFunctionBucketBinding> bucketBindings()
The bucket bindings for the function.
-
urlBindings
public List<EventingFunctionUrlBinding> urlBindings()
The URL bindings for the function.
-
constantBindings
public List<EventingFunctionConstantBinding> constantBindings()
The constant bindings for the function.
-
-