Skip to content

Commit

Permalink
handle nullable use_legacy_rotation field in index set config (#18183)
Browse files Browse the repository at this point in the history
* handle nullable use_legacy_rotation field in index set config

* fix typo
  • Loading branch information
AntonEbel authored Feb 8, 2024
1 parent da40238 commit e6f8322
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public record IndexSetUpdateRequest(@JsonProperty("title") @NotBlank String titl
@JsonProperty("field_type_refresh_interval") Duration fieldTypeRefreshInterval,
@JsonProperty(FIELD_PROFILE_ID) @ValidObjectId @Nullable String fieldTypeProfile,
@JsonProperty(FIELD_DATA_TIERING) @Nullable DataTieringConfig dataTiering,
@JsonProperty(FIELD_USE_LEGACY_ROTATION) Boolean useLegacyRotation) {
@JsonProperty(FIELD_USE_LEGACY_ROTATION) @Nullable Boolean useLegacyRotation) {


public static IndexSetUpdateRequest fromIndexSetConfig(final IndexSetConfig indexSet) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.auto.value.AutoValue;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import org.graylog.autovalue.WithBeanGetter;
import org.graylog2.datatiering.DataTieringConfig;
import org.graylog2.indexer.indexset.IndexSetConfig;
Expand All @@ -29,12 +33,6 @@
import org.joda.time.Duration;

import javax.annotation.Nullable;

import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;

import java.time.ZonedDateTime;
import java.util.Objects;
import java.util.Optional;
Expand Down Expand Up @@ -74,15 +72,15 @@ public static IndexSetSummary create(@JsonProperty("id") @Nullable String id,
@JsonProperty("index_template_type") @Nullable String templateType,
@JsonProperty(FIELD_PROFILE_ID) @Nullable String fieldTypeProfile,
@JsonProperty(FIELD_DATA_TIERING) @Nullable DataTieringConfig dataTiering,
@JsonProperty(FIELD_USE_LEGACY_ROTATION) Boolean userLegacyRotation) {
@JsonProperty(FIELD_USE_LEGACY_ROTATION) @Nullable Boolean useLegacyRotation) {
if (Objects.isNull(creationDate)) {
creationDate = ZonedDateTime.now();
}
return new AutoValue_IndexSetSummary(id, title, description, isDefault, canBeDefault,
isWritable, indexPrefix, shards, replicas,
rotationStrategyClass, rotationStrategy, retentionStrategyClass, retentionStrategy, creationDate,
indexAnalyzer, indexOptimizationMaxNumSegments, indexOptimizationDisabled, fieldTypeRefreshInterval,
Optional.ofNullable(templateType), fieldTypeProfile, dataTiering, userLegacyRotation);
Optional.ofNullable(templateType), fieldTypeProfile, dataTiering, useLegacyRotation);
}

public static IndexSetSummary fromIndexSetConfig(IndexSetConfig indexSet, boolean isDefault) {
Expand Down Expand Up @@ -191,6 +189,7 @@ public static IndexSetSummary fromIndexSetConfig(IndexSetConfig indexSet, boolea
@JsonProperty(FIELD_DATA_TIERING)
public abstract DataTieringConfig dataTiering();

@Nullable
@JsonProperty(FIELD_USE_LEGACY_ROTATION)
public abstract Boolean useLegacyRotation();

Expand Down

0 comments on commit e6f8322

Please sign in to comment.