keygen/src/iam.c
/**
 * iam_error_unmarshall() - Marshall an error response from XIAM
 * @str: The JSON string to marshall
 * @out: A structure to write the return data into
 *
 * Return: 1 on success, 0 if structure cannot be read
 */
Marshall an error response from XIAM
@str: The JSON string to marshall
@out: A structure to write the return data into

1 on success, 0 if structure cannot be read
Marshall an error response from XIAM @str : The JSON string to marshall @out : A structure to write the return data into 1 on success 0 if structure cannot be read
static int iam_error_unmarshall(char *str, struct iam_error *out) {
    json_t *root = NULL;
    struct iam_error error = {-1, -1, ""};
    int ret = 1;
    root = json_loads(str, 0, NULL);
    if (!root || !json_object_get(root, "xiam_error") || !json_object_get(root, "http_error") ||
        !json_object_get(root, "reason")) {
        ret = 0;
        goto out;
    }
    error.error = json_integer_value(json_object_get(root, "xiam_error"));
    error.http_error = json_integer_value(json_object_get(root, "http_error"));
    error.reason = new_json_str(json_object_get(root, "reason"));
    *out = error;
out:
    return ret;
}
static int iam_error_unmarshall ( char * str , struct iam_error * out ) { json_t * root = NULL ; struct iam_error error = { -1 , -1 , " " } ; int ret = 1 ; root = json_loads ( str , 0 , NULL ) ; if ( ! root || ! json_object_get ( root , " " ) || ! json_object_get ( root , " " ) || ! json_object_get ( root , " " ) ) { ret = 0 ; goto out ; } error . error = json_integer_value ( json_object_get ( root , " " ) ) ; error . http_error = json_integer_value ( json_object_get ( root , " " ) ) ; error . reason = new_json_str ( json_object_get ( root , " " ) ) ; * out = error ; out : return ret ; }
iam_error_unmarshall() - Marshall an error response from XIAM
 @str: The JSON string to marshall
 @out: A structure to write the return data into
iam_error_unmarshall () - Marshall an error response from XIAM @str : The JSON string to marshall @out : A structure to write the return data into
/* Validate the object */