IrekFasikhov / go-rgwadmin

Ceph RADOS Gateway admin(golang)
https://irekfasikhov.com
GNU General Public License v3.0
10 stars 2 forks source link

go-rgwadmin

Package radosgw-admin wraps http://docs.ceph.com/docs/mimic/radosgw/adminops

Requires Go 1.11 or newer. Tested with Liminous and Mimic releases!

Example App:

  func main() {

    endpoint := os.Getenv("RGW_ENDPOINT")
    accessKey := os.Getenv("RGW_ACCESS_KEY")
    secretKey := os.Getenv("RGW_SECRET_KEY")

  .........

    api, err := rgwadmin.NewRGW(endpoint, accessKey, secretKey)
    if err != nil {
        fmt.Println(err)
        return
    }

    if *getUser {
        u := rgwadmin.User{
            UID: *uid,
        }
        user, _ := api.GetUser(u)
        fmt.Println(user)
    }
    if *createUser {
        u := rgwadmin.User{
            UID:         *uid,
            DisplayName: *displayName,
            Email:       *email,
            Suspended:   suspended,
        }
        fmt.Println(api.CreateUser(u))
    }
  .....