func (lgc *Logic) UpdateIndexSet(prms *graylog.IndexSetUpdateParams) (*graylog.IndexSet, int, error) {
	if prms == nil {
		return nil, 400, fmt.Errorf("index set is nil")
	}
	if err := validator.UpdateValidator.Struct(prms); err != nil {
		return nil, 400, err
	}
	ok, err := lgc.HasIndexSet(prms.ID)
	if err != nil {
		lgc.Logger().WithFields(log.Fields{
			"error": err, "id": prms.ID,
		}).Error("lgc.HasIndexSet() is failure")
		return nil, 500, err
	}
	if !ok {
		return nil, 404, fmt.Errorf("no indexSet found with id <%s>", prms.ID)
	}
	// indexPrefix unique check
	ok, err = lgc.store.IsConflictIndexPrefix(prms.ID, prms.IndexPrefix)
	if err != nil {
		return nil, 500, err
	}
	if ok {
		return nil, 400, fmt.Errorf(
			`index prefix "%s" would conflict with an existing index set`,
			prms.IndexPrefix)
	}
	defID, err := lgc.store.GetDefaultIndexSetID()
	if err != nil {
		return nil, 500, err
	}
	if defID == prms.ID && prms.Writable != nil && !(*prms.Writable) {
		return nil, 409, fmt.Errorf("default index set must be writable")
	}

	is, err := lgc.store.UpdateIndexSet(prms)
	if err != nil {
		return nil, 500, err
	}
	return is, 200, nil
}
// UpdateIndexSet updates an index set at the Mock Server.
UpdateIndexSet updates an index set at the Mock Server.
// UpdateIndexSet updates an index set at the Mock Server .
func (lgc *Logic) UpdateIndexSet(prms *graylog.IndexSetUpdateParams) (*graylog.IndexSet, int, error) {
	if prms == nil {
		return nil, 400, fmt.Errorf("index set is nil")
	}
	if err := validator.UpdateValidator.Struct(prms); err != nil {
		return nil, 400, err
	}
	ok, err := lgc.HasIndexSet(prms.ID)
	if err != nil {
		lgc.Logger().WithFields(log.Fields{
			"error": err, "id": prms.ID,
		}).Error("lgc.HasIndexSet() is failure")
		return nil, 500, err
	}
	if !ok {
		return nil, 404, fmt.Errorf("no indexSet found with id <%s>", prms.ID)
	}
	ok, err = lgc.store.IsConflictIndexPrefix(prms.ID, prms.IndexPrefix)
	if err != nil {
		return nil, 500, err
	}
	if ok {
		return nil, 400, fmt.Errorf(
			`index prefix "%s" would conflict with an existing index set`,
			prms.IndexPrefix)
	}
	defID, err := lgc.store.GetDefaultIndexSetID()
	if err != nil {
		return nil, 500, err
	}
	if defID == prms.ID && prms.Writable != nil && !(*prms.Writable) {
		return nil, 409, fmt.Errorf("default index set must be writable")
	}
	is, err := lgc.store.UpdateIndexSet(prms)
	if err != nil {
		return nil, 500, err
	}
	return is, 200, nil
}
func ( lgc * Logic ) UpdateIndexSet ( prms * graylog . IndexSetUpdateParams ) ( * graylog . IndexSet , int , error ) { if prms == nil { return nil , 400 , fmt . Errorf ( " " ) } if err := validator . UpdateValidator . Struct ( prms ) ; err != nil { return nil , 400 , err } ok , err := lgc . HasIndexSet ( prms . ID ) if err != nil { lgc . Logger ( ) . WithFields ( log . Fields { " " : err , " " : prms . ID , } ) . Error ( " " ) return nil , 500 , err } if ! ok { return nil , 404 , fmt . Errorf ( " " , prms . ID ) } ok , err = lgc . store . IsConflictIndexPrefix ( prms . ID , prms . IndexPrefix ) if err != nil { return nil , 500 , err } if ok { return nil , 400 , fmt . Errorf ( `index prefix "%s" would conflict with an existing index set` , prms . IndexPrefix ) } defID , err := lgc . store . GetDefaultIndexSetID ( ) if err != nil { return nil , 500 , err } if defID == prms . ID && prms . Writable != nil && ! ( * prms . Writable ) { return nil , 409 , fmt . Errorf ( " " ) } is , err := lgc . store . UpdateIndexSet ( prms ) if err != nil { return nil , 500 , err } return is , 200 , nil }
UpdateIndexSet updates an index set at the Mock Server.
UpdateIndexSet updates an index set at the Mock Server .
// indexPrefix unique check