lib/model.js
function(attrs) {
    if (!attrs.ssl || includes(['NONE', 'UNVALIDATED', 'IFAVAILABLE', 'SYSTEMCA'], attrs.ssl)) {
      return;
    }
    if (attrs.ssl === 'SERVER' && !attrs.ssl_ca) {
      throw new TypeError('ssl_ca is required when ssl is SERVER.');
    } else if (attrs.ssl === 'ALL') {
      if (!attrs.ssl_ca) {
        throw new TypeError('ssl_ca is required when ssl is ALL.');
      }

      if (!attrs.ssl_private_key) {
        throw new TypeError('ssl_private_key is required when ssl is ALL.');
      }

      if (!attrs.ssl_certificate) {
        throw new TypeError('ssl_certificate is required when ssl is ALL.');
      }
    }
  }
function(attrs) {
    if (!attrs.ssl || includes(['NONE', 'UNVALIDATED', 'IFAVAILABLE', 'SYSTEMCA'], attrs.ssl)) {
      return;
    }
    if (attrs.ssl === 'SERVER' && !attrs.ssl_ca) {
      throw new TypeError('ssl_ca is required when ssl is SERVER.');
    } else if (attrs.ssl === 'ALL') {
      if (!attrs.ssl_ca) {
        throw new TypeError('ssl_ca is required when ssl is ALL.');
      }

      if (!attrs.ssl_private_key) {
        throw new TypeError('ssl_private_key is required when ssl is ALL.');
      }

      if (!attrs.ssl_certificate) {
        throw new TypeError('ssl_certificate is required when ssl is ALL.');
      }
    }
  }
function ( attrs ) { if ( ! attrs . ssl || includes ( [ 'NONE' , 'UNVALIDATED' , 'IFAVAILABLE' , 'SYSTEMCA' ] , attrs . ssl ) ) { return ; } if ( attrs . ssl === 'SERVER' && ! attrs . ssl_ca ) { throw new TypeError ( 'ssl_ca is required when ssl is SERVER.' ) ; } else if ( attrs . ssl === 'ALL' ) { if ( ! attrs . ssl_ca ) { throw new TypeError ( 'ssl_ca is required when ssl is ALL.' ) ; } if ( ! attrs . ssl_private_key ) { throw new TypeError ( 'ssl_private_key is required when ssl is ALL.' ) ; } if ( ! attrs . ssl_certificate ) { throw new TypeError ( 'ssl_certificate is required when ssl is ALL.' ) ; } } }
Enforce constraints for SSL.
@param {Object} attrs - Incoming attributes.
Enforce constraints for SSL .