Skip to content

Commit

Permalink
Techdebt: S3: Untangle GET-methods (#8000)
Browse files Browse the repository at this point in the history
  • Loading branch information
bblommers committed Aug 19, 2024
1 parent fc60bd1 commit d361b67
Show file tree
Hide file tree
Showing 6 changed files with 382 additions and 301 deletions.
8 changes: 4 additions & 4 deletions IMPLEMENTATION_COVERAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7101,7 +7101,7 @@

## s3
<details>
<summary>68% implemented</summary>
<summary>71% implemented</summary>

- [X] abort_multipart_upload
- [X] complete_multipart_upload
Expand All @@ -7126,7 +7126,7 @@
- [X] delete_object_tagging
- [X] delete_objects
- [X] delete_public_access_block
- [ ] get_bucket_accelerate_configuration
- [X] get_bucket_accelerate_configuration
- [X] get_bucket_acl
- [ ] get_bucket_analytics_configuration
- [X] get_bucket_cors
Expand Down Expand Up @@ -7165,7 +7165,7 @@
- [ ] list_bucket_metrics_configurations
- [X] list_buckets
- [ ] list_directory_buckets
- [ ] list_multipart_uploads
- [X] list_multipart_uploads
- [X] list_object_versions
- [X] list_objects
- [X] list_objects_v2
Expand All @@ -7189,7 +7189,7 @@
- [ ] put_bucket_request_payment
- [X] put_bucket_tagging
- [X] put_bucket_versioning
- [ ] put_bucket_website
- [X] put_bucket_website
- [X] put_object
- [X] put_object_acl
- [X] put_object_legal_hold
Expand Down
10 changes: 7 additions & 3 deletions docs/docs/services/s3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ s3
- [X] delete_object_tagging
- [X] delete_objects
- [X] delete_public_access_block
- [ ] get_bucket_accelerate_configuration
- [X] get_bucket_accelerate_configuration
- [X] get_bucket_acl
- [ ] get_bucket_analytics_configuration
- [X] get_bucket_cors
Expand Down Expand Up @@ -82,7 +82,11 @@ s3
- [ ] list_bucket_metrics_configurations
- [X] list_buckets
- [ ] list_directory_buckets
- [ ] list_multipart_uploads
- [X] list_multipart_uploads

The delimiter and max-uploads parameters have not yet been implemented.


- [X] list_object_versions

The default value for the MaxKeys-argument is 100. This can be configured with an environment variable:
Expand Down Expand Up @@ -149,7 +153,7 @@ s3
- [ ] put_bucket_request_payment
- [X] put_bucket_tagging
- [X] put_bucket_versioning
- [ ] put_bucket_website
- [X] put_bucket_website
- [X] put_object
- [X] put_object_acl
- [X] put_object_legal_hold
Expand Down
19 changes: 12 additions & 7 deletions moto/s3/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ def __init__(self, name: str, account_id: str, region_name: str):
self.versioning_status: Optional[str] = None
self.rules: List[LifecycleRule] = []
self.policy: Optional[bytes] = None
self.website_configuration: Optional[Dict[str, Any]] = None
self.website_configuration: Optional[bytes] = None
self.acl: Optional[FakeAcl] = get_canned_acl("private")
self.cors: List[CorsRule] = []
self.logging: Dict[str, Any] = {}
Expand Down Expand Up @@ -1883,6 +1883,10 @@ def delete_bucket(self, bucket_name: str) -> Optional[FakeBucket]:
s3_backends.bucket_accounts.pop(bucket_name, None)
return self.buckets.pop(bucket_name)

def get_bucket_accelerate_configuration(self, bucket_name: str) -> Optional[str]:
bucket = self.get_bucket(bucket_name)
return bucket.accelerate_configuration

def put_bucket_versioning(self, bucket_name: str, status: str) -> None:
self.get_bucket(bucket_name).versioning_status = status

Expand Down Expand Up @@ -2086,15 +2090,13 @@ def delete_bucket_lifecycle(self, bucket_name: str) -> None:
bucket = self.get_bucket(bucket_name)
bucket.delete_lifecycle()

def set_bucket_website_configuration(
self, bucket_name: str, website_configuration: Dict[str, Any]
def put_bucket_website(
self, bucket_name: str, website_configuration: bytes
) -> None:
bucket = self.get_bucket(bucket_name)
bucket.website_configuration = website_configuration

def get_bucket_website_configuration(
self, bucket_name: str
) -> Optional[Dict[str, Any]]:
def get_bucket_website_configuration(self, bucket_name: str) -> Optional[bytes]:
bucket = self.get_bucket(bucket_name)
return bucket.website_configuration

Expand Down Expand Up @@ -2558,7 +2560,10 @@ def complete_multipart_upload(
)
return key

def get_all_multiparts(self, bucket_name: str) -> Dict[str, FakeMultipart]:
def list_multipart_uploads(self, bucket_name: str) -> Dict[str, FakeMultipart]:
"""
The delimiter and max-uploads parameters have not yet been implemented.
"""
bucket = self.get_bucket(bucket_name)
return bucket.multiparts

Expand Down
Loading

0 comments on commit d361b67

Please sign in to comment.