java.lang.Object
org.elasticsearch.xpack.core.ilm.LifecyclePolicy
- All Implemented Interfaces:
Diffable<LifecyclePolicy>,SimpleDiffable<LifecyclePolicy>,Writeable,org.elasticsearch.xcontent.ToXContent,org.elasticsearch.xcontent.ToXContentObject
public class LifecyclePolicy
extends Object
implements SimpleDiffable<LifecyclePolicy>, org.elasticsearch.xcontent.ToXContentObject
Represents the lifecycle of an index from creation to deletion. A
LifecyclePolicy is made up of a set of Phases which it will
move through. Policies are constrained by a LifecycleType which governs which
Phases and LifecycleActions are allowed to be defined and in which order
they are executed.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.cluster.SimpleDiffable
SimpleDiffable.CompleteDiff<T extends Diffable<T>>Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.elasticsearch.xcontent.ConstructingObjectParser<LifecyclePolicy, String> static final org.elasticsearch.xcontent.ParseFieldFields inherited from interface org.elasticsearch.cluster.SimpleDiffable
EMPTYFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionLifecyclePolicy(String name, Map<String, Phase> phases) For SerializationLifecyclePolicy(LifecycleType type, String name, Map<String, Phase> phases, Map<String, Object> metadata) LifecyclePolicy(LifecycleType type, String name, Map<String, Phase> phases, Map<String, Object> metadata, Boolean deprecated) -
Method Summary
Modifier and TypeMethodDescriptionbooleangetName()getType()inthashCode()booleanisActionSafe(Step.StepKey stepKey) booleanbooleanmaybeAddDeprecationWarningForFreezeAction(String policyName) static LifecyclePolicytoSteps(Client client, XPackLicenseState licenseState) This method is used to compile this policy into its execution plan built out ofStepinstances.toString()org.elasticsearch.xcontent.XContentBuildertoXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) voidvalidate()static voidvalidatePolicyName(String policy) Validate the name for an policy against some static rules.voidwriteTo(StreamOutput out) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.cluster.SimpleDiffable
diffMethods inherited from interface org.elasticsearch.xcontent.ToXContentObject
isFragment
-
Field Details
-
PHASES_FIELD
public static final org.elasticsearch.xcontent.ParseField PHASES_FIELD -
PARSER
public static final org.elasticsearch.xcontent.ConstructingObjectParser<LifecyclePolicy,String> PARSER
-
-
Constructor Details
-
LifecyclePolicy
- Parameters:
name- the name of thisLifecyclePolicyphases- aMapofPhases which make up thisLifecyclePolicy.
-
LifecyclePolicy
public LifecyclePolicy(LifecycleType type, String name, Map<String, Phase> phases, @Nullable Map<String, Object> metadata) - Parameters:
type- theLifecycleTypeof the policyname- the name of thisLifecyclePolicyphases- aMapofPhases which make up thisLifecyclePolicy.metadata- the custom metadata of thisLifecyclePolicy
-
LifecyclePolicy
For Serialization- Throws:
IOException
-
LifecyclePolicy
public LifecyclePolicy(LifecycleType type, String name, Map<String, Phase> phases, @Nullable Map<String, Object> metadata, @Nullable Boolean deprecated) - Parameters:
type- theLifecycleTypeof the policyname- the name of thisLifecyclePolicyphases- aMapofPhases which make up thisLifecyclePolicy.metadata- the custom metadata of thisLifecyclePolicy
-
-
Method Details
-
validate
public void validate() -
parse
-
writeTo
- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
getName
- Returns:
- the name of this
LifecyclePolicy
-
getType
- Returns:
- the type of this
LifecyclePolicy
-
getPhases
- Returns:
- the
Phases for thisLifecyclePolicyin the order in which they will be executed.
-
getMetadata
- Returns:
- the custom metadata of this
LifecyclePolicy
-
getDeprecated
-
isDeprecated
public boolean isDeprecated() -
toXContent
public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceorg.elasticsearch.xcontent.ToXContent- Throws:
IOException
-
toSteps
This method is used to compile this policy into its execution plan built out ofStepinstances. The order of thePhases andLifecycleActions is determined by theLifecycleTypeassociated with this policy.The order of the policy will have this structure:
- initialize policy context step - phase-1 phase-after-step - ... phase-1 action steps - phase-2 phase-after-step - ... - terminal policy step
We first initialize the policy's context and ensure that the index has proper settings set. Then we begin each phase's after-step along with all its actions as steps. Finally, we have a terminal step to inform us that this policy's steps are all complete. Each phase's `after` step is associated with the previous phase's phase. For example, the warm phase's `after` is associated with the hot phase so that it is clear that we haven't stepped into the warm phase just yet (until this step is complete).
- Parameters:
client- The Elasticsearch Client to use during execution ofAsyncActionStepandAsyncWaitStepsteps.licenseState- The license state to use in actions and steps- Returns:
- The list of
Stepobjects in order of their execution.
-
isActionSafe
-
validatePolicyName
Validate the name for an policy against some static rules. Intended to matchMetadataCreateIndexService.validateIndexOrAliasName(String, BiFunction)- Parameters:
policy- the policy name to validate- Throws:
IllegalArgumentException- if the name is invalid
-
hashCode
public int hashCode() -
equals
-
toString
-
maybeAddDeprecationWarningForFreezeAction
-