func get_objects(c swift.Connection, container string, prefix string) []string {
	opts := new(swift.ObjectsOpts)
	opts.Prefix = prefix
	names, err := c.ObjectNames(container, opts)
	if err != nil {
		panic(err)
	}
	return names
}
Example #2
0
func GetHistory(ren render.Render, r *http.Request, cf *swift.Connection) {
	opts := swift.ObjectsOpts{}
	opts.Prefix = "cfpaste-"
	opts.Limit = 10
	objects, err := cf.ObjectNames("go-cfpaste", &opts)
	pastes := make([]string, 10)
	for i := range objects {
		object, headers, err := cf.Object("go-cfpaste", objects[i])
		PanicIf(err)
		log.Println(object.Name)
		pastes = append(pastes, headers["X-Object-Meta-Pasteid"])
	}
	PanicIf(err)
	ren.HTML(200, "history", pastes)
	return
}