Package com.influxdb.client
Interface InvokableScriptsApi
@ThreadSafe
public interface InvokableScriptsApi
Use API invokable scripts to create custom InfluxDB API endpoints that query, process, and shape data.
API invokable scripts let you assign scripts to API endpoints and then execute them as standard REST operations in InfluxDB Cloud.
- Author:
- Jakub Bednar (bednar@github) (03/21/2022 07:54)
-
Method Summary
Modifier and TypeMethodDescriptioncreateScript
(ScriptCreateRequest createRequest) Create a script.void
deleteScript
(String scriptId) Delete a script.List scripts.findScripts
(InvokableScriptsQuery query) List scripts.invokeScript
(String scriptId, Map<String, Object> params) Executes the script and synchronously map whole response toList<FluxTable>
.<M> List
<M> Executes the script and synchronously map whole response to list of object with given type.<M> void
invokeScript
(String scriptId, Map<String, Object> params, Class<M> measurementType, BiConsumer<Cancellable, M> onNext) Executes the script and asynchronously stream POJO classes toonNext
consumer.<M> void
invokeScript
(String scriptId, Map<String, Object> params, Class<M> measurementType, BiConsumer<Cancellable, M> onNext, Consumer<? super Throwable> onError, Runnable onComplete) Executes the script and asynchronously stream POJO classes toonNext
consumer.void
invokeScript
(String scriptId, Map<String, Object> params, BiConsumer<Cancellable, FluxRecord> onNext) Executes the script and asynchronously streamFluxRecord
s toonNext
consumer.void
invokeScript
(String scriptId, Map<String, Object> params, BiConsumer<Cancellable, FluxRecord> onNext, Consumer<? super Throwable> onError, Runnable onComplete) Executes the script and asynchronously streamFluxRecord
s toonNext
consumer.invokeScriptRaw
(String scriptId, Map<String, Object> params) Executes the script and synchronously map whole response toString
result.void
invokeScriptRaw
(String scriptId, Map<String, Object> params, BiConsumer<Cancellable, String> onResponse) Executes the script and asynchronously stream response (line by line) toonResponse
.void
invokeScriptRaw
(String scriptId, Map<String, Object> params, BiConsumer<Cancellable, String> onResponse, Consumer<? super Throwable> onError, Runnable onComplete) Executes the script and asynchronously stream response (line by line) toonResponse
.updateScript
(String scriptId, ScriptUpdateRequest updateRequest) Update a script.
-
Method Details
-
createScript
Create a script.- Parameters:
createRequest
- The script to create. (required)- Returns:
- The created script.
-
updateScript
Update a script.- Parameters:
scriptId
- The ID of the script to update. (required)updateRequest
- Script updates to apply (required)- Returns:
- The updated script.
-
findScripts
List scripts.- Returns:
- scripts
-
findScripts
List scripts.- Parameters:
query
- to filtering results- Returns:
- scripts
-
deleteScript
Delete a script.- Parameters:
scriptId
- The ID of the script to delete. (required)
-
invokeScript
@Nonnull List<FluxTable> invokeScript(@Nonnull String scriptId, @Nullable Map<String, Object> params) Executes the script and synchronously map whole response toList<FluxTable>
.NOTE: This method is not intended for large query results. Use
invokeScript(String, Map, BiConsumer, Consumer, Runnable)
for large data streaming.- Parameters:
scriptId
- The ID of the script to invoke. (required)params
- bind parameters- Returns:
List<FluxTable>
-
invokeScript
void invokeScript(@Nonnull String scriptId, @Nullable Map<String, Object> params, @Nonnull BiConsumer<Cancellable, FluxRecord> onNext) Executes the script and asynchronously streamFluxRecord
s toonNext
consumer.- Parameters:
scriptId
- The ID of the script to invoke. (required)params
- bind parametersonNext
- the callback to consume the FluxRecord result with capability to discontinue a streaming invocation
-
invokeScript
void invokeScript(@Nonnull String scriptId, @Nullable Map<String, Object> params, @Nonnull BiConsumer<Cancellable, FluxRecord> onNext, @Nonnull Consumer<? super Throwable> onError, @Nonnull Runnable onComplete) Executes the script and asynchronously streamFluxRecord
s toonNext
consumer.- Parameters:
scriptId
- The ID of the script to invoke. (required)params
- bind parametersonNext
- the callback to consume the FluxRecord result with capability to discontinue a streaming invocationonError
- the callback to consume any error notificationonComplete
- the callback to consume a notification about successfully end of stream
-
invokeScript
@Nonnull <M> List<M> invokeScript(@Nonnull String scriptId, @Nullable Map<String, Object> params, @Nonnull Class<M> measurementType) Executes the script and synchronously map whole response to list of object with given type.NOTE: This method is not intended for large query results. Use
invokeScript(String, Map, Class, BiConsumer, Consumer, Runnable)
for large data streaming.- Type Parameters:
M
- the type of the measurement (POJO)- Parameters:
scriptId
- The ID of the script to invoke. (required)params
- bind parametersmeasurementType
- the type of measurement- Returns:
List<T>
-
invokeScript
<M> void invokeScript(@Nonnull String scriptId, @Nullable Map<String, Object> params, @Nonnull Class<M> measurementType, @Nonnull BiConsumer<Cancellable, M> onNext) Executes the script and asynchronously stream POJO classes toonNext
consumer.- Type Parameters:
M
- the type of the measurement (POJO)- Parameters:
scriptId
- The ID of the script to invoke. (required)params
- bind parametersmeasurementType
- the type of measurementonNext
- the callback to consume the mapped Measurements with capability to discontinue a streaming invocation
-
invokeScript
<M> void invokeScript(@Nonnull String scriptId, @Nullable Map<String, Object> params, @Nonnull Class<M> measurementType, @Nonnull BiConsumer<Cancellable, M> onNext, @Nonnull Consumer<? super Throwable> onError, @Nonnull Runnable onComplete) Executes the script and asynchronously stream POJO classes toonNext
consumer.- Type Parameters:
M
- the type of the measurement (POJO)- Parameters:
scriptId
- The ID of the script to invoke. (required)params
- bind parametersmeasurementType
- the type of measurementonNext
- the callback to consume the mapped Measurements with capability to discontinue a streaming invocationonError
- the callback to consume any error notificationonComplete
- the callback to consume a notification about successfully end of stream
-
invokeScriptRaw
Executes the script and synchronously map whole response toString
result.NOTE: This method is not intended for large query results. Use
invokeScriptRaw(String, Map, BiConsumer, Consumer, Runnable)
for large data streaming.- Parameters:
scriptId
- The ID of the script to invoke. (required)params
- bind parameters- Returns:
- the raw response that matched the invocation
-
invokeScriptRaw
void invokeScriptRaw(@Nonnull String scriptId, @Nullable Map<String, Object> params, @Nonnull BiConsumer<Cancellable, String> onResponse) Executes the script and asynchronously stream response (line by line) toonResponse
.- Parameters:
scriptId
- The ID of the script to invoke. (required)params
- bind parametersonResponse
- callback to consume the response line by line with capability to discontinue a streaming query
-
invokeScriptRaw
void invokeScriptRaw(@Nonnull String scriptId, @Nullable Map<String, Object> params, @Nonnull BiConsumer<Cancellable, String> onResponse, @Nonnull Consumer<? super Throwable> onError, @Nonnull Runnable onComplete) Executes the script and asynchronously stream response (line by line) toonResponse
.- Parameters:
scriptId
- The ID of the script to invoke. (required)params
- bind parametersonResponse
- callback to consume the response line by line with capability to discontinue a streaming queryonError
- the callback to consume any error notificationonComplete
- the callback to consume a notification about successfully end of stream
-