-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
GetBucketACL Grantee required type always nil. #916
Comments
Hello @ejcx, thank you for reaching out to us. I am unable to reproduce this. package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
func main() {
sess := session.New()
config := &aws.Config{
Region: aws.String("us-west-2"),
LogLevel: aws.LogLevel(aws.LogDebugWithHTTPBody),
}
svc := s3.New(sess, config)
out, err := svc.GetBucketAcl(&s3.GetBucketAclInput{
Bucket: aws.String("bucket"),
})
fmt.Println(out, err)
} Can you post your snippet? |
Sure. I will post later tonight showing that type is nil. |
Here's the code I have. I have only one grantee, and it is technically the user I am logged in as. It is always nil.
|
@ejcx I was able to reproduce the issue you're running into. It looks like the SDK is running into an issue parsing the <AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Owner>
<ID>id</ID>
<DisplayName>name</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
<ID>id</ID>
<DisplayName>name</DisplayName>
</Grantee>
<Permission>READ</Permission>
</Grant>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
<ID>id</ID>
<DisplayName>name</DisplayName>
</Grantee>
<Permission>WRITE</Permission>
</Grant>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
<ID>id</ID>
<DisplayName>name</DisplayName>
</Grantee>
<Permission>READ_ACP</Permission>
</Grant>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
<ID>id</ID>
<DisplayName>name</DisplayName>
</Grantee>
<Permission>WRITE_ACP</Permission>
</Grant>
</AccessControlList>
</AccessControlPolicy> |
The type Grantee struct {
// ...
Type *string `locationName:"xsi:type" type:"string" xmlAttribute:"true" required:"true" enum:"Type"`
} |
While calling
GetBucketAcl
, the Grantee "Type" is always nil.If you're writing a program that does a PutBucketAcl based on the GetBucketAcl results, you are consistently get API errors because PutBucketAcl Grantee requires a non-nil "Type".
I worked around this buy overwriting the Type to be "Canonical User", as per[1], but this is really non-obvious.
I'm also not sure PutBucketAcl works at all, but that's a different issue.
[1] - http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#sample-acl
The text was updated successfully, but these errors were encountered: