Skip to content

Commit

Permalink
feat(core): add common task for store (#916)
Browse files Browse the repository at this point in the history
  • Loading branch information
loicmathieu authored Jan 20, 2023
1 parent 61e2ad9 commit b1db27b
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
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;
}
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
}

0 comments on commit b1db27b

Please sign in to comment.