function createLoadBalancerValidate(appData, postData, callback) {
    logutils.logger.debug('createLoadBalancerValidate');
    if (!('loadbalancer' in postData)) {
        error = new appErrors.RESTServerError('Load Balancer object missing ');
        callback(error, postData);
        return;
    }
    var lbCreateURL = '/loadbalancers';
    var lbPostData = {};
    lbPostData.loadbalancer = postData['loadbalancer'];
    if ((!('loadbalancer' in lbPostData))
            || (!('fq_name' in lbPostData['loadbalancer']))) {
        error = new appErrors.RESTServerError('Enter Load Balancer Name ');
        callback(error, null);
        return;
    }
    if ((!('loadbalancer' in lbPostData))
            || (!('parent_type' in lbPostData['loadbalancer']))) {
        error = new appErrors.RESTServerError('Parent Type is required ');
        callback(error, null);
        return;
    }
    if (lbPostData['loadbalancer']['fq_name'].length > 2) {
        var uuid = UUID.create();
        lbPostData['loadbalancer']['uuid'] = uuid['hex'];
        lbPostData['loadbalancer']['fq_name'][2] = lbPostData['loadbalancer']['name']
                + '-' + uuid['hex'];
    }
    if ((!('loadbalancer' in lbPostData))
            || (!('vip_subnet_id' in lbPostData['loadbalancer']['loadbalancer_properties']))) {
        error = new appErrors.RESTServerError(
                'Select a subnet for Load Balancer ');
        callback(error, null);
        return;
    }
    if ((!('loadbalancer' in lbPostData))
            || (!('loadbalancer_provider' in lbPostData['loadbalancer']))) {
        error = new appErrors.RESTServerError(
                'Select a provider for Load Balancer ');
        callback(error, null);
        return;
    }
    lbPostData['loadbalancer']['display_name'] = lbPostData['loadbalancer']['name'];
    lbPostData['loadbalancer']['loadbalancer_properties']['provisioning_status'] = 'ACTIVE';
    lbPostData['loadbalancer']['loadbalancer_properties']['operating_status'] = 'ONLINE';
    configApiServer.apiPost(lbCreateURL, lbPostData, appData, function(error,
            lbData) {
        if (error) {
            callback(error, null);
            return;
        }
        // logutils.logger.debug('lbData:'+ JSON.stringify(lbData));
        var lbId = lbData['loadbalancer']['uuid'];
        readLBwithUUID(lbId, appData, function(err, lbData) {
            if (err) {
                callback(err, lbData);
                return;
            }
            postData['loadbalancer'] = lbData['loadbalancer'];
            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 createLoadBalancerValidate(appData, postData, callback) {
    logutils.logger.debug('createLoadBalancerValidate');
    if (!('loadbalancer' in postData)) {
        error = new appErrors.RESTServerError('Load Balancer object missing ');
        callback(error, postData);
        return;
    }
    var lbCreateURL = '/loadbalancers';
    var lbPostData = {};
    lbPostData.loadbalancer = postData['loadbalancer'];
    if ((!('loadbalancer' in lbPostData))
            || (!('fq_name' in lbPostData['loadbalancer']))) {
        error = new appErrors.RESTServerError('Enter Load Balancer Name ');
        callback(error, null);
        return;
    }
    if ((!('loadbalancer' in lbPostData))
            || (!('parent_type' in lbPostData['loadbalancer']))) {
        error = new appErrors.RESTServerError('Parent Type is required ');
        callback(error, null);
        return;
    }
    if (lbPostData['loadbalancer']['fq_name'].length > 2) {
        var uuid = UUID.create();
        lbPostData['loadbalancer']['uuid'] = uuid['hex'];
        lbPostData['loadbalancer']['fq_name'][2] = lbPostData['loadbalancer']['name']
                + '-' + uuid['hex'];
    }
    if ((!('loadbalancer' in lbPostData))
            || (!('vip_subnet_id' in lbPostData['loadbalancer']['loadbalancer_properties']))) {
        error = new appErrors.RESTServerError(
                'Select a subnet for Load Balancer ');
        callback(error, null);
        return;
    }
    if ((!('loadbalancer' in lbPostData))
            || (!('loadbalancer_provider' in lbPostData['loadbalancer']))) {
        error = new appErrors.RESTServerError(
                'Select a provider for Load Balancer ');
        callback(error, null);
        return;
    }
    lbPostData['loadbalancer']['display_name'] = lbPostData['loadbalancer']['name'];
    lbPostData['loadbalancer']['loadbalancer_properties']['provisioning_status'] = 'ACTIVE';
    lbPostData['loadbalancer']['loadbalancer_properties']['operating_status'] = 'ONLINE';
    configApiServer.apiPost(lbCreateURL, lbPostData, appData, function(error,
            lbData) {
        if (error) {
            callback(error, null);
            return;
        }
        var lbId = lbData['loadbalancer']['uuid'];
        readLBwithUUID(lbId, appData, function(err, lbData) {
            if (err) {
                callback(err, lbData);
                return;
            }
            postData['loadbalancer'] = lbData['loadbalancer'];
            callback(null, postData);
        });
    });
}
function createLoadBalancerValidate ( appData , postData , callback ) { logutils . logger . debug ( 'createLoadBalancerValidate' ) ; if ( ! ( 'loadbalancer' in postData ) ) { error = new appErrors . RESTServerError ( 'Load Balancer object missing ' ) ; callback ( error , postData ) ; return ; } var lbCreateURL = '/loadbalancers' ; var lbPostData = { } ; lbPostData . loadbalancer = postData [ 'loadbalancer' ] ; if ( ( ! ( 'loadbalancer' in lbPostData ) ) || ( ! ( 'fq_name' in lbPostData [ 'loadbalancer' ] ) ) ) { error = new appErrors . RESTServerError ( 'Enter Load Balancer Name ' ) ; callback ( error , null ) ; return ; } if ( ( ! ( 'loadbalancer' in lbPostData ) ) || ( ! ( 'parent_type' in lbPostData [ 'loadbalancer' ] ) ) ) { error = new appErrors . RESTServerError ( 'Parent Type is required ' ) ; callback ( error , null ) ; return ; } if ( lbPostData [ 'loadbalancer' ] [ 'fq_name' ] . length > 2 ) { var uuid = UUID . create ( ) ; lbPostData [ 'loadbalancer' ] [ 'uuid' ] = uuid [ 'hex' ] ; lbPostData [ 'loadbalancer' ] [ 'fq_name' ] [ 2 ] = lbPostData [ 'loadbalancer' ] [ 'name' ] + '-' + uuid [ 'hex' ] ; } if ( ( ! ( 'loadbalancer' in lbPostData ) ) || ( ! ( 'vip_subnet_id' in lbPostData [ 'loadbalancer' ] [ 'loadbalancer_properties' ] ) ) ) { error = new appErrors . RESTServerError ( 'Select a subnet for Load Balancer ' ) ; callback ( error , null ) ; return ; } if ( ( ! ( 'loadbalancer' in lbPostData ) ) || ( ! ( 'loadbalancer_provider' in lbPostData [ 'loadbalancer' ] ) ) ) { error = new appErrors . RESTServerError ( 'Select a provider for Load Balancer ' ) ; callback ( error , null ) ; return ; } lbPostData [ 'loadbalancer' ] [ 'display_name' ] = lbPostData [ 'loadbalancer' ] [ 'name' ] ; lbPostData [ 'loadbalancer' ] [ 'loadbalancer_properties' ] [ 'provisioning_status' ] = 'ACTIVE' ; lbPostData [ 'loadbalancer' ] [ 'loadbalancer_properties' ] [ 'operating_status' ] = 'ONLINE' ; configApiServer . apiPost ( lbCreateURL , lbPostData , appData , function ( error , lbData ) { if ( error ) { callback ( error , null ) ; return ; } var lbId = lbData [ 'loadbalancer' ] [ 'uuid' ] ; readLBwithUUID ( lbId , appData , function ( err , lbData ) { if ( err ) { callback ( err , lbData ) ; return ; } postData [ 'loadbalancer' ] = lbData [ 'loadbalancer' ] ; callback ( null , postData ) ; } ) ; } ) ; }
@createLoadBalancer private function 1.
@createLoadBalancer private function 1 .
// logutils.logger.debug('lbData:'+ JSON.stringify(lbData));