embulk-input-s3 0.2.11 → 0.2.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/classpath/aws-java-sdk-core-1.11.253.jar +0 -0
- data/classpath/aws-java-sdk-kms-1.11.253.jar +0 -0
- data/classpath/aws-java-sdk-s3-1.11.253.jar +0 -0
- data/classpath/commons-codec-1.9.jar +0 -0
- data/classpath/embulk-input-s3-0.2.12.jar +0 -0
- data/classpath/{embulk-util-aws-credentials-0.2.11.jar → embulk-util-aws-credentials-0.2.12.jar} +0 -0
- data/classpath/httpclient-4.5.2.jar +0 -0
- data/classpath/httpcore-4.4.4.jar +0 -0
- data/classpath/ion-java-1.0.2.jar +0 -0
- data/classpath/jackson-annotations-2.6.0.jar +0 -0
- data/classpath/jackson-core-2.6.7.jar +0 -0
- data/classpath/jackson-databind-2.6.7.1.jar +0 -0
- data/classpath/jackson-dataformat-cbor-2.6.7.jar +0 -0
- data/classpath/jmespath-java-1.11.253.jar +0 -0
- data/src/main/java/org/embulk/input/s3/AbstractS3FileInputPlugin.java +23 -15
- data/src/main/java/org/embulk/input/s3/S3FileInputPlugin.java +20 -6
- metadata +16 -10
- data/classpath/aws-java-sdk-core-1.10.33.jar +0 -0
- data/classpath/aws-java-sdk-kms-1.10.33.jar +0 -0
- data/classpath/aws-java-sdk-s3-1.10.33.jar +0 -0
- data/classpath/commons-codec-1.6.jar +0 -0
- data/classpath/embulk-input-s3-0.2.11.jar +0 -0
- data/classpath/httpclient-4.3.6.jar +0 -0
- data/classpath/httpcore-4.3.3.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99dc2bbe73f61b74e92b3f345c963b73ebb75bd0
|
4
|
+
data.tar.gz: 6c42a7ae99a51dad4d9ec4c20b629a9b235db8b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dee445a23d719bb9f7bf1fd9dde6f0d25faa2e38e8eec567e8d7a61518841f933caf8e35ce79a27a70327d7b75ab65eb1cb54327d7d4e664c848ed3fc24b265
|
7
|
+
data.tar.gz: 728534ca59e6c3d334335f821d0834bc04f8fd76c5934adfa62132b638a81b1b6dc12874ee718d8352adabe1de3bf26eee3f1a8b3bcf8d117f74076cdc4a3935
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/classpath/{embulk-util-aws-credentials-0.2.11.jar → embulk-util-aws-credentials-0.2.12.jar}
RENAMED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,21 +1,18 @@
|
|
1
1
|
package org.embulk.input.s3;
|
2
2
|
|
3
3
|
import java.util.List;
|
4
|
-
import java.util.ArrayList;
|
5
|
-
import java.util.Collections;
|
6
4
|
import java.util.Iterator;
|
7
5
|
import java.io.IOException;
|
8
6
|
import java.io.InterruptedIOException;
|
9
7
|
import java.io.InputStream;
|
10
8
|
|
9
|
+
import com.amazonaws.services.s3.AmazonS3;
|
10
|
+
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
|
11
11
|
import com.google.common.annotations.VisibleForTesting;
|
12
|
-
import com.google.common.collect.ImmutableList;
|
13
12
|
import com.google.common.base.Optional;
|
14
13
|
import com.google.common.base.Throwables;
|
15
14
|
import org.slf4j.Logger;
|
16
|
-
import com.amazonaws.auth.AWSCredentials;
|
17
15
|
import com.amazonaws.auth.AWSCredentialsProvider;
|
18
|
-
import com.amazonaws.services.s3.AmazonS3Client;
|
19
16
|
import com.amazonaws.services.s3.model.ListObjectsRequest;
|
20
17
|
import com.amazonaws.services.s3.model.S3ObjectSummary;
|
21
18
|
import com.amazonaws.services.s3.model.ObjectListing;
|
@@ -44,8 +41,6 @@ import org.embulk.spi.util.RetryExecutor.RetryGiveupException;
|
|
44
41
|
import org.embulk.util.aws.credentials.AwsCredentials;
|
45
42
|
import org.embulk.util.aws.credentials.AwsCredentialsTask;
|
46
43
|
|
47
|
-
import static com.amazonaws.Protocol.HTTP;
|
48
|
-
import static com.amazonaws.Protocol.HTTPS;
|
49
44
|
import static org.embulk.spi.util.RetryExecutor.retryExecutor;
|
50
45
|
|
51
46
|
public abstract class AbstractS3FileInputPlugin
|
@@ -133,9 +128,22 @@ public abstract class AbstractS3FileInputPlugin
|
|
133
128
|
// do nothing
|
134
129
|
}
|
135
130
|
|
136
|
-
|
137
|
-
|
138
|
-
|
131
|
+
/**
|
132
|
+
* Provide an overridable default client.
|
133
|
+
* Since this returns an immutable object, it is not for any further customizations by mutating,
|
134
|
+
* e.g., {@link AmazonS3#setEndpoint} will throw a runtime {@link UnsupportedOperationException}
|
135
|
+
* Subclass's customization should be done through {@link AbstractS3FileInputPlugin#defaultS3ClientBuilder}.
|
136
|
+
*/
|
137
|
+
protected AmazonS3 newS3Client(PluginTask task) {
|
138
|
+
return defaultS3ClientBuilder(task).build();
|
139
|
+
}
|
140
|
+
|
141
|
+
/** A base builder for the subclasses to then customize. */
|
142
|
+
protected AmazonS3ClientBuilder defaultS3ClientBuilder(PluginTask task) {
|
143
|
+
return AmazonS3ClientBuilder
|
144
|
+
.standard()
|
145
|
+
.withCredentials(getCredentialsProvider(task))
|
146
|
+
.withClientConfiguration(getClientConfiguration(task));
|
139
147
|
}
|
140
148
|
|
141
149
|
protected AWSCredentialsProvider getCredentialsProvider(PluginTask task)
|
@@ -187,7 +195,7 @@ public abstract class AbstractS3FileInputPlugin
|
|
187
195
|
private FileList listFiles(PluginTask task)
|
188
196
|
{
|
189
197
|
try {
|
190
|
-
|
198
|
+
AmazonS3 client = newS3Client(task);
|
191
199
|
String bucketName = task.getBucket();
|
192
200
|
|
193
201
|
if (task.getPathPrefix().equals("/")) {
|
@@ -218,7 +226,7 @@ public abstract class AbstractS3FileInputPlugin
|
|
218
226
|
* The resulting list does not include the file that's size == 0.
|
219
227
|
*/
|
220
228
|
public static void listS3FilesByPrefix(FileList.Builder builder,
|
221
|
-
|
229
|
+
AmazonS3 client, String bucketName,
|
222
230
|
String prefix, Optional<String> lastPath)
|
223
231
|
{
|
224
232
|
String lastKey = lastPath.orNull();
|
@@ -250,11 +258,11 @@ public abstract class AbstractS3FileInputPlugin
|
|
250
258
|
{
|
251
259
|
private final Logger log = Exec.getLogger(S3InputStreamReopener.class);
|
252
260
|
|
253
|
-
private final
|
261
|
+
private final AmazonS3 client;
|
254
262
|
private final GetObjectRequest request;
|
255
263
|
private final long contentLength;
|
256
264
|
|
257
|
-
public S3InputStreamReopener(
|
265
|
+
public S3InputStreamReopener(AmazonS3 client, GetObjectRequest request, long contentLength)
|
258
266
|
{
|
259
267
|
this.client = client;
|
260
268
|
this.request = request;
|
@@ -336,7 +344,7 @@ public abstract class AbstractS3FileInputPlugin
|
|
336
344
|
private class SingleFileProvider
|
337
345
|
implements InputStreamFileInput.Provider
|
338
346
|
{
|
339
|
-
private
|
347
|
+
private AmazonS3 client;
|
340
348
|
private final String bucket;
|
341
349
|
private final Iterator<String> iterator;
|
342
350
|
|
@@ -1,10 +1,16 @@
|
|
1
1
|
package org.embulk.input.s3;
|
2
2
|
|
3
|
-
import com.
|
3
|
+
import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration;
|
4
|
+
import com.amazonaws.services.s3.AmazonS3;
|
4
5
|
import com.amazonaws.services.s3.AmazonS3Client;
|
6
|
+
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
|
7
|
+
import com.google.common.base.Optional;
|
5
8
|
import org.embulk.config.Config;
|
6
9
|
import org.embulk.config.ConfigDefault;
|
7
|
-
|
10
|
+
|
11
|
+
import static com.amazonaws.services.s3.AmazonS3Client.S3_SERVICE_NAME;
|
12
|
+
import static com.amazonaws.util.AwsHostNameUtils.parseRegion;
|
13
|
+
import static com.amazonaws.util.RuntimeHttpUtils.toUri;
|
8
14
|
|
9
15
|
public class S3FileInputPlugin
|
10
16
|
extends AbstractS3FileInputPlugin
|
@@ -24,16 +30,24 @@ public class S3FileInputPlugin
|
|
24
30
|
}
|
25
31
|
|
26
32
|
@Override
|
27
|
-
protected
|
33
|
+
protected AmazonS3 newS3Client(PluginTask task)
|
28
34
|
{
|
29
35
|
S3PluginTask t = (S3PluginTask) task;
|
30
36
|
|
31
|
-
|
37
|
+
AmazonS3ClientBuilder builder = super.defaultS3ClientBuilder(t);
|
32
38
|
|
33
39
|
if (t.getEndpoint().isPresent()) {
|
34
|
-
|
40
|
+
String endpoint = t.getEndpoint().get();
|
41
|
+
builder.setEndpointConfiguration(new EndpointConfiguration(
|
42
|
+
endpoint,
|
43
|
+
// Although client will treat endpoint's region as the signer region
|
44
|
+
// if we left this as null, but such that behaviour is undocumented,
|
45
|
+
// so it is explicitly calculated here for future-proofing.
|
46
|
+
parseRegion(
|
47
|
+
toUri(endpoint, getClientConfiguration(task)).getHost(),
|
48
|
+
S3_SERVICE_NAME)));
|
35
49
|
}
|
36
50
|
|
37
|
-
return
|
51
|
+
return builder.build();
|
38
52
|
}
|
39
53
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -57,15 +57,21 @@ files:
|
|
57
57
|
- src/test/java/org/embulk/input/s3/TestS3FileInputPlugin.java
|
58
58
|
- src/test/java/org/embulk/input/s3/TestS3InputStreamReopener.java
|
59
59
|
- src/test/resources/sample_01.csv
|
60
|
-
- classpath/aws-java-sdk-core-1.
|
61
|
-
- classpath/aws-java-sdk-kms-1.
|
62
|
-
- classpath/aws-java-sdk-s3-1.
|
63
|
-
- classpath/commons-codec-1.
|
64
|
-
- classpath/embulk-input-s3-0.2.
|
65
|
-
- classpath/embulk-util-aws-credentials-0.2.
|
66
|
-
- classpath/httpclient-4.
|
67
|
-
- classpath/httpcore-4.
|
60
|
+
- classpath/aws-java-sdk-core-1.11.253.jar
|
61
|
+
- classpath/aws-java-sdk-kms-1.11.253.jar
|
62
|
+
- classpath/aws-java-sdk-s3-1.11.253.jar
|
63
|
+
- classpath/commons-codec-1.9.jar
|
64
|
+
- classpath/embulk-input-s3-0.2.12.jar
|
65
|
+
- classpath/embulk-util-aws-credentials-0.2.12.jar
|
66
|
+
- classpath/httpclient-4.5.2.jar
|
67
|
+
- classpath/httpcore-4.4.4.jar
|
68
|
+
- classpath/ion-java-1.0.2.jar
|
69
|
+
- classpath/jackson-annotations-2.6.0.jar
|
70
|
+
- classpath/jackson-core-2.6.7.jar
|
71
|
+
- classpath/jackson-databind-2.6.7.1.jar
|
72
|
+
- classpath/jackson-dataformat-cbor-2.6.7.jar
|
68
73
|
- classpath/jcl-over-slf4j-1.7.12.jar
|
74
|
+
- classpath/jmespath-java-1.11.253.jar
|
69
75
|
homepage: https://github.com/embulk/embulk-input-s3
|
70
76
|
licenses:
|
71
77
|
- Apache 2.0
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|