-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): add common task for store (#916)
- Loading branch information
1 parent
61e2ad9
commit b1db27b
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
core/src/main/java/io/kestra/core/models/tasks/common/FetchOutput.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package io.kestra.core.models.tasks.common; | ||
|
||
import io.kestra.core.models.tasks.Output; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
import java.net.URI; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* This output can be used as a result of a task that fetched data. | ||
* It is designed to be used in conjunction with a <code>fetchType</code> plugin property of type {@link FetchType}. | ||
*/ | ||
@Builder | ||
@Getter | ||
public class FetchOutput implements Output { | ||
@Schema( | ||
title = "List containing the fetched data", | ||
description = "Only populated if using `fetchType=FETCH`." | ||
) | ||
private List<Object> rows; | ||
|
||
@Schema( | ||
title = "Map containing the first row of fetched data", | ||
description = "Only populated if using `fetchType=FETCH_ONE`." | ||
) | ||
private Map<String, Object> row; | ||
|
||
@Schema( | ||
title = "The uri of stored data", | ||
description = "Only populated if using `fetchType=STORE`" | ||
) | ||
private URI uri; | ||
|
||
@Schema( | ||
title = "The size of the fetched rows" | ||
) | ||
private Long size; | ||
} |
19 changes: 19 additions & 0 deletions
19
core/src/main/java/io/kestra/core/models/tasks/common/FetchType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.kestra.core.models.tasks.common; | ||
|
||
/** | ||
* Enumeration that can be used to define how a task that fetch data will fetch it. | ||
* It is designed to be used in conjunction with a task output of type {@link FetchOutput}. | ||
*/ | ||
public enum FetchType { | ||
/** Fetched data will be stored in Kestra storage. */ | ||
STORE, | ||
|
||
/** Fetched data will be available as a list of objects. */ | ||
FETCH, | ||
|
||
/** Fetched data will be available as a single object. */ | ||
FETCH_ONE, | ||
|
||
/** Data will not be fetched. */ | ||
NONE | ||
} |