Signed-off-by: Katerina Koukiou <kkouk...@redhat.com> --- data/org.libvirt.Secret.xml | 6 ++++++ src/secret.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+)
diff --git a/data/org.libvirt.Secret.xml b/data/org.libvirt.Secret.xml index 4270182..d35af38 100644 --- a/data/org.libvirt.Secret.xml +++ b/data/org.libvirt.Secret.xml @@ -18,5 +18,11 @@ value="See https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetUsageType"/> <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/> </property> + <method name="GetXMLDesc"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetXMLDesc"/> + <arg name="flags" type="u" direction="in"/> + <arg name="xml" type="s" direction="out"/> + </method> </interface> </node> diff --git a/src/secret.c b/src/secret.c index 25b1934..28b1852 100644 --- a/src/secret.c +++ b/src/secret.c @@ -86,6 +86,33 @@ virtDBusSecretGetUsageType(const gchar *objectPath, *value = g_variant_new("u", usageType); } +static void +virtDBusSecretGetXMLDesc(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect = userData; + g_autoptr(virSecret) secret = NULL; + g_autofree gchar *xml = NULL; + guint flags; + + g_variant_get(inArgs, "(u)", &flags); + + secret = virtDBusSecretGetVirSecret(connect, objectPath, error); + if (!secret) + return; + + xml = virSecretGetXMLDesc(secret, flags); + if (!xml) + return virtDBusUtilSetLastVirtError(error); + + *outArgs = g_variant_new("(s)", xml); +} + static virtDBusGDBusPropertyTable virtDBusSecretPropertyTable[] = { { "UUID", virtDBusSecretGetUUID, NULL }, { "UsageID", virtDBusSecretGetUsageID, NULL }, @@ -94,6 +121,7 @@ static virtDBusGDBusPropertyTable virtDBusSecretPropertyTable[] = { }; static virtDBusGDBusMethodTable virtDBusSecretMethodTable[] = { + { "GetXMLDesc", virtDBusSecretGetXMLDesc }, { 0 } }; -- 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list