function createPoolValidate(appData, postData, callback) {
    logutils.logger.debug('createPoolValidate');
    if (!('loadbalancer-pool' in postData)) {
        error = new appErrors.RESTServerError(
                'Load Balancer Pool object missing ');
        callback(error, postData);
        return;
    }
    var pCreateURL = '/loadbalancer-pools';
    var pPostData = {};
    pPostData['loadbalancer-pool'] = postData['loadbalancer-pool'];
    if ((!('loadbalancer-pool' in pPostData))
            || (!('fq_name' in pPostData['loadbalancer-pool']))) {
        error = new appErrors.RESTServerError('Enter Pool Name ');
        callback(error, null);
        return;
    }
    if ((!('loadbalancer-pool' in pPostData))
            || (!('parent_type' in pPostData['loadbalancer-pool']))) {
        error = new appErrors.RESTServerError('Parent Type is required ');
        callback(error, null);
        return;
    }
    if (pPostData['loadbalancer-pool']['fq_name'].length > 2) {
        var uuid = UUID.create();
        pPostData['loadbalancer-pool']['uuid'] = uuid['hex'];
        pPostData['loadbalancer-pool']['fq_name'][2] = pPostData['loadbalancer-pool']['name']
                + '-' + uuid['hex'];
    }

    if ((!('loadbalancer-pool' in pPostData))
            || (!('loadbalancer_pool_properties' in pPostData['loadbalancer-pool']))) {
        error = new appErrors.RESTServerError('Pool Properties are missing ');
        callback(error, null);
        return;
    }
    if ((!('loadbalancer-pool' in pPostData))
            || (!('loadbalancer_method' in pPostData['loadbalancer-pool']['loadbalancer_pool_properties']))) {
        error = new appErrors.RESTServerError('Pool Method is missing ');
        callback(error, null);
        return;
    }
    pPostData['loadbalancer-pool']['display_name'] = pPostData['loadbalancer-pool']['name'];
    pPostData['loadbalancer-pool']['loadbalancer_listener_refs'] = [ {
        'to' : postData['loadbalancer-listener']['fq_name']
    } ];

    if ((!('loadbalancer_healthmonitor' in pPostData))
            || (!('uuid' in pPostData['loadbalancer_healthmonitor']))) {
        pPostData['loadbalancer-pool']['loadbalancer_healthmonitor_refs'] = [ {
            'to' : postData['loadbalancer-healthmonitor']['fq_name']
        } ];
    }
    // logutils.logger.debug('pPostData:'+ JSON.stringify(pPostData));
    configApiServer
            .apiPost(
                    pCreateURL,
                    pPostData,
                    appData,
                    function(error, pData) {
                        if (error) {
                            callback(error, null);
                            return;
                        }
                        var pId = pData['loadbalancer-pool']['uuid'];
                        readPoolwithUUID(
                                pId,
                                appData,
                                function(err, pData) {
                                    if (err) {
                                        callback(err, pData);
                                        return;
                                    }

                                    if (('loadbalancer-member' in postData)) {
                                        var mLength = postData['loadbalancer-member'].length;
                                        for (i = 0; i < mLength; i++) {
                                            postData['loadbalancer-member'][i]['fq_name'][2] = pData['loadbalancer-pool']['name'];
                                            postData['loadbalancer-member'][i]['parent_type'] = 'loadbalancer-pool';
                                        }
                                    }
                                    postData['loadbalancer-pool'] = pData['loadbalancer-pool'];
                                    // logutils.logger.debug('postData:'+
                                    // JSON.stringify(postData));
                                    callback(err, postData);
                                });
                    });
}
/**
 * createPoolValidate private function 1. Basic validation before creating the
 * Load Balancer - Pool
 */
