if res, err := service.Objects.Insert(*bucketName, object).Media(file).Do(); err == nil {
fmt.Printf("Created object %v at location %v
", res.Name, res.SelfLink)
} else {
fatalf(service, "Objects.Insert failed: %v", err)
}
I want to modify this code to set the ACL to publicRead, I have noticed there is a function in the API func (*ObjectsInsertCall) PredefinedAcl
but I can't find how to use it.
Going by what i found in the docs, it looks like this would do it...
if res, err := service.Objects.Insert(*bucketName, object).Media(file).PredefinedAcl("publicRead").Do(); err == nil {
fmt.Printf("Created object %v at location %v
", res.Name, res.SelfLink)
} else {
fatalf(service, "Objects.Insert failed: %v", err)
}
(Inserted it right before the Do()
call.) HTH, YMMV, etc.