aws / aws/chalice

Type hinting s3_client.put_object() to get a correct gen-policy

Open
#1,482 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
11.1k
Forks
1k
Avg merge
1d 22h
Merged PRs (30d)
2

Description

```
def save(key, buf, bucket_name, s3_client):
# ...
s3_client.put_object(Bucket=bucket_name, Key=key, Body=buf)
```

If I have a function like this, the `put_object()` does not trigger gen-policy to have an `S3:PutObject` entry. Is there a non-hacky way to hint to chalice that `s3_client` is a boto3 s3 client?

Right now I am using a manual policy to deal with this.

#242 looks similar but I don't need the PutObjectAcl action, I am simply not getting PutObject.

Contributor guide

Open the contributing guide

Research direction

Start by tracing Chalice's gen-policy handling for the shown save() example and the s3_client.put_object() call. Compare the requested behavior with issue #242 and the current manual-policy workaround; done means gen-policy produces an S3:PutObject entry without requiring a manual policy.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.