Skip to content

Commit 751d624

Browse files
committed
rolled in review comments
1 parent 9dfac03 commit 751d624

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

javav2/example_code/s3/src/main/java/com/example/s3/lockscenario/CreateObjectLockRole.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,28 @@
1111

1212
public class CreateObjectLockRole {
1313
public static void main(String[] args) {
14-
createLockRole();
14+
final String usage = """
15+
16+
Usage: <roleName>
17+
18+
Where:
19+
roleName - the IAM role name.
20+
""";
21+
22+
if (args.length != 1) {
23+
System.out.println(usage);
24+
System.exit(1);
25+
}
26+
String roleName = args[0];
27+
createLockRole(roleName);
1528
}
1629

1730
// snippet-start:[S3Lock.javav2.lock.role.main]
1831

1932
/**
2033
* Creates an IAM role for AWS S3 Batch Operations to manage object locks.
2134
*/
22-
public static void createLockRole() {
23-
final String roleName = "batch_operations-object-lock1";
24-
35+
public static void createLockRole(String roleName) {
2536
// Trust policy
2637
final String trustPolicy = """
2738
{

0 commit comments

Comments
 (0)