-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Transform] Make it possible to clear retention policy on an existing…
… transform (#82703)
- Loading branch information
1 parent
6687a28
commit 7efce30
Showing
6 changed files
with
180 additions
and
10 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
...ain/java/org/elasticsearch/xpack/core/transform/transforms/NullRetentionPolicyConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.core.transform.transforms; | ||
|
||
import org.elasticsearch.action.ActionRequestValidationException; | ||
import org.elasticsearch.common.io.stream.StreamOutput; | ||
import org.elasticsearch.xcontent.NamedXContentRegistry; | ||
import org.elasticsearch.xcontent.ParseField; | ||
import org.elasticsearch.xcontent.XContentBuilder; | ||
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue; | ||
|
||
import java.io.IOException; | ||
import java.util.function.Consumer; | ||
|
||
/** | ||
* {@link NullRetentionPolicyConfig} is the implementation of {@link RetentionPolicyConfig} used when the user explicitly sets the | ||
* retention_policy to {@code null} in the _update request: | ||
* | ||
* POST _transform/some-transform/_update | ||
* { | ||
* "retention_policy": null | ||
* } | ||
* | ||
* This is treated *differently* than simply omitting retention_policy from the request as it instructs the API to clear existing | ||
* retention_policy from some-transform. | ||
*/ | ||
public class NullRetentionPolicyConfig implements RetentionPolicyConfig { | ||
|
||
public static final ParseField NAME = new ParseField("null_retention_policy"); | ||
public static final NullRetentionPolicyConfig INSTANCE = new NullRetentionPolicyConfig(); | ||
|
||
private NullRetentionPolicyConfig() {} | ||
|
||
@Override | ||
public ActionRequestValidationException validate(ActionRequestValidationException validationException) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public void checkForDeprecations(String id, NamedXContentRegistry namedXContentRegistry, Consumer<DeprecationIssue> onDeprecation) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public XContentBuilder toXContent(final XContentBuilder builder, final Params params) throws IOException { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public String getWriteableName() { | ||
return NAME.getPreferredName(); | ||
} | ||
|
||
@Override | ||
public void writeTo(final StreamOutput out) throws IOException {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters