mirror of
https://github.com/ceph/go-ceph
synced 2024-12-14 02:15:47 +00:00
09d81f5bb3
It's unusual to put any kind of credentials out in open. The set of credentials defined with `S3_ACCESS_KEY` and `S3_SECRET_KEY` variables in the script are questionable in its nature. But these are not real/valid credential values in any form for AWS rather used for testing the S3 compatible API from Ceph RGW. Therefore clarify the intention and replace with sample values from official AWS documentation. Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
885 B
885 B
Prerequisites
You must create an admin user like so:
radosgw-admin user create --uid admin --display-name "Admin User" --caps "buckets=*;users=*;usage=read;metadata=read;zone=read --access-key=AKIAIOSFODNN7EXAMPLE --secret-key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Then use the access_key
and secret_key
for authentication.
Snippet usage example:
package main
import (
"github.com/ceph/go-ceph/rgw/admin"
)
func main() {
// Generate a connection object
co, err := admin.New("http://192.168.1.1", "AKIAIOSFODNN7EXAMPLE", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", nil)
if err != nil {
panic(err)
}
// Get the "admin" user
user, err := co.GetUser(context.Background(), admin.User{ID: "admin"})
if err != nil {
panic(err)
}
// Print the user display name
fmt.Println(user.DisplayName)
}