Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 28 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
plugins {
id 'com.github.jruby-gradle.base' version '2.0.0'
id 'checkstyle'
id 'java'
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.github.jruby-gradle:jruby-gradle-plugin:2.0.0"
}
configurations.classpath {
resolutionStrategy {
// Avoid build error with version conflicts
force 'org.ysb33r.gradle:grolifant:0.12.1'
dependencySubstitution {
substitute module('com.burgstaller:okhttp-digest') with module('io.github.rburgst:okhttp-digest:3.1.1')
}
}
}
}

apply plugin: 'com.github.jruby-gradle.base'
apply plugin: 'java'
apply plugin: 'checkstyle'

import com.github.jrubygradle.JRubyExec

group 'com.github.ttksm'
Expand All @@ -21,13 +41,13 @@ configurations {
}

dependencies {
compile 'org.embulk:embulk-core:0.9.23'
provided 'org.embulk:embulk-core:0.9.23'
compile 'software.amazon.awssdk:s3:2.+'
compile 'org.embulk:embulk-core:0.11.5'
provided 'org.embulk:embulk-core:0.11.5'
compile 'software.amazon.awssdk:s3:2.17.282'
testCompile 'org.junit.jupiter:junit-jupiter:5.+'
testCompile 'org.mockito:mockito-core:3.+'
testCompile 'org.mockito:mockito-junit-jupiter:3.+'
testCompile 'org.embulk:embulk-core:0.9.23:tests'
testCompile 'org.embulk:embulk-core:0.11.5'
compile 'software.amazon.awssdk:bom:2.17.282'
compile 'software.amazon.awssdk:sso:2.17.282'
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/org/embulk/output/s3v2/PluginTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
import org.embulk.config.ConfigDefault;
import org.embulk.config.Task;

import java.util.Optional;

public interface PluginTask
extends Task
{
@Config("endpoint")
@ConfigDefault("null")
public Optional<String> getEndpoint();

@Config("region")
public String getRegion();

Expand Down
10 changes: 9 additions & 1 deletion src/main/java/org/embulk/output/s3v2/s3/S3ClientManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.Optional;

import org.embulk.output.s3v2.util.ChunksizeComputation;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
Expand Down Expand Up @@ -39,7 +40,7 @@ public class S3ClientManager
{
private final S3Client s3;

public S3ClientManager(String regionName, boolean enableProfile, String profileName)
public S3ClientManager(Optional<String> endpoint, String regionName, boolean enableProfile, String profileName)
{
S3ClientBuilder builder = S3Client.builder();

Expand All @@ -58,6 +59,13 @@ public S3ClientManager(String regionName, boolean enableProfile, String profileN
}
builder = builder.credentialsProvider(provider);

if (endpoint.isPresent()) {
String ep = endpoint.get();
if (!ep.isEmpty()) {
builder = builder.endpointOverride(java.net.URI.create(ep));
}
}

s3 = builder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ abstract class AbstractStrategy implements TransactionalFileOutput

public AbstractStrategy(PluginTask task, int taskIndex)
{
s3 = new S3ClientManager(task.getRegion(), task.getEnableProfile(), task.getProfile());
s3 = new S3ClientManager(task.getEndpoint(), task.getRegion(), task.getEnableProfile(), task.getProfile());
this.task = task;
this.taskIndex = taskIndex;

Expand Down