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

    if ((!('loadbalancer-listener' in llPostData))
            || (!('protocol' in llPostData['loadbalancer-listener']['loadbalancer_listener_properties']))) {
        error = new appErrors.RESTServerError('Listener Protocol is missing ');
        callback(error, null);
        return;
    }
    if ((!('loadbalancer-listener' in llPostData))
            || (!('protocol_port' in llPostData['loadbalancer-listener']['loadbalancer_listener_properties']))) {
        error = new appErrors.RESTServerError('Listener Port is missing ');
        callback(error, null);
        return;
    }

    llPostData['loadbalancer-listener']['display_name'] = llPostData['loadbalancer-listener']['name'];
    llPostData['loadbalancer-listener']['loadbalancer_refs'] = [ {
        'to' : postData['loadbalancer']['fq_name']
    } ];

    configApiServer
            .apiPost(
                    llCreateURL,
                    llPostData,
                    appData,
                    function(error, llData) {
                        if (error) {
                            callback(error, null);
                            return;
                        }
                        var llId = llData['loadbalancer-listener']['uuid'];
                        readLLwithUUID(
                                llId,
                                appData,
                                function(err, llData) {
                                    if (err) {
                                        callback(err, llData);
                                        return;
                                    }
                                    postData['loadbalancer-listener'] = llData['loadbalancer-listener'];
                                    callback(null, postData);
                                });
                    });
}
/**
 * @createLoadBalancer private function 1. Basic validation before creating the
 *                     Load Balancer
 */
@createLoadBalancer private function 1. Basic validation before creating the
Load Balancer
@createLoadBalancer private function 1 . Basic validation before creating the Load Balancer
function createListenerValidate(appData, postData, callback) {
    logutils.logger.debug('createListenerValidate');
    if (!('loadbalancer-listener' in postData)) {
        error = new appErrors.RESTServerError(
                'Load Balancer Listener object missing ');
        callback(error, postData);
        return;
    }
    var llCreateURL = '/loadbalancer-listeners';
    var llPostData = {};
    llPostData['loadbalancer-listener'] = postData['loadbalancer-listener'];
    if ((!('loadbalancer-listener' in llPostData))
            || (!('fq_name' in llPostData['loadbalancer-listener']))) {
        error = new appErrors.RESTServerError('Enter Load Balancer Name ');
        callback(error, null);
        return;
    }
    if ((!('loadbalancer-listener' in llPostData))
            || (!('parent_type' in llPostData['loadbalancer-listener']))) {
        error = new appErrors.RESTServerError('Parent Type is required ');
        callback(error, null);
        return;
    }
    if (llPostData['loadbalancer-listener']['fq_name'].length > 2) {
        var uuid = UUID.create();
        llPostData['loadbalancer-listener']['uuid'] = uuid['hex'];
        llPostData['loadbalancer-listener']['fq_name'][2] = llPostData['loadbalancer-listener']['name']
                + '-' + uuid['hex'];
    }
    if ((!('loadbalancer-listener' in llPostData))
            || (!('protocol' in llPostData['loadbalancer-listener']['loadbalancer_listener_properties']))) {
        error = new appErrors.RESTServerError('Listener Protocol is missing ');
        callback(error, null);
        return;
    }
    if ((!('loadbalancer-listener' in llPostData))
            || (!('protocol_port' in llPostData['loadbalancer-listener']['loadbalancer_listener_properties']))) {
        error = new appErrors.RESTServerError('Listener Port is missing ');
        callback(error, null);
        return;
    }
    llPostData['loadbalancer-listener']['display_name'] = llPostData['loadbalancer-listener']['name'];
    llPostData['loadbalancer-listener']['loadbalancer_refs'] = [ {
        'to' : postData['loadbalancer']['fq_name']
    } ];
    configApiServer
            .apiPost(
                    llCreateURL,
                    llPostData,
                    appData,
                    function(error, llData) {
                        if (error) {
                            callback(error, null);
                            return;
                        }
                        var llId = llData['loadbalancer-listener']['uuid'];
                        readLLwithUUID(
                                llId,
                                appData,
                                function(err, llData) {
                                    if (err) {
                                        callback(err, llData);
                                        return;
                                    }
                                    postData['loadbalancer-listener'] = llData['loadbalancer-listener'];
                                    callback(null, postData);
                                });
                    });
}
function createListenerValidate ( appData , postData , callback ) { logutils . logger . debug ( 'createListenerValidate' ) ; if ( ! ( 'loadbalancer-listener' in postData ) ) { error = new appErrors . RESTServerError ( 'Load Balancer Listener object missing ' ) ; callback ( error , postData ) ; return ; } var llCreateURL = '/loadbalancer-listeners' ; var llPostData = { } ; llPostData [ 'loadbalancer-listener' ] = postData [ 'loadbalancer-listener' ] ; if ( ( ! ( 'loadbalancer-listener' in llPostData ) ) || ( ! ( 'fq_name' in llPostData [ 'loadbalancer-listener' ] ) ) ) { error = new appErrors . RESTServerError ( 'Enter Load Balancer Name ' ) ; callback ( error , null ) ; return ; } if ( ( ! ( 'loadbalancer-listener' in llPostData ) ) || ( ! ( 'parent_type' in llPostData [ 'loadbalancer-listener' ] ) ) ) { error = new appErrors . RESTServerError ( 'Parent Type is required ' ) ; callback ( error , null ) ; return ; } if ( llPostData [ 'loadbalancer-listener' ] [ 'fq_name' ] . length > 2 ) { var uuid = UUID . create ( ) ; llPostData [ 'loadbalancer-listener' ] [ 'uuid' ] = uuid [ 'hex' ] ; llPostData [ 'loadbalancer-listener' ] [ 'fq_name' ] [ 2 ] = llPostData [ 'loadbalancer-listener' ] [ 'name' ] + '-' + uuid [ 'hex' ] ; } if ( ( ! ( 'loadbalancer-listener' in llPostData ) ) || ( ! ( 'protocol' in llPostData [ 'loadbalancer-listener' ] [ 'loadbalancer_listener_properties' ] ) ) ) { error = new appErrors . RESTServerError ( 'Listener Protocol is missing ' ) ; callback ( error , null ) ; return ; } if ( ( ! ( 'loadbalancer-listener' in llPostData ) ) || ( ! ( 'protocol_port' in llPostData [ 'loadbalancer-listener' ] [ 'loadbalancer_listener_properties' ] ) ) ) { error = new appErrors . RESTServerError ( 'Listener Port is missing ' ) ; callback ( error , null ) ; return ; } llPostData [ 'loadbalancer-listener' ] [ 'display_name' ] = llPostData [ 'loadbalancer-listener' ] [ 'name' ] ; llPostData [ 'loadbalancer-listener' ] [ 'loadbalancer_refs' ] = [ { 'to' : postData [ 'loadbalancer' ] [ 'fq_name' ] } ] ; configApiServer . apiPost ( llCreateURL , llPostData , appData , function ( error , llData ) { if ( error ) { callback ( error , null ) ; return ; } var llId = llData [ 'loadbalancer-listener' ] [ 'uuid' ] ; readLLwithUUID ( llId , appData , function ( err , llData ) { if ( err ) { callback ( err , llData ) ; return ; } postData [ 'loadbalancer-listener' ] = llData [ 'loadbalancer-listener' ] ; callback ( null , postData ) ; } ) ; } ) ; }
@createLoadBalancer private function 1.
@createLoadBalancer private function 1 .