func (c *VirConnection) NumOfSecrets() (int, error) { result := int(C.virConnectNumOfSecrets(c.ptr)) if result == -1 { return 0, GetLastError() } return result, nil }
func (h *Hypervisor) GetSecrets() ([][]byte, error) { number := C.virConnectNumOfSecrets(h.cptr) if number == -1 { return nil, GetLastError() } uuids := make([][]byte, number) if number == 0 { return uuids, nil } cuuids := make([]*C.char, number) result := C.virConnectListSecrets(h.cptr, &cuuids[0], number) if result == -1 { return nil, GetLastError() } for i, v := range cuuids { uuids[i] = C.GoBytes(unsafe.Pointer(v), 16) defer C.free(unsafe.Pointer(v)) } return uuids, nil }
func (h *Hypervisor) GetNumberOfSecrets() (int, error) { number := C.virConnectNumOfSecrets(h.cptr) if number == -1 { return 0, GetLastError() } return int(number), nil }