Skip to content

Commit

Permalink
Add missing grants
Browse files Browse the repository at this point in the history
  • Loading branch information
kr565370 committed Apr 25, 2024
1 parent ba52956 commit 05de55c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 4 additions & 2 deletions java/cdk/src/main/java/sleeper/cdk/SleeperCdkApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,19 @@ public void create() {
// Stacks for tables
ManagedPoliciesStack policiesStack = new ManagedPoliciesStack(this, "Policies", instanceProperties);
TableDataStack dataStack = new TableDataStack(this, "TableData", instanceProperties, policiesStack);
TransactionLogStateStoreStack transactionLogStateStoreStack = new TransactionLogStateStoreStack(
dataStack, "TransactionLogStateStore", instanceProperties, jars);
StateStoreStacks stateStoreStacks = new StateStoreStacks(
new DynamoDBStateStoreStack(this, "DynamoDBStateStore", instanceProperties),
new S3StateStoreStack(this, "S3StateStore", instanceProperties, dataStack),
new TransactionLogStateStoreStack(dataStack, "TransactionLogStateStore", instanceProperties, jars),
transactionLogStateStoreStack,
policiesStack);
coreStacks = new CoreStacks(
new ConfigBucketStack(this, "Configuration", instanceProperties, policiesStack),
new TableIndexStack(this, "TableIndex", instanceProperties, policiesStack),
policiesStack, stateStoreStacks, dataStack);
new TransactionLogSnapshotCreationStack(this, "TransactionLogSnapshotCreation",
instanceProperties, jars, coreStacks, topicStack.getTopic(), errorMetrics);
instanceProperties, jars, coreStacks, transactionLogStateStoreStack, topicStack.getTopic(), errorMetrics);
if (optionalStacks.contains(TableMetricsStack.class.getSimpleName())) {
new TableMetricsStack(this, "TableMetrics", instanceProperties, jars, topicStack.getTopic(), coreStacks, errorMetrics);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class TransactionLogSnapshotCreationStack extends NestedStack {
public TransactionLogSnapshotCreationStack(
Construct scope, String id,
InstanceProperties instanceProperties, BuiltJars jars, CoreStacks coreStacks,
TransactionLogStateStoreStack transactionLogStateStoreStack,
Topic topic, List<IMetric> errorMetrics) {
super(scope, id);
IBucket jarsBucket = Bucket.fromBucketName(this, "JarsBucket", instanceProperties.get(JARS_BUCKET));
Expand Down Expand Up @@ -127,7 +128,7 @@ public TransactionLogSnapshotCreationStack(
snapshotCreationLambda.addEventSource(new SqsEventSource(queue,
SqsEventSourceProps.builder().batchSize(1).build()));
coreStacks.grantReadTablesAndData(snapshotCreationLambda);

transactionLogStateStoreStack.grantReadWriteSnapshots(snapshotCreationLambda);
Utils.addStackTagIfSet(this, instanceProperties);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,9 @@ public void grantReadPartitions(IGrantable grantee) {
public void grantReadWritePartitions(IGrantable grantee) {
partitionsLogTable.grantReadWriteData(grantee);
}

public void grantReadWriteSnapshots(IGrantable grantee) {
latestSnapshotsTable.grantReadWriteData(grantee);
allSnapshotsTable.grantReadWriteData(grantee);
}
}

0 comments on commit 05de55c

Please sign in to comment.