Exemplo n.º 1
0
func (s *VirSecret) GetUsageID() (string, error) {
	result := C.virSecretGetUsageID(s.ptr)
	if result == nil {
		return "", errors.New(GetLastError())
	}
	return C.GoString(result), nil
}
Exemplo n.º 2
0
// UsageID gets the unique identifier of the object with which this secret is to
// be used. The format of the identifier is dependant on the usage type of the
// secret. For a secret with a usage type of SecUsageTypeVolume the identifier
// will be a fully qualfied path name. The identifiers are intended to be unique
// within the set of all secrets sharing the same usage type. ie, there shall
// only ever be one secret for each volume path.
func (sec Secret) UsageID() (string, error) {
	sec.log.Println("reading secret usage ID...")
	cUsageID := C.virSecretGetUsageID(sec.virSecret)

	if cUsageID == nil {
		err := LastError()
		sec.log.Printf("an error occurred: %v\n", err)
		return "", err
	}

	usageID := C.GoString(cUsageID)

	sec.log.Printf("usage ID: %v\n", usageID)

	return usageID, nil
}