Skip to content

Commit

Permalink
feat: reintroduce input & output files
Browse files Browse the repository at this point in the history
  • Loading branch information
tchiotludo committed Nov 14, 2023
1 parent c0f93ee commit 70891fc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
13 changes: 8 additions & 5 deletions src/main/java/io/kestra/plugin/cloudquery/CloudQueryCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import io.kestra.core.models.annotations.Example;
import io.kestra.core.models.annotations.Plugin;
import io.kestra.core.models.annotations.PluginProperty;
import io.kestra.core.models.tasks.NamespaceFiles;
import io.kestra.core.models.tasks.NamespaceFilesInterface;
import io.kestra.core.models.tasks.RunnableTask;
import io.kestra.core.models.tasks.*;
import io.kestra.core.runners.RunContext;
import io.kestra.plugin.scripts.exec.scripts.models.DockerOptions;
import io.kestra.plugin.scripts.exec.scripts.models.RunnerType;
Expand Down Expand Up @@ -78,7 +76,7 @@
)
}
)
public class CloudQueryCLI extends AbstractCloudQueryCommand implements RunnableTask<ScriptOutput>, NamespaceFilesInterface {
public class CloudQueryCLI extends AbstractCloudQueryCommand implements RunnableTask<ScriptOutput>, NamespaceFilesInterface, InputFilesInterface, OutputFilesInterface {

@Schema(
title = "List of CloudQuery commands to run"
Expand All @@ -89,6 +87,10 @@ public class CloudQueryCLI extends AbstractCloudQueryCommand implements Runnable

private NamespaceFiles namespaceFiles;

private Object inputFiles;

private List<String> outputFiles;

@Override
public ScriptOutput run(RunContext runContext) throws Exception {
CommandsWrapper commands = new CommandsWrapper(runContext)
Expand All @@ -103,7 +105,8 @@ public ScriptOutput run(RunContext runContext) throws Exception {
)
)
.withEnv(this.getEnv())
.withNamespaceFiles(namespaceFiles);
.withInputFiles(inputFiles)
.withOutputFiles(outputFiles);

return commands.run();
}
Expand Down
15 changes: 10 additions & 5 deletions src/main/java/io/kestra/plugin/cloudquery/Sync.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
import io.kestra.core.models.annotations.Example;
import io.kestra.core.models.annotations.Plugin;
import io.kestra.core.models.annotations.PluginProperty;
import io.kestra.core.models.tasks.NamespaceFiles;
import io.kestra.core.models.tasks.NamespaceFilesInterface;
import io.kestra.core.models.tasks.RunnableTask;
import io.kestra.core.models.tasks.*;
import io.kestra.core.runners.RunContext;
import io.kestra.core.serializers.JacksonMapper;
import io.kestra.core.utils.IdUtils;
Expand Down Expand Up @@ -93,7 +91,7 @@
)
}
)
public class Sync extends AbstractCloudQueryCommand implements RunnableTask<ScriptOutput>, NamespaceFilesInterface {
public class Sync extends AbstractCloudQueryCommand implements RunnableTask<ScriptOutput>, NamespaceFilesInterface, InputFilesInterface, OutputFilesInterface {
private static final ObjectMapper OBJECT_MAPPER = JacksonMapper.ofYaml();
private static final String DB_FILENAME = "icrementaldb.sqlite";
private static final String CLOUD_QUERY_STATE = "CloudQueryState";
Expand All @@ -120,14 +118,21 @@ public class Sync extends AbstractCloudQueryCommand implements RunnableTask<Scri

private NamespaceFiles namespaceFiles;

private Object inputFiles;

private List<String> outputFiles;

@Override
public ScriptOutput run(RunContext runContext) throws Exception {
CommandsWrapper commands = new CommandsWrapper(runContext)
.withWarningOnStdErr(true)
.withRunnerType(RunnerType.DOCKER)
.withDockerOptions(injectDefaults(getDocker()))
.withEnv(this.getEnv())
.withNamespaceFiles(namespaceFiles);
.withNamespaceFiles(namespaceFiles)
.withInputFiles(inputFiles)
.withOutputFiles(outputFiles);

Path workingDirectory = commands.getWorkingDirectory();

File incrementalDBFile = new File(workingDirectory + "/" + DB_FILENAME);
Expand Down

0 comments on commit 70891fc

Please sign in to comment.