func (lgc *Logic) AddStream(stream *graylog.Stream) (int, error) {
	if err := validator.CreateValidator.Struct(stream); err != nil {
		return 400, err
	}
	// check index set existence
	is, sc, err := lgc.GetIndexSet(stream.IndexSetID)
	if err != nil {
		LogWE(sc, lgc.Logger().WithFields(log.Fields{
			"error": err, "index_set_id": stream.IndexSetID, "status_code": sc,
		}), "failed to get an index set")
		return sc, err
	}
	if !is.Writable {
		return 400, fmt.Errorf("assigned index set must be writable")
	}
	if err := lgc.store.AddStream(stream); err != nil {
		return 500, err
	}
	return 200, nil
}
// AddStream adds a stream to the Server.
AddStream adds a stream to the Server.
// AddStream adds a stream to the Server .
func (lgc *Logic) AddStream(stream *graylog.Stream) (int, error) {
	if err := validator.CreateValidator.Struct(stream); err != nil {
		return 400, err
	}
	is, sc, err := lgc.GetIndexSet(stream.IndexSetID)
	if err != nil {
		LogWE(sc, lgc.Logger().WithFields(log.Fields{
			"error": err, "index_set_id": stream.IndexSetID, "status_code": sc,
		}), "failed to get an index set")
		return sc, err
	}
	if !is.Writable {
		return 400, fmt.Errorf("assigned index set must be writable")
	}
	if err := lgc.store.AddStream(stream); err != nil {
		return 500, err
	}
	return 200, nil
}
func ( lgc * Logic ) AddStream ( stream * graylog . Stream ) ( int , error ) { if err := validator . CreateValidator . Struct ( stream ) ; err != nil { return 400 , err } is , sc , err := lgc . GetIndexSet ( stream . IndexSetID ) if err != nil { LogWE ( sc , lgc . Logger ( ) . WithFields ( log . Fields { " " : err , " " : stream . IndexSetID , " " : sc , } ) , " " ) return sc , err } if ! is . Writable { return 400 , fmt . Errorf ( " " ) } if err := lgc . store . AddStream ( stream ) ; err != nil { return 500 , err } return 200 , nil }
AddStream adds a stream to the Server.
AddStream adds a stream to the Server .
// check index set existence