def _validate_named_port_params(params):
 if (not params['named_ports']):
  return (True, '')
 if (not isinstance(params['named_ports'], list)):
  return (False, 'named_ports: expected list of name:port dictionaries.')
 req_fields = [{'name': 'name', 'required': True, 'type': str}, {'name': 'port', 'required': True, 'type': int}]
 for np in params['named_ports']:
  (valid_named_ports, np_msg) = _check_params(np, req_fields)
  if (not valid_named_ports):
   return (False, np_msg)
 return (True, '')

def _validate_named_port_params ( params ) : if ( not params [ 'named_ports' ] ) : return ( True , '' ) if ( not isinstance ( params [ 'named_ports' ] , list ) ) : return ( False , 'named_ports: expected list of name:port dictionaries.' ) req_fields = [ { 'name' : 'name' , 'required' : True , 'type' : str } , { 'name' : 'port' , 'required' : True , 'type' : int } ] for np in params [ 'named_ports' ] : ( valid_named_ports , np_msg ) = _check_params ( np , req_fields ) if ( not valid_named_ports ) : return ( False , np_msg ) return ( True , '' )
validate the named ports parameters .