I want to list bucket names from demo.pydio.com using Golang.
- My code using Minio-SDK library is:
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
s3Client, err := minio.New("demo.pydio.com/io", "id_token", "gatewaysecret", true)
if err != nil {
log.Fatalln(err)
}
buckets, err := s3Client.ListBuckets()
if err != nil {
log.Fatalln(err)
}
for _, bucket := range buckets {
log.Println(bucket)
}
The error I got is:
Endpoint: demo.pydio.com/io does not follow ip address or domain name standards.
exit status 1
- My code using Amazon-AWS-SDK library is:
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"
"github.com/aws/aws-sdk-go/aws/credentials"
)
func main() {
sess, err := session.NewSession(&aws.Config{
Region: aws.String("us-east-1"),
Endpoint: aws.String("https://demo.pydio.com/io"),
Credentials: credentials.NewStaticCredentials("id_token", "gatewaysecret",""),
})
svc := s3.New(sess)
buckets, err := svc.ListBuckets(&s3.ListBucketsInput{})
if err != nil {
panic(fmt.Sprintf("failed to list buckets, %v", err))
}
for _,b := range buckets.Buckets {
bucket := aws.StringValue(b.Name)
fmt.Println(bucket)
}
}
The error I got is:
panic: failed to list buckets, AccessDenied: Access Denied.
status code: 403, request id: , host id:
What am I doing wrong?
Please advise