Skip to content

Commit

Permalink
fix onLift
Browse files Browse the repository at this point in the history
  • Loading branch information
Chriscbr committed Oct 25, 2023
1 parent ea7018e commit 0e66601
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions dynamodb.w
Original file line number Diff line number Diff line change
Expand Up @@ -92,34 +92,6 @@ pub class DynamoDBTableAws {
this.tableName = this.table.name;
}

bind(host: std.IInflightHost, ops: Array<str>) {
if let host = aws.Function.from(host) {
if ops.contains("putItem") {
host.addPolicyStatements(aws.PolicyStatement {
actions: ["dynamodb:PutItem"],
resources: [this.table.arn],
effect: aws.Effect.ALLOW,
});
}

if ops.contains("getItem") {
host.addPolicyStatements(aws.PolicyStatement {
actions: ["dynamodb:GetItem"],
resources: [this.table.arn],
effect: aws.Effect.ALLOW,
});
}

if ops.contains("scan") {
host.addPolicyStatements(aws.PolicyStatement {
actions: ["dynamodb:Scan"],
resources: [this.table.arn],
effect: aws.Effect.ALLOW,
});
}
}
}

extern "./dynamo.js" static inflight _putItem(tableName: str, item: Json): void;
extern "./dynamo.js" static inflight _getItem(tableName: str, key: Json): Map<Map<Map<str>>>;
extern "./dynamo.js" static inflight _scan(tableName: str): Map<Array<Map<Map<str>>>>;
Expand Down Expand Up @@ -210,7 +182,8 @@ pub class DynamoDBTable {
}
}

bind(host: std.IInflightHost, ops: Array<str>) {
pub onLift(host: std.IInflightHost, ops: Array<str>) {
log("onLift called on DynamoDBTable with ops ${ops}");
// currently simulator does not require permissions
// may change with https://github.com/winglang/wing/issues/3082
if let tableAws = this.tableAws {
Expand Down

0 comments on commit 0e66601

Please sign in to comment.