/** * ovirt_collection_fetch: * @collection: a #OvirtCollection * @proxy: a #OvirtProxy * @error: #GError to set on error, or NULL */ gboolean ovirt_collection_fetch(OvirtCollection *collection, OvirtProxy *proxy, GError **error) { RestXmlNode *xml; g_return_val_if_fail(OVIRT_IS_COLLECTION(collection), FALSE); g_return_val_if_fail(OVIRT_IS_PROXY(proxy), FALSE); g_return_val_if_fail(collection->priv->href != NULL, FALSE); xml = ovirt_proxy_get_collection_xml(proxy, collection->priv->href, NULL); if (xml == NULL) return FALSE; ovirt_collection_refresh_from_xml(collection, xml, error); rest_xml_node_unref(xml); return TRUE; }
/** * ovirt_collection_fetch_async: * @collection: a #OvirtCollection * @proxy: a #OvirtProxy * @callback: (scope async): completion callback * @user_data: (closure): opaque data for callback */ void ovirt_collection_fetch_async(OvirtCollection *collection, OvirtProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { GSimpleAsyncResult *result; g_return_if_fail(OVIRT_IS_COLLECTION(collection)); g_return_if_fail(OVIRT_IS_PROXY(proxy)); g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable)); result = g_simple_async_result_new (G_OBJECT(collection), callback, user_data, ovirt_collection_fetch_async); ovirt_proxy_get_collection_xml_async(proxy, collection->priv->href, result, cancellable, ovirt_collection_fetch_async_cb, collection, NULL); }
/** * ovirt_set_proxy_options: * @proxy: a #OvirtProxy to set options upon * * Set various properties on @proxy, according to the commandline * arguments given to ovirt_get_option_group() option group. **/ void ovirt_set_proxy_options(OvirtProxy *proxy) { g_return_if_fail(OVIRT_IS_PROXY(proxy)); if (ca_file) { gchar *ca_file_absolute_path = NULL; #ifndef G_OS_WIN32 /* We have to treat files with non-absolute paths starting * with tilde (eg, ~foo/bar/ca.crt or ~/bar/ca.cert). * Other non-absolute paths will be treated down in the * stack, by libsoup, simply prepending the user's current * dir to the file path */ if (ca_file[0] == '~') ca_file_absolute_path = expand_initial_tilde(ca_file); #endif g_object_set(G_OBJECT(proxy), "ssl-ca-file", ca_file_absolute_path != NULL ? ca_file_absolute_path : ca_file, NULL); g_free (ca_file_absolute_path); } }
OvirtActionRestCall *ovirt_action_rest_call_new(RestProxy *proxy) { g_return_val_if_fail(OVIRT_IS_PROXY(proxy), NULL); return OVIRT_ACTION_REST_CALL(g_object_new(OVIRT_TYPE_ACTION_REST_CALL, "proxy", proxy, NULL)); }