createPoolValidate private function 1. Basic validation before creating the
Load Balancer - Pool
createPoolValidate private function 1 . Basic validation before creating the Load Balancer - Pool
function createPoolValidate(appData, postData, callback) {
    logutils.logger.debug('createPoolValidate');
    if (!('loadbalancer-pool' in postData)) {
        error = new appErrors.RESTServerError(
                'Load Balancer Pool object missing ');
        callback(error, postData);
        return;
    }
    var pCreateURL = '/loadbalancer-pools';
    var pPostData = {};
    pPostData['loadbalancer-pool'] = postData['loadbalancer-pool'];
    if ((!('loadbalancer-pool' in pPostData))
            || (!('fq_name' in pPostData['loadbalancer-pool']))) {
        error = new appErrors.RESTServerError('Enter Pool Name ');
        callback(error, null);
        return;
    }
    if ((!('loadbalancer-pool' in pPostData))
            || (!('parent_type' in pPostData['loadbalancer-pool']))) {
        error = new appErrors.RESTServerError('Parent Type is required ');
        callback(error, null);
        return;
    }
    if (pPostData['loadbalancer-pool']['fq_name'].length > 2) {
        var uuid = UUID.create();
        pPostData['loadbalancer-pool']['uuid'] = uuid['hex'];
        pPostData['loadbalancer-pool']['fq_name'][2] = pPostData['loadbalancer-pool']['name']
                + '-' + uuid['hex'];
    }
    if ((!('loadbalancer-pool' in pPostData))
            || (!('loadbalancer_pool_properties' in pPostData['loadbalancer-pool']))) {
        error = new appErrors.RESTServerError('Pool Properties are missing ');
        callback(error, null);
        return;
    }
    if ((!('loadbalancer-pool' in pPostData))
            || (!('loadbalancer_method' in pPostData['loadbalancer-pool']['loadbalancer_pool_properties']))) {
        error = new appErrors.RESTServerError('Pool Method is missing ');
        callback(error, null);
        return;
    }
    pPostData['loadbalancer-pool']['display_name'] = pPostData['loadbalancer-pool']['name'];
    pPostData['loadbalancer-pool']['loadbalancer_listener_refs'] = [ {
        'to' : postData['loadbalancer-listener']['fq_name']
    } ];
    if ((!('loadbalancer_healthmonitor' in pPostData))
            || (!('uuid' in pPostData['loadbalancer_healthmonitor']))) {
        pPostData['loadbalancer-pool']['loadbalancer_healthmonitor_refs'] = [ {
            'to' : postData['loadbalancer-healthmonitor']['fq_name']
        } ];
    }
    configApiServer
            .apiPost(
                    pCreateURL,
                    pPostData,
                    appData,
                    function(error, pData) {
                        if (error) {
                            callback(error, null);
                            return;
                        }
                        var pId = pData['loadbalancer-pool']['uuid'];
                        readPoolwithUUID(
                                pId,
                                appData,
                                function(err, pData) {
                                    if (err) {
                                        callback(err, pData);
                                        return;
                                    }
                                    if (('loadbalancer-member' in postData)) {
                                        var mLength = postData['loadbalancer-member'].length;
                                        for (i = 0; i < mLength; i++) {
                                            postData['loadbalancer-member'][i]['fq_name'][2] = pData['loadbalancer-pool']['name'];
                                            postData['loadbalancer-member'][i]['parent_type'] = 'loadbalancer-pool';
                                        }
                                    }
                                    postData['loadbalancer-pool'] = pData['loadbalancer-pool'];
                                    callback(err, postData);
                                });
                    });
}
function createPoolValidate ( appData , postData , callback ) { logutils . logger . debug ( 'createPoolValidate' ) ; if ( ! ( 'loadbalancer-pool' in postData ) ) { error = new appErrors . RESTServerError ( 'Load Balancer Pool object missing ' ) ; callback ( error , postData ) ; return ; } var pCreateURL = '/loadbalancer-pools' ; var pPostData = { } ; pPostData [ 'loadbalancer-pool' ] = postData [ 'loadbalancer-pool' ] ; if ( ( ! ( 'loadbalancer-pool' in pPostData ) ) || ( ! ( 'fq_name' in pPostData [ 'loadbalancer-pool' ] ) ) ) { error = new appErrors . RESTServerError ( 'Enter Pool Name ' ) ; callback ( error , null ) ; return ; } if ( ( ! ( 'loadbalancer-pool' in pPostData ) ) || ( ! ( 'parent_type' in pPostData [ 'loadbalancer-pool' ] ) ) ) { error = new appErrors . RESTServerError ( 'Parent Type is required ' ) ; callback ( error , null ) ; return ; } if ( pPostData [ 'loadbalancer-pool' ] [ 'fq_name' ] . length > 2 ) { var uuid = UUID . create ( ) ; pPostData [ 'loadbalancer-pool' ] [ 'uuid' ] = uuid [ 'hex' ] ; pPostData [ 'loadbalancer-pool' ] [ 'fq_name' ] [ 2 ] = pPostData [ 'loadbalancer-pool' ] [ 'name' ] + '-' + uuid [ 'hex' ] ; } if ( ( ! ( 'loadbalancer-pool' in pPostData ) ) || ( ! ( 'loadbalancer_pool_properties' in pPostData [ 'loadbalancer-pool' ] ) ) ) { error = new appErrors . RESTServerError ( 'Pool Properties are missing ' ) ; callback ( error , null ) ; return ; } if ( ( ! ( 'loadbalancer-pool' in pPostData ) ) || ( ! ( 'loadbalancer_method' in pPostData [ 'loadbalancer-pool' ] [ 'loadbalancer_pool_properties' ] ) ) ) { error = new appErrors . RESTServerError ( 'Pool Method is missing ' ) ; callback ( error , null ) ; return ; } pPostData [ 'loadbalancer-pool' ] [ 'display_name' ] = pPostData [ 'loadbalancer-pool' ] [ 'name' ] ; pPostData [ 'loadbalancer-pool' ] [ 'loadbalancer_listener_refs' ] = [ { 'to' : postData [ 'loadbalancer-listener' ] [ 'fq_name' ] } ] ; if ( ( ! ( 'loadbalancer_healthmonitor' in pPostData ) ) || ( ! ( 'uuid' in pPostData [ 'loadbalancer_healthmonitor' ] ) ) ) { pPostData [ 'loadbalancer-pool' ] [ 'loadbalancer_healthmonitor_refs' ] = [ { 'to' : postData [ 'loadbalancer-healthmonitor' ] [ 'fq_name' ] } ] ; } configApiServer . apiPost ( pCreateURL , pPostData , appData , function ( error , pData ) { if ( error ) { callback ( error , null ) ; return ; } var pId = pData [ 'loadbalancer-pool' ] [ 'uuid' ] ; readPoolwithUUID ( pId , appData , function ( err , pData ) { if ( err ) { callback ( err , pData ) ; return ; } if ( ( 'loadbalancer-member' in postData ) ) { var mLength = postData [ 'loadbalancer-member' ] . length ; for ( i = 0 ; i < mLength ; i ++ ) { postData [ 'loadbalancer-member' ] [ i ] [ 'fq_name' ] [ 2 ] = pData [ 'loadbalancer-pool' ] [ 'name' ] ; postData [ 'loadbalancer-member' ] [ i ] [ 'parent_type' ] = 'loadbalancer-pool' ; } } postData [ 'loadbalancer-pool' ] = pData [ 'loadbalancer-pool' ] ; callback ( err , postData ) ; } ) ; } ) ; }
createPoolValidate private function 1.
createPoolValidate private function 1 .
// logutils.logger.debug('pPostData:'+ JSON.stringify(pPostData)); // logutils.logger.debug('postData:'+ // JSON.stringify(postData));