Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cdk): temporary fix for java "cdk init" template #732

Merged
merged 1 commit into from
Sep 17, 2018
Merged
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
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.myorg;

import software.amazon.awscdk.Construct;
import software.amazon.awscdk.services.iam.IIdentityResource;
import software.amazon.awscdk.services.iam.IPrincipal;
import software.amazon.awscdk.services.s3.Bucket;
import software.amazon.awscdk.services.s3.BucketProps;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -17,15 +18,15 @@ public HelloConstruct(final Construct parent, final String name, final HelloCons
super(parent, name);

for (int i = 0; i < props.getBucketCount(); ++i) {
buckets.add(new Bucket(this, "Bucket" + String.valueOf(i)));
buckets.add(new Bucket(this, "Bucket" + String.valueOf(i), BucketProps.builder().build()));
}
}

/**
* Given an principal, grants it READ access on all buckets.
* @param principal The principal (User, Group, Role)
*/
public void grantRead(final IIdentityResource principal) {
buckets.forEach(b -> b.grantRead(principal));
public void grantRead(final IPrincipal principal) {
buckets.forEach(b -> b.grantRead(principal, "*"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import software.amazon.awscdk.Stack;
import software.amazon.awscdk.StackProps;
import software.amazon.awscdk.services.iam.User;
import software.amazon.awscdk.services.iam.UserProps;
import software.amazon.awscdk.services.sns.Topic;
import software.amazon.awscdk.services.sns.TopicProps;
import software.amazon.awscdk.services.sqs.Queue;
Expand Down Expand Up @@ -31,7 +32,7 @@ public HelloStack(final App parent, final String name, final StackProps props) {
.withBucketCount(5)
.build());

User user = new User(this, "MyUser");
User user = new User(this, "MyUser", UserProps.builder().build());
hello.grantRead(user);
}
}