func (s *VirSecret) GetXMLDesc(flags uint32) (string, error) { result := C.virSecretGetXMLDesc(s.ptr, C.uint(flags)) if result == nil { return "", errors.New(GetLastError()) } xml := C.GoString(result) C.free(unsafe.Pointer(result)) return xml, nil }
// XML fetches an XML document describing attributes of the secret. func (sec Secret) XML() (string, error) { sec.log.Println("reading secret XML...") cXML := C.virSecretGetXMLDesc(sec.virSecret, 0) if cXML == nil { err := LastError() sec.log.Printf("an error occurred: %v\n", err) return "", err } defer C.free(unsafe.Pointer(cXML)) xml := C.GoString(cXML) sec.log.Printf("XML length: %v runes\n", utf8.RuneCountInString(xml)) return xml, nil }