Signed-off-by: Katerina Koukiou <kkouk...@redhat.com>
---
 data/org.libvirt.Secret.xml |  4 ++++
 src/secret.c                | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/data/org.libvirt.Secret.xml b/data/org.libvirt.Secret.xml
index d35af38..509c46a 100644
--- a/data/org.libvirt.Secret.xml
+++ b/data/org.libvirt.Secret.xml
@@ -24,5 +24,9 @@
       <arg name="flags" type="u" direction="in"/>
       <arg name="xml" type="s" direction="out"/>
     </method>
+    <method name="Undefine">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See 
https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretUndefine"/>
+    </method>
   </interface>
 </node>
diff --git a/src/secret.c b/src/secret.c
index 28b1852..ecbd809 100644
--- a/src/secret.c
+++ b/src/secret.c
@@ -113,6 +113,26 @@ virtDBusSecretGetXMLDesc(GVariant *inArgs,
     *outArgs = g_variant_new("(s)", xml);
 }
 
+static void
+virtDBusSecretUndefine(GVariant *inArgs G_GNUC_UNUSED,
+                       GUnixFDList *inFDs G_GNUC_UNUSED,
+                       const gchar *objectPath,
+                       gpointer userData,
+                       GVariant **outArgs G_GNUC_UNUSED,
+                       GUnixFDList **outFDs G_GNUC_UNUSED,
+                       GError **error)
+{
+    virtDBusConnect *connect = userData;
+    g_autoptr(virSecret) secret = NULL;
+
+    secret = virtDBusSecretGetVirSecret(connect, objectPath, error);
+    if (!secret)
+        return;
+
+    if (virSecretUndefine(secret) < 0)
+        virtDBusUtilSetLastVirtError(error);
+}
+
 static virtDBusGDBusPropertyTable virtDBusSecretPropertyTable[] = {
     { "UUID", virtDBusSecretGetUUID, NULL },
     { "UsageID", virtDBusSecretGetUsageID, NULL },
@@ -122,6 +142,7 @@ static virtDBusGDBusPropertyTable 
virtDBusSecretPropertyTable[] = {
 
 static virtDBusGDBusMethodTable virtDBusSecretMethodTable[] = {
     { "GetXMLDesc", virtDBusSecretGetXMLDesc },
+    { "Undefine", virtDBusSecretUndefine },
     { 0 }
 };
 
-- 
2.15.0

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

Reply via email to