Package org.libvirt

Class Secret

java.lang.Object
org.libvirt.Secret

public class Secret extends Object
A secret defined by libvirt
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Libvirt
    The libvirt connection from the hypervisor
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    int
    Release the secret handle.
    byte[]
    Fetches the value of the secret as a byte array
    Get the unique identifier of the object with which this secret is to be used.
    int[]
    Get the UUID for this secret.
    Gets the UUID for this secret as string.
    Fetches the value of the secret as a string (note that this may not always work and getByteValue() is more reliable) This is just kept for backward compatibility
    Fetches an XML document describing attributes of the secret.
    protected void
    Error handling logic to throw errors.
    int
    setValue(byte[] value)
    Sets the value of the secret
    int
    Sets the value of the secret
    int
    Undefines, but does not free, the Secret.

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • libvirt

      protected Libvirt libvirt
      The libvirt connection from the hypervisor
  • Method Details

    • finalize

      public void finalize() throws LibvirtException
      Overrides:
      finalize in class Object
      Throws:
      LibvirtException
    • free

      public int free() throws LibvirtException
      Release the secret handle. The underlying secret continues to exist.
      Returns:
      0 on success, or -1 on error.
      Throws:
      LibvirtException
    • getUsageID

      public String getUsageID() throws LibvirtException
      Get the unique identifier of the object with which this secret is to be used.
      Returns:
      a string identifying the object using the secret, or NULL upon error
      Throws:
      LibvirtException
    • getUUID

      public int[] getUUID() throws LibvirtException
      Get the UUID for this secret.
      Returns:
      the UUID as an unpacked int array
      Throws:
      LibvirtException
      See Also:
    • getUUIDString

      public String getUUIDString() throws LibvirtException
      Gets the UUID for this secret as string.
      Returns:
      the UUID in canonical String format
      Throws:
      LibvirtException
      See Also:
    • getValue

      public String getValue() throws LibvirtException
      Fetches the value of the secret as a string (note that this may not always work and getByteValue() is more reliable) This is just kept for backward compatibility
      Returns:
      the value of the secret, or null on failure.
      Throws:
      LibvirtException
    • getByteValue

      public byte[] getByteValue() throws LibvirtException
      Fetches the value of the secret as a byte array
      Returns:
      the value of the secret, or null on failure.
      Throws:
      LibvirtException
    • getXMLDesc

      public String getXMLDesc() throws LibvirtException
      Fetches an XML document describing attributes of the secret.
      Returns:
      the XML document
      Throws:
      LibvirtException
    • processError

      protected void processError() throws LibvirtException
      Error handling logic to throw errors. Must be called after every libvirt call.
      Throws:
      LibvirtException
    • setValue

      public int setValue(String value) throws LibvirtException
      Sets the value of the secret
      Returns:
      0 on success, -1 on failure.
      Throws:
      LibvirtException
    • setValue

      public int setValue(byte[] value) throws LibvirtException
      Sets the value of the secret
      Returns:
      0 on success, -1 on failure.
      Throws:
      LibvirtException
    • undefine

      public int undefine() throws LibvirtException
      Undefines, but does not free, the Secret.
      Returns:
      0 on success, -1 on failure.
      Throws:
      LibvirtException