gobj_create_resource()

gobj_create_resource()#

The function gobj_create_resource() creates a new resource in the specified GObj, using the provided JSON parameters and options.

Prototype

json_t *gobj_create_resource(
    hgobj gobj,
    const char *resource,
    json_t *kw,
    json_t *jn_options
);

Parameters

Key

Type

Description

gobj

hgobj

The GObj in which the resource will be created.

resource

const char *

The name of the resource to be created.

kw

json_t *

A JSON object containing the attributes and data for the new resource. This parameter is owned by the function.

jn_options

json_t *

A JSON object containing additional options for resource creation. This parameter is owned by the function.


Return Value

Returns a JSON object representing the created resource. If the operation fails, returns NULL.

Notes

The function requires that the GObj has the mt_create_resource method implemented. If the method is not defined, an error is logged, and the function returns NULL.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples