[PATCH libvirt-java] Allow byte[] arrays to be set as a secretValue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Wido den Hollander <wido@xxxxxxxxx>
---
 src/main/java/org/libvirt/Secret.java      |   11 +++++++++++
 src/main/java/org/libvirt/jna/Libvirt.java |    1 +
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/main/java/org/libvirt/Secret.java b/src/main/java/org/libvirt/Secret.java
index e536cf4..48f7895 100644
--- a/src/main/java/org/libvirt/Secret.java
+++ b/src/main/java/org/libvirt/Secret.java
@@ -146,6 +146,17 @@ public class Secret {
     }
 
     /**
+     * Sets the value of the secret
+     *
+     * @return 0 on success, -1 on failure.
+     */
+    public int setValue(byte[] value) throws LibvirtException {
+        int returnValue = libvirt.virSecretSetValue(VSP, value, new NativeLong(value.length), 0);
+        processError();
+        return returnValue;
+    }
+
+    /**
      * Undefines, but does not free, the Secret.
      * 
      * @return 0 on success, -1 on failure.
diff --git a/src/main/java/org/libvirt/jna/Libvirt.java b/src/main/java/org/libvirt/jna/Libvirt.java
index 2c8c03d..b1e53a2 100644
--- a/src/main/java/org/libvirt/jna/Libvirt.java
+++ b/src/main/java/org/libvirt/jna/Libvirt.java
@@ -336,6 +336,7 @@ public interface Libvirt extends Library {
     public SecretPointer virSecretLookupByUUID(ConnectionPointer virConnectPtr, byte[] uuidBytes);
     public SecretPointer virSecretLookupByUUIDString(ConnectionPointer virConnectPtr, String uuidstr);
     public int virSecretSetValue(SecretPointer virSecretPtr, String value, NativeLong value_size, int flags);        
+    public int virSecretSetValue(SecretPointer virSecretPtr, byte[] value, NativeLong value_size, int flags);
     public int virSecretUndefine(SecretPointer virSecretPtr);
     
     //Stream Methods
-- 
1.7.5.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]