kestra-io / kestra-io/plugin-oci
[Plugin] OCI — Functions (Serverless)
- Dominant language
- Java
- Stars
- 0
- Forks
- 0
- Avg merge
- 18h 3m
- Merged PRs (30d)
- 1
Description
## Summary
The OCI Functions sub-plugin for `plugin-oci` lets Kestra flows invoke OCI serverless functions directly as typed tasks, treating a function invocation like any other task with typed inputs and outputs. This bridges Kestra's orchestration layer with lightweight OCI compute, enabling teams to trigger data processing functions, ML inference endpoints, or webhook handlers without managing infrastructure.
## Motivation
Platform teams deploying microservices on OCI Functions need to invoke those functions from data pipelines or CI/CD workflows. Currently this requires custom HTTP tasks pointing at the Functions invoke URL with manual signature generation, which is fragile and hard to maintain. A native `InvokeFunction` task handles OCI request signing transparently and exposes the function response as a structured Kestra output.
## Context
Part of the OCI Plugin Suite EPIC: https://github.com/kestra-io/plugin-oci/issues/2
Reference: `plugin-aws` Lambda `Invoke` task.
Note: OCI Functions uses `ResourcePrincipalAuthenticationDetailsProvider` when invoked from within OCI; the plugin should support both config-file and resource principal auth.
## API Reference
- **Official docs**: https://docs.oracle.com/en-us/iaas/api/#/en/functions/latest/
- **Authentication**: Config-file, resource principal (`ResourcePrincipalAuthenticationDetailsProvider`), or `SimpleAuthenticationDetailsProvider`
- **Base URL pattern**: `https://functions.{region}.oci.oraclecloud.com/20181201/`
- **SDK**: OCI Java SDK v3.87.0 via BOM
## Gradle Dependencies
Add to `build.gradle`:
```groovy
// OCI Java SDK BOM
implementation platform("com.oracle.oci.sdk:oci-java-sdk-bom:3.87.0")
// Functions management + invocation
implementation "com.oracle.oci.sdk:oci-java-sdk-functions"
implementation "com.oracle.oci.sdk:oci-java-sdk-common"
```
## Plugin Structure
- **Repository**: `plugin-oci`
- **Namespace**: `io.kestra.plugin.oci.functions`
- **Sub-plugins**: `functions`
## Suggested Tasks
1. `InvokeFunction` — invoke a function by OCID, pass payload, return response body as output
2. `GetFunction` — fetch function details (invoke endpoint, memory, timeout)
3. `ListFunctions` — list functions in an application
4. `CreateFunction` — create a new function in an application (for IaC-style flows)
5. `DeleteFunction` — delete a function
6. Add `FunctionInvocationTrigger` — schedule periodic function invocations as a Kestra trigger
7. Write unit + integration tests
## YAML Examples
### Example 1 — Invoke a function with a JSON payload and use the response
```yaml
id: invoke_oci_function
namespace: company.platform
inputs:
- id: record_id
type: STRING
tasks:
- id: invoke
type: io.kestra.plugin.oci.functions.InvokeFunction
region: eu-frankfurt-1
tenancyOcid: "{{ secret('OCI_TENANCY_OCID') }}"
userId: "{{ secret('OCI_USER_OCID') }}"
fingerprint: "{{ secret('OCI_FINGERPRINT') }}"
privateKey: "{{ secret('OCI_PRIVATE_KEY') }}"
functionId: "{{ secret('OCI_FUNCTION_OCID') }}"
body:
recordId: "{{ inputs.record_id }}"
action: process
- id: log_response
type: io.kestra.plugin.core.log.Log
message: "Function response: {{ outputs.invoke.body }}"
```
### Example 2 — List all functions in an application
```yaml
id: list_oci_functions
namespace: company.platform
tasks:
- id: list
type: io.kestra.plugin.oci.functions.ListFunctions
region: eu-frankfurt-1
tenancyOcid: "{{ secret('OCI_TENANCY_OCID') }}"
userId: "{{ secret('OCI_USER_OCID') }}"
fingerprint: "{{ secret('OCI_FINGERPRINT') }}"
privateKey: "{{ secret('OCI_PRIVATE_KEY') }}"
applicationId: "{{ secret('OCI_APP_OCID') }}"
- id: log
type: io.kestra.plugin.core.log.Log
message: "Found {{ outputs.list.count }} functions"
```
### Example 3 — Periodically invoke a function on a schedule
```yaml
id: scheduled_function_invocation
namespace: company.platform
triggers:
- id: every_hour
type: io.kestra.plugin.oci.functions.FunctionInvocationTrigger
region: eu-frankfurt-1
tenancyOcid: "{{ secret('OCI_TENANCY_OCID') }}"
userId: "{{ secret('OCI_USER_OCID') }}"
fingerprint: "{{ secret('OCI_FINGERPRINT') }}"
privateKey: "{{ secret('OCI_PRIVATE_KEY') }}"
functionId: "{{ secret('OCI_FUNCTION_OCID') }}"
body: {}
interval: PT1H
tasks:
- id: handle_result
type: io.kestra.plugin.core.log.Log
message: "Scheduled function returned: {{ trigger.body }}"
```
## Acceptance Criteria
- [ ] `InvokeFunction`, `GetFunction`, `ListFunctions`, `CreateFunction`, `DeleteFunction` tasks implemented
- [ ] `FunctionInvocationTrigger` implemented
- [ ] `InvokeFunction` returns the response body as a typed output (string or parsed JSON)
- [ ] Both config-file and resource principal authentication supported
- [ ] All `Property` fields support Kestra expression language
- [ ] Unit + integration tests pass (`./gradlew test`)
- [ ] `package-info.java` with `@PluginSubGroup(category = PluginSubGroup.PluginCategory.CLOUD)`
- [ ] Build passes with `./gradlew build`
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the plugin-aws Lambda Invoke task as the issue's reference, then inspect build.gradle and the planned package-info.java location in plugin-oci. Implement the listed Functions tasks and trigger with the specified authentication and expression requirements, add unit and integration tests, and run ./gradlew test followed by ./gradlew build.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- cloud
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100