func HandleUpdateStream(
	user *graylog.User, lgc *logic.Logic,
	w http.ResponseWriter, r *http.Request, ps httprouter.Params,
) (interface{}, int, error) {
	// PUT /streams/{streamID} Update a stream
	prms := &graylog.StreamUpdateParams{ID: ps.ByName("streamID")}
	if sc, err := lgc.Authorize(user, "streams:edit", prms.ID); err != nil {
		return nil, sc, err
	}

	body, sc, err := validateRequestBody(
		r.Body, &validateReqBodyPrms{
			Required: nil,
			Optional: set.NewStrSet(
				"title", "index_set_id", "description", "outputs", "matching_type",
				"rules", "alert_conditions", "alert_receivers",
				"remove_matches_from_default_stream"),
			Ignored:      set.NewStrSet("creator_user_id", "created_at", "disabled", "is_default"),
			ExtForbidden: false,
		})
	if err != nil {
		return nil, sc, err
	}

	if err := util.MSDecode(body, prms); err != nil {
		lgc.Logger().WithFields(log.Fields{
			"body": body, "error": err,
		}).Warn("Failed to parse request body as stream")
		return nil, 400, err
	}

	stream, sc, err := lgc.UpdateStream(prms)
	if err != nil {
		return nil, sc, err
	}
	if err := lgc.Save(); err != nil {
		return nil, 500, err
	}
	return stream, sc, nil
}
// HandleUpdateStream is the handler of Update a Stream API.
HandleUpdateStream is the handler of Update a Stream API.
// HandleUpdateStream is the handler of Update a Stream API .
func HandleUpdateStream(
	user *graylog.User, lgc *logic.Logic,
	w http.ResponseWriter, r *http.Request, ps httprouter.Params,
) (interface{}, int, error) {
	prms := &graylog.StreamUpdateParams{ID: ps.ByName("streamID")}
	if sc, err := lgc.Authorize(user, "streams:edit", prms.ID); err != nil {
		return nil, sc, err
	}
	body, sc, err := validateRequestBody(
		r.Body, &validateReqBodyPrms{
			Required: nil,
			Optional: set.NewStrSet(
				"title", "index_set_id", "description", "outputs", "matching_type",
				"rules", "alert_conditions", "alert_receivers",
				"remove_matches_from_default_stream"),
			Ignored:      set.NewStrSet("creator_user_id", "created_at", "disabled", "is_default"),
			ExtForbidden: false,
		})
	if err != nil {
		return nil, sc, err
	}
	if err := util.MSDecode(body, prms); err != nil {
		lgc.Logger().WithFields(log.Fields{
			"body": body, "error": err,
		}).Warn("Failed to parse request body as stream")
		return nil, 400, err
	}
	stream, sc, err := lgc.UpdateStream(prms)
	if err != nil {
		return nil, sc, err
	}
	if err := lgc.Save(); err != nil {
		return nil, 500, err
	}
	return stream, sc, nil
}
func HandleUpdateStream ( user * graylog . User , lgc * logic . Logic , w http . ResponseWriter , r * http . Request , ps httprouter . Params , ) ( interface { } , int , error ) { prms := & graylog . StreamUpdateParams { ID : ps . ByName ( " " ) } if sc , err := lgc . Authorize ( user , " " , prms . ID ) ; err != nil { return nil , sc , err } body , sc , err := validateRequestBody ( r . Body , & validateReqBodyPrms { Required : nil , Optional : set . NewStrSet ( " " , " " , " " , " " , " " , " " , " " , " " , " " ) , Ignored : set . NewStrSet ( " " , " " , " " , " " ) , ExtForbidden : false , } ) if err != nil { return nil , sc , err } if err := util . MSDecode ( body , prms ) ; err != nil { lgc . Logger ( ) . WithFields ( log . Fields { " " : body , " " : err , } ) . Warn ( " " ) return nil , 400 , err } stream , sc , err := lgc . UpdateStream ( prms ) if err != nil { return nil , sc , err } if err := lgc . Save ( ) ; err != nil { return nil , 500 , err } return stream , sc , nil }
HandleUpdateStream is the handler of Update a Stream API.
HandleUpdateStream is the handler of Update a Stream API .
// PUT /streams/{streamID} Update a stream