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

Cannot get attributes for object #536

Closed
ben-dale opened this issue Apr 12, 2022 · 7 comments · Fixed by #832
Closed

Cannot get attributes for object #536

ben-dale opened this issue Apr 12, 2022 · 7 comments · Fixed by #832
Assignees
Labels

Comments

@ben-dale
Copy link

👋 I suspect this feature might not be implemented, but wanted to raise here, in case I'm missing something!

https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectAttributes.html

I tried to retrieve object attributes manually using S3mock and the documentation above, but this was unsuccessful. Making this GET request returns the object contents, instead of the attributes:

GET http://s3mock:60317/objectkey?attributes

The error I receive when using the AWS SDK:

val request = GetObjectAttributesRequest
            .builder()
            .bucket(bucket)
            .key(key)
            .objectAttributes(ObjectAttributes.OBJECT_SIZE)
            .build()

val result = s3AsyncClient.getObjectAttributes(request).await()
Could not parse XML response.
software.amazon.awssdk.core.exception.SdkClientException: Could not parse XML response.
	at app//software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:102)
	at app//software.amazon.awssdk.core.exception.SdkClientException.create(SdkClientException.java:47)
	at app//software.amazon.awssdk.protocols.query.unmarshall.XmlDomParser.parse(XmlDomParser.java:59)

Thanks!

@afranken
Copy link
Member

Correct, this is currently not implemented.
Looks like it's not complicated, though, I'll add this API for the next release. :)

@afranken afranken self-assigned this Apr 12, 2022
@afranken
Copy link
Member

ah - looked at the documentation again - I can add some of the implementation.

GetObjectAttributes combines the functionality of GetObjectAcl, GetObjectLegalHold, GetObjectLockConfiguration, GetObjectRetention, GetObjectTagging, HeadObject, and ListParts

GetObjectAcl, GetObjectLegalHold, GetObjectLockConfiguration, GetObjectRetention functionality currently does not exist in the S3Mock, so this can't be added.

GetObjectTagging, HeadObject, and ListParts functionality exists, so I could add that.

Not sure if partial responses work - I'll check.
This may take a while to fully complete. :(

@afranken
Copy link
Member

afranken commented Sep 3, 2022

this can be implemented once LegalHold, ACL, ObjectLock and ObjectRetention are implemented.
See #213, #157, #290

@afranken
Copy link
Member

afranken commented Sep 7, 2022

implemented GetObjectLegalHold, GetObjectLockConfiguration and GetObjectRetention for #157, ACLs are next.

@afranken
Copy link
Member

@ben-dale how and why do you use this API?

The implementation for the "HeadObject" attributes is straightforward, but I struggle to understand how the "ListParts" attributes are supposed to work.

I can't get a test case against the S3 API to work.
There is no way to pass in an "uploadId", so a call to an object where the multipart upload is still running returns a 404 key not found.
After the multipart upload is completed, the "parts" in the response are empty because there are no more parts.

@bpoland
Copy link

bpoland commented Jun 1, 2023

@ben-dale how and why do you use this API?

The implementation for the "HeadObject" attributes is straightforward, but I struggle to understand how the "ListParts" attributes are supposed to work.

I can't get a test case against the S3 API to work. There is no way to pass in an "uploadId", so a call to an object where the multipart upload is still running returns a 404 key not found. After the multipart upload is completed, the "parts" in the response are empty because there are no more parts.

If it helps, we are only using getObjectAttributes instead of headObject because the latter is not supported in the AWS java SDK 1.x that we're still using. So if getObjectAttributes partially worked by only including the headObject attributes that would be enough for us :)

afranken added a commit that referenced this issue Jun 26, 2023
This adds support for the object part of the API, the "parts" part is
currently not supported.

Fixes #536
afranken added a commit that referenced this issue Jun 26, 2023
This adds support for the object part of the API, the "parts" part is
currently not supported.

Fixes #536
afranken added a commit that referenced this issue Jun 30, 2023
This adds support for the object part of the API, the "parts" part is
currently not supported.

Fixes #536
@afranken
Copy link
Member

afranken commented Jul 3, 2023

@ben-dale / @bpoland
Just released 2.16.0 that supports getObjectAttributes for objects. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants