Skip to content

Commit 1090cad

Browse files
committed
new listversions command to list versions of files to a tsv file
1 parent 135f1bf commit 1090cad

13 files changed

Lines changed: 963 additions & 319 deletions

File tree

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,37 @@ Parsed private key -entry length 28 lines
448448
factory com.google.cloud.hadoop.repackaged.gcs.com.google.cloud.hadoop.util.CredentialFactory@d706f19
449449
```
450450

451+
## Command `iampolicy`
452+
453+
Generate AWS IAM policy for a given bucket
454+
```
455+
hadoop jar cloudstore-1.0.jar iampolicy s3a://example-bucket/
456+
457+
{
458+
"Version" : "2012-10-17",
459+
"Statement" : [ {
460+
"Sid" : "7",
461+
"Effect" : "Allow",
462+
"Action" : [ "s3:GetBucketLocation", "s3:ListBucket*" ],
463+
"Resource" : "arn:aws:s3:::example-bucket"
464+
}, {
465+
"Sid" : "8",
466+
"Effect" : "Allow",
467+
"Action" : [ "s3:Get*", "s3:PutObject", "s3:PutObjectAcl", "s3:DeleteObject", "s3:AbortMultipartUpload" ],
468+
"Resource" : "arn:aws:s3:::example-bucket/*"
469+
}, {
470+
"Sid" : "1",
471+
"Effect" : "Allow",
472+
"Action" : "kms:*",
473+
"Resource" : "*"
474+
} ]
475+
}
476+
477+
```
478+
Notes:
479+
* KMS policy is always added in case data is encrypted/decrypted with S3-KMS; it is not need if this is not the case.
480+
* Read and Write access up the tree is needed. Maybe if you enable directory marker retention writing from root becomes optional.
481+
* "s3:GetBucketLocation" is used by the bucket existence v2 check. If the probe is at 0, it is never called.
451482

452483

453484
## Command `list`

pom.xml

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -218,24 +218,30 @@
218218
</exclusion>
219219
</exclusions>
220220
</dependency>
221-
<!--
222-
223221
<dependency>
224-
<groupId>org.apache.hadoop</groupId>
225-
<artifactId>hadoop-aws</artifactId>
226-
<version>${hadoop.version}</version>
227-
<type>test-jar</type>
228-
<scope>test</scope>
222+
<groupId>com.amazonaws</groupId>
223+
<artifactId>aws-java-sdk-bundle</artifactId>
224+
<version>1.12.316</version>
225+
<scope>compile</scope>
229226
</dependency>
227+
<!--
230228
231-
<dependency>
232-
<groupId>org.apache.hadoop</groupId>
233-
<artifactId>hadoop-azure</artifactId>
234-
<version>${hadoop.version}</version>
235-
<type>test-jar</type>
236-
<scope>test</scope>
237-
</dependency>
238-
-->
229+
<dependency>
230+
<groupId>org.apache.hadoop</groupId>
231+
<artifactId>hadoop-aws</artifactId>
232+
<version>${hadoop.version}</version>
233+
<type>test-jar</type>
234+
<scope>test</scope>
235+
</dependency>
236+
237+
<dependency>
238+
<groupId>org.apache.hadoop</groupId>
239+
<artifactId>hadoop-azure</artifactId>
240+
<version>${hadoop.version}</version>
241+
<type>test-jar</type>
242+
<scope>test</scope>
243+
</dependency>
244+
-->
239245

240246
</dependencies>
241247

@@ -322,7 +328,7 @@
322328

323329
<!-- latest hadoop release -->
324330
<profile>
325-
<id>hadoop-latest</id>
331+
<id>latest</id>
326332
<properties>
327333
<hadoop.version>3.3.5</hadoop.version>
328334
</properties>

src/main/extra/listversions.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import org.apache.hadoop.fs.s3a.extra.ListObjects;
20+
import org.apache.hadoop.fs.s3a.extra.ListVersions;
21+
import org.apache.hadoop.fs.store.commands.Command;
22+
23+
public class listversions extends Command {
24+
25+
public static void main(String[] args) throws Exception {
26+
ListVersions.main(args);
27+
}
28+
29+
public static void help() {
30+
printCommand("listversions", "list all versions of S3 objects under a path");
31+
}
32+
33+
}

0 commit comments

Comments
 (0)