keygen/src/iam.c
/**
 * ep_auth_marshal() - Generate a JSON object to send to IAM endpoints API
 * @auth: The login user and password (key)
 *
 * Return: The new JSON data
 */
Generate a JSON object to send to IAM endpoints API
@auth: The login user and password (key)

The new JSON data
Generate a JSON object to send to IAM endpoints API @auth : The login user and password ( key ) The new JSON data
char *ep_auth_marshal(struct iam_create_endpoint_request *auth)
{
    json_t *new_endpoint_auth = json_object();
    json_t *new_credential = json_object();
    json_t *address_request = json_object();
    char *auth_str = NULL;
    const char *endpoint_name = auth->type == NETWORK ? "network" : "address";
    int ret = 0;
    ret |= json_object_set_new(new_credential, "type", json_string(auth->ecdsa_credential.type));
    ret |= json_object_set_new(new_credential, "key", json_string(auth->ecdsa_credential.key));
    ret |= json_object_set_new(address_request, endpoint_name, json_string(auth->endpoint));
    ret |= json_object_set_new(new_endpoint_auth, "ecdsa_credential", new_credential);
    ret |= json_object_set_new(new_endpoint_auth, "address_request", address_request);
    if (ret)
        goto cleanup;
    auth_str = json_dumps(new_endpoint_auth, 0);
cleanup:
    json_decref(new_endpoint_auth);
    return auth_str;
}
char * ep_auth_marshal ( struct iam_create_endpoint_request * auth ) { json_t * new_endpoint_auth = json_object ( ) ; json_t * new_credential = json_object ( ) ; json_t * address_request = json_object ( ) ; char * auth_str = NULL ; const char * endpoint_name = auth -> type == NETWORK ? " " : " " ; int ret = 0 ; ret |= json_object_set_new ( new_credential , " " , json_string ( auth -> ecdsa_credential . type ) ) ; ret |= json_object_set_new ( new_credential , " " , json_string ( auth -> ecdsa_credential . key ) ) ; ret |= json_object_set_new ( address_request , endpoint_name , json_string ( auth -> endpoint ) ) ; ret |= json_object_set_new ( new_endpoint_auth , " " , new_credential ) ; ret |= json_object_set_new ( new_endpoint_auth , " " , address_request ) ; if ( ret ) goto cleanup ; auth_str = json_dumps ( new_endpoint_auth , 0 ) ; cleanup : json_decref ( new_endpoint_auth ) ; return auth_str ; }
ep_auth_marshal() - Generate a JSON object to send to IAM endpoints API
 @auth: The login user and password (key)
ep_auth_marshal () - Generate a JSON object to send to IAM endpoints API @auth : The login user and password ( key )
/* No specific memory has to be freed so it only needs to be known if any of them failed */ /* Do not generate the string if any of them failed */ /* Copy the assembled object to a new stirng */