Example #1
0
func readListenerConfig(name string, kvs kvstore.KVStore) (lc *config.ListenerConfig, err error) {
	lc, err = config.ReadListenerConfig(name, kvs)

	if lc == nil {
		err = errors.New("Listener config '" + name + "' not found")
	}
	return
}
Example #2
0
//GetDefinition retrieves a specific listener definition
func (ListenerDef) GetDefinition(kvs kvstore.KVStore, resp http.ResponseWriter, req *http.Request) (interface{}, error) {
	listenerName := resourceIDFromURI(req.RequestURI)

	listenerConfig, err := config.ReadListenerConfig(listenerName, kvs)
	if err != nil {
		resp.WriteHeader(http.StatusInternalServerError)
		return nil, err
	}

	if listenerConfig == nil {
		resp.WriteHeader(http.StatusNotFound)
		return nil, errListenerNotFound
	}

	return listenerConfig, err

